From patchwork Tue Aug 2 08:48:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lichao Liu X-Patchwork-Id: 114833 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 46D45A0548; Thu, 11 Aug 2022 10:25:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B197D42BF5; Thu, 11 Aug 2022 10:24:46 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 5CBC4400D7 for ; Tue, 2 Aug 2022 10:48:48 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id f65so11792215pgc.12 for ; Tue, 02 Aug 2022 01:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DdieZyuey5PFbysyjQ1swhzzRpcg8nbrG5lhC6hCyzc=; b=2GBtjqCzaL/I4yWnIVF4aW8rrl1RUWMQU/dRKQKxtuuie7gY75YhtTDlWLddpom0vd a3WIMX/MVlz81A2dU2V8QRXp/nLeFc6PMGW0eB64X/q5jBH7HRYCwkn5ZwRndevml9ls 07wCge4dDHQNKokMMn0pAY60i0fwM8UyTB69y3tk+bsqiPryNtgFwQds/h+Bx7ExV/Oa iLx+hF5KJyrRXpegUzIg1n+PKmNT0NffeKjs9e1xx7cAXDhd1tXXxchJz/FP0ZnysD5P ftpokFhzGw5XOC5wF99v9Gak6oeqa+CRXl5dyGSB46K9F/B4asa0ChObksKJ5l76RLA1 G02g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=DdieZyuey5PFbysyjQ1swhzzRpcg8nbrG5lhC6hCyzc=; b=M+4mLtTWkybJ17/67GM7tVOdJSS0GCmP8IezSDK2zERyuoYsCbxtBz+fMb6WSG/4ur s8PaAbtx4b09B78nxawkUu/QGTwrk1ECjNli+1/Uf99HJq4o3HUso6cRIxklEyYOZPCl /Mv584JLVt6LzQIzhQJSqkuvnKI8+q9vlBxyCeAbd+CrWr+ZI4qXcrGD5laEzg9oiGgn Kmrv7CV7T8qZQIpUBiz5GViz9wtNk0rDKwHCDpF/SqGbAcD5/U/Xf9P4GGvW7zhVTkH3 RF/q0wmT7hLDiIZUUbGtME5Tt9gq3lgY48JbquvlnqLtLI4vGyvkzyZ/cSNXNE69UaPD bogA== X-Gm-Message-State: AJIora+DRDqoVA23y6NqWSYaLais0sCO8jTfR5OvRs2rmqiep1JmQH6h HtC5EYXxvA1msmrTOe020bWR+aWer50C4w== X-Google-Smtp-Source: AGRyM1sSbKZlVjR9vKW77rx7SkjPFO9WVQBjV16q4Q0FEnQv6xxCW18drMFnnaRpwae8+tT0EWS0aw== X-Received: by 2002:a63:4f06:0:b0:41a:529b:b47b with SMTP id d6-20020a634f06000000b0041a529bb47bmr15930710pgb.243.1659430126942; Tue, 02 Aug 2022 01:48:46 -0700 (PDT) Received: from C02D840CML85.bytedance.net ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id d188-20020a6236c5000000b0052c7ff2ac74sm10436199pfa.17.2022.08.02.01.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 01:48:46 -0700 (PDT) From: Lichao Liu To: dev@dpdk.org Cc: Lichao Liu Subject: [PATCH] bus/pci: 'RTE_PMD_REGISTER_PCI' support expand 'nm' Date: Tue, 2 Aug 2022 16:48:39 +0800 Message-Id: <20220802084839.30118-1-liulichao.09679@bytedance.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 11 Aug 2022 10:24:41 +0200 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Before, 'RTE_PMD_REGISTER_PCI' can not expand nm. So, it can not work in this situation: #define TEST(a, b) a##_##b RTE_PMD_REGISTER_PCI(TEST(a, b), test_pmd_driver) Signed-off-by: Lichao Liu --- drivers/bus/pci/rte_bus_pci.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 1c6a8fdd7b..4f11bda19d 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -270,8 +270,7 @@ int rte_pci_set_bus_master(struct rte_pci_device *dev, bool enable); */ void rte_pci_register(struct rte_pci_driver *driver); -/** Helper for PCI device registration from driver (eth, crypto) instance */ -#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \ +#define _RTE_PMD_REGISTER_PCI(nm, pci_drv) \ RTE_INIT(pciinitfn_ ##nm) \ {\ (pci_drv).driver.name = RTE_STR(nm);\ @@ -279,6 +278,10 @@ RTE_INIT(pciinitfn_ ##nm) \ } \ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) +/** Helper for PCI device registration from driver (eth, crypto) instance */ +#define RTE_PMD_REGISTER_PCI(nm, pci_drv) \ + _RTE_PMD_REGISTER_PCI(nm, pci_drv) + /** * Unregister a PCI driver. *