From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23B18A0545; Thu, 23 Jun 2022 04:27:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E73CA42B7C; Thu, 23 Jun 2022 04:27:19 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2102.outbound.protection.outlook.com [40.107.94.102]) by mails.dpdk.org (Postfix) with ESMTP id 0B7E042823 for ; Thu, 23 Jun 2022 04:27:12 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EH+XA9OrcEqAW2nywGiLlLH9C0vSNDruZkDOqK2xqWsYZ+ZIyt/UjVarE+PFO498XFCOq14NflxUaWzRxzMgCcAMzTCBpRkcbjLdWBs+KxsDMaWDOUCHDkFuKaAfDmyMaBGS5Hi+K3lngmTPQN73IwMrVMXZ0WhFztdjqKK1OMt5fZeiH2fbRf5OKwz5UwR/qKJvt2t0+y2hydE/XxrUfe1tjd+pOPbyaDoH/04c/pvoG41agr3YJcsLbvsLf85TfseT4WFhFFPGXOMI/0IZq3K7McKOtDQdAOKBNGxoKxDLd0Qmf9idWVjGnFI4x5DTFSSAFaL0G9x4dWvMHXlOjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L3T+F9lLbwKb/edutfQI/I6V5Tc0434kyN5Bx9zMMS0=; b=mLWbtVerQqM/n1qmh+6b5c/Ka216AmkjPdV7ghPCW49yfY4ZGmZmGlk1ELLHRjPFGf0Ek44sxWb8RxoQVqsmAxtatIrfo/nIUPW1YK2ppTUTiYFCS+g14xKI7Va+azpR7TV5vX6dfnyIq+Y6bxF9av3TO/E66C5oIV8ttJA3NWJdrJK7GfUHz0uH34ngjl6dMUCzcXPLVewkJzPk+qJU1CyQa4k66FfxqrqoIaODXJtDXKFiqU0uU64olFw+5aOwEHGjcJK7XlbU/GBVnnKcXvtb5FVSics8OqFoTmmNhLf2m+pnO09byrftTodeLSRFQyvtXzogmTNRcNRwsyxK5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L3T+F9lLbwKb/edutfQI/I6V5Tc0434kyN5Bx9zMMS0=; b=E5U8WQoEKIF99D/p3CPXOxHLMYFt1AeX71T9xtQJexXhktucUHcggGZGbCbmeof/xyzI9+SlYIk1xTHyH4VFqHEkA/ro2li6s5cjcwoTVX67qTBWon+Tj0E0qEZ1z7AZAa/4lfBtSiUILn34TV4a/o+AmMQyDsqxMul3sfwGWyo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) by MN2PR13MB3535.namprd13.prod.outlook.com (2603:10b6:208:169::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 02:27:10 +0000 Received: from DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35]) by DM6PR13MB3004.namprd13.prod.outlook.com ([fe80::ac31:a36a:cc15:cd35%7]) with mapi id 15.20.5373.015; Thu, 23 Jun 2022 02:27:10 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v4 07/13] net/nfp: support firmware with NFDk Date: Thu, 23 Jun 2022 04:26:09 +0200 Message-Id: <20220623022615.3628093-8-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220623022615.3628093-1-jin.liu@corigine.com> References: <20220617093444.2004000-1-jin.liu@corigine.com> <20220623022615.3628093-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0222.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:33a::10) To DM6PR13MB3004.namprd13.prod.outlook.com (2603:10b6:5:191::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96bace3c-f150-4b20-a605-08da54bfe009 X-MS-TrafficTypeDiagnostic: MN2PR13MB3535:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JjQ6nQPVOxcfB3ZYXkO/lLyLT8aUC8PQaxRboIVQedUT1ehVnAQkvLa73HTwhDTxXeUe1iRQ2JWTVAUWAFJ0MzgeEhX7SnqfD6mKnuBLvNLSEoQrLx14a4KrOpORyye9jHUUG+FuI34wlMkeIDtY6TKObYbxW5b1nn4WuxmfWoPsK2RZXRKdqcAIztTg24MDzKOJbMKg8XJXpxVMiu2ImJuROOGSqnXQS2d4S/c5MO1Wz3o7nv5/I3dzCUKLO0LJQhGStcYw382ZAp5K6xXpepHv+W9iXgzTHif+OyakC3jugnqBnveduZIbprpESOZmQcnCea2qGMSEEDQ9X3T7Omg5Qqg8pxvq+i8V8YuBTmNXdtltY1DN0oKRf5KjHgAi9ZfyXWjwpN6w3cU83VEi3Qxv3cIAtPOSV9iwtSviKRuiVZoceLZKKBm+dNnopsmauasnAP4/3iSLA4oxXVm8x1m5Xxxbx5e39hZaVlADNbOwnabGBs2BeZoqHQ3LDbZrOj9oI7Tynw14mophI+6vQHAAbEBOiEnqq2WJkkNwmbZvouDLGlWOdsHQqXpxvXdMCMe5YOye61xDe4ssfIVKkgRcZIod886FD6zMIgeUkpt8GPTVvwK8JvfpjjJNtgDIW2T0Qml3u324DiDztpKdwBbcrmSqr9KnWEU6v4hS/EZUfOjWKK/iGre5mRexS93bylXgfMwy4IjWW5TEUbTzbGRLmj9OF/AGecCzwTSeeljW8G94zJWa17IT+XVnhrBIYPtf8rIhsXAcHieNnLRDNAdvaCNSq0VukbSw7lYxAEz6V/wgtzRNYliRO3rZcaGdB6DUTLzsdL4GMtAdB/efYg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR13MB3004.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(366004)(346002)(136003)(396003)(39830400003)(107886003)(1076003)(38100700002)(38350700002)(6486002)(966005)(36756003)(8936002)(54906003)(2616005)(6916009)(5660300002)(316002)(66556008)(52116002)(6506007)(186003)(66946007)(8676002)(4326008)(66476007)(41300700001)(86362001)(6512007)(26005)(83380400001)(478600001)(2906002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N1hxVmkwVmFoRHltdkJRVzNTR1BwZUVoV0x1c0hJTlB5OUxuMkVRL2NIamp1?= =?utf-8?B?TTJZWE5OVFMyamJZcDhNMWFITzYvNXFOK3FuY3p5Sm1Eb3F6cjc2ZFJ1S3Bh?= =?utf-8?B?TzRHWkJDZkp1YkxJWjN2MHdZV01LVmFGL0pjcStkR2k4dGgxeHVDYUZHWG1r?= =?utf-8?B?Q0x0R290Uy9oanlzaFdoL0ViSit2VnorVVNINGgrbm9KVG42MEo3Z0lsbWEw?= =?utf-8?B?WUN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W5DMUY2SlhXZC8yd0tScjRja1JSRSt2R0dx?= =?utf-8?B?dDZwZEU0d0tpUm9ENzI2ZXp4SXNkbkxWai9qSWpDWjhYQzZKNUdKZDBJZk13?= =?utf-8?Q?YICXGc0sfRJIVLhlKpBn62JC4?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96bace3c-f150-4b20-a605-08da54bfe009 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 02:27:10.3374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PNQET0Mzs1InzHpYt+Df2ClMoCI+MhDM9UX28xEhRtJrA1RSvzp+cqvG7Ikqb9CITLX1Hg+bZs4zAFWb/Qzs0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3535 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 Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions. Signed-off-by: Jin Liu Signed-off-by: Diana Wang Signed-off-by: Peng Zhang Signed-off-by: Chaoyong He Signed-off-by: Niklas Söderlund --- doc/guides/nics/nfp.rst | 7 ++-- doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/nfp/nfp_ctrl.h | 2 + drivers/net/nfp/nfp_ethdev.c | 49 +++++++++++++++++++----- drivers/net/nfp/nfp_ethdev_vf.c | 53 +++++++++++++++++++------- 5 files changed, 85 insertions(+), 27 deletions(-) diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst index dcefac3ef6..55539accc2 100644 --- a/doc/guides/nics/nfp.rst +++ b/doc/guides/nics/nfp.rst @@ -100,9 +100,10 @@ more than one SmartNIC, same type of SmartNIC or different ones, and to upload a different firmware to each SmartNIC. .. Note:: - Currently the NFP PMD supports using the PF with Agilio Basic Firmware. See - https://help.netronome.com/support/solutions for more information on the - various firmwares supported by the Netronome Agilio CX smartNIC. + Currently the NFP PMD supports using the PF with Agilio Firmware with NFD3 + and Agilio Firmware with NFDk. See https://help.netronome.com/support/solutions + for more information on the various firmwares supported by the Netronome + Agilio CX smartNIC. PF multiport support -------------------- diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst index d5d8c735b1..64308e6c1a 100644 --- a/doc/guides/rel_notes/release_22_07.rst +++ b/doc/guides/rel_notes/release_22_07.rst @@ -111,6 +111,7 @@ New Features * **Updated Netronome nfp driver.** * Added support for NFP3800 NIC. + * Added support for firmware with NFDk. * **Updated VMware vmxnet3 networking driver.** diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h index 4dd62ef194..e73715e2aa 100644 --- a/drivers/net/nfp/nfp_ctrl.h +++ b/drivers/net/nfp/nfp_ctrl.h @@ -135,6 +135,8 @@ * - define more STS bits */ #define NFP_NET_CFG_VERSION 0x0030 +#define NFP_NET_CFG_VERSION_DP_NFD3 0 +#define NFP_NET_CFG_VERSION_DP_NFDK 1 #define NFP_NET_CFG_VERSION_RESERVED_MASK (0xff << 24) #define NFP_NET_CFG_VERSION_CLASS_MASK (0xff << 16) #define NFP_NET_CFG_VERSION_CLASS(x) (((x) & 0xff) << 16) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index cb84dc3188..1bbba9187e 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -358,6 +358,32 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static inline int +nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) +{ + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { + case NFP_NET_CFG_VERSION_DP_NFD3: + break; + case NFP_NET_CFG_VERSION_DP_NFDK: + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer, found: %d", + NFD_CFG_MAJOR_VERSION_of(hw->ver)); + return -EINVAL; + } + break; + default: + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); + return -EINVAL; + } + + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; + eth_dev->rx_queue_count = nfp_net_rx_queue_count; + eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + + return 0; +} + static int nfp_net_init(struct rte_eth_dev *eth_dev) { @@ -402,11 +428,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) PMD_INIT_LOG(DEBUG, "Working with physical port number: %d, " "NFP internal port number: %d", port, hw->nfp_idx); - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; - eth_dev->rx_queue_count = nfp_net_rx_queue_count; - eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; - /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; @@ -441,6 +462,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev) PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); + hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); + + if (nfp_net_ethdev_ops_mount(hw, eth_dev)) + return -EINVAL; + hw->max_rx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_RXRINGS); hw->max_tx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_TXRINGS); @@ -473,7 +499,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_cfg_queue_setup(hw); /* Get some of the read-only fields from the config BAR */ - hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; @@ -939,6 +964,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev) int err; int total_ports; struct nfp_cpp *cpp; + struct nfp_net_hw *hw; struct nfp_rtsym_table *sym_tbl; if (pci_dev == NULL) @@ -988,11 +1014,14 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev) "secondary process attach failed, ethdev doesn't exist"); return -ENODEV; } + + hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + + if (nfp_net_ethdev_ops_mount(hw, eth_dev)) + return -EINVAL; + eth_dev->process_private = cpp; - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; - eth_dev->rx_queue_count = nfp_net_rx_queue_count; - eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + rte_eth_dev_probing_finish(eth_dev); } diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index c46ee0f913..0b4660aba6 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -265,6 +265,32 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static inline int +nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) +{ + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { + case NFP_NET_CFG_VERSION_DP_NFD3: + break; + case NFP_NET_CFG_VERSION_DP_NFDK: + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer, found: %d", + NFD_CFG_MAJOR_VERSION_of(hw->ver)); + return -EINVAL; + } + break; + default: + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); + return -EINVAL; + } + + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; + eth_dev->rx_queue_count = nfp_net_rx_queue_count; + eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + + return 0; +} + static int nfp_netvf_init(struct rte_eth_dev *eth_dev) { @@ -292,10 +318,19 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; - eth_dev->rx_queue_count = nfp_net_rx_queue_count; - eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr; + if (hw->ctrl_bar == NULL) { + PMD_DRV_LOG(ERR, + "hw->ctrl_bar is NULL. BAR0 not configured"); + return -ENODEV; + } + + PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); + + hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); + + if (nfp_netvf_ethdev_ops_mount(hw, eth_dev)) + return -EINVAL; /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) @@ -313,15 +348,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) pci_dev->addr.domain, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); - hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0].addr; - if (hw->ctrl_bar == NULL) { - PMD_DRV_LOG(ERR, - "hw->ctrl_bar is NULL. BAR0 not configured"); - return -ENODEV; - } - - PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); - hw->max_rx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_RXRINGS); hw->max_tx_queues = nn_cfg_readl(hw, NFP_NET_CFG_MAX_TXRINGS); @@ -354,7 +380,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) nfp_net_cfg_queue_setup(hw); /* Get some of the read-only fields from the config BAR */ - hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION); hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP); hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU); hw->mtu = RTE_ETHER_MTU; -- 2.27.0