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 A852FA0547; Thu, 16 Jun 2022 04:41:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6ED0842C00; Thu, 16 Jun 2022 04:41:15 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2138.outbound.protection.outlook.com [40.107.94.138]) by mails.dpdk.org (Postfix) with ESMTP id 1330D42BF1 for ; Thu, 16 Jun 2022 04:41:14 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kyd7gYleVaOvDgG7iy3cHtuLa73fLRFTavygJ5umMvgknWoU2yfvyBeVy3R9Lz5qd+N/EweVxgYC6bzUcuuq2c5TSy4ZEMwYwNvSwmr/n2Tr0WRFm/flWXY3zrrAQNR82qeqDQA9mvANA1rBBaPFDRVjMxU+2jhocICM8YoYcTV5NY+ufUJI1X0yB0wUrSy4RySNS5P44NwyTV88RxisS1pdBHfzPQys0wRjv/vHDEC45nAhoizQDJ04fZMVyo9MIeFf/F2xLXg/P58hiHMGrsl7X5pk4zJh24ZTTpYXfgznyiELTi6hTfn0OnGx5vPYM1mp3xFDnbbNtYuzbOkN0A== 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=kyDrMH/gDMj1tpX2qd0wg/rKtpFQNSY7yDF6dBKiPlo=; b=UIRDx8kHaWpgScCtXECcy1O+q2izIIcqr69kKbTkhcbhdzdCHIZ0rFxPn958VtMelVU/ldJEP1xlJOoMfdIapVpNriXoZCwhmhEz6vgUY3W5oiiNur2yKkzBR67BYHFiBK0etTiL43EwTyX3r8bD4FAuvxVZhLlX3fAthHbpsxetm0LZpFaWWU3I44+XyHsTdXODrhTAbMEavwZDvmV5xMlots+kg+S0Koaq8PCyebYNWgTY/qJ7MoG7vQz6CVuauNw9YwZrqbnW8mqcurPVoZ4n4/7sPvZp+5oOQTT0Yj2zyziYW+JS5Mn5kBlbOCsHj6sG1lCFYlwQwE1KsPimzA== 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=kyDrMH/gDMj1tpX2qd0wg/rKtpFQNSY7yDF6dBKiPlo=; b=WMZmUAiC2H2+4IgjogSGuYvdk3M3GvyeLBe2r85ihen2QAoE52Gn9bRgeddUFbLNO25wqi+HSESV404vkRakJAA92fGCPm4IL2LD5eLjxSfk87pcHeFPy4AmVL5LYmBRdFZZ8kwIFfp3VuFnwPbnBqz7Xge3hKkPI4mNyDn9wWY= 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 DM6PR13MB2345.namprd13.prod.outlook.com (2603:10b6:5:be::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.9; Thu, 16 Jun 2022 02:41:12 +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.5353.011; Thu, 16 Jun 2022 02:41:12 +0000 From: Jin Liu To: dev@dpdk.org Cc: niklas.soderlund@corigine.com, Jin Liu , Diana Wang , Peng Zhang , Chaoyong He Subject: [PATCH v2 09/15] net/nfp: support firmware with NFDk Date: Thu, 16 Jun 2022 04:39:33 +0200 Message-Id: <20220616023939.1798769-10-jin.liu@corigine.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220616023939.1798769-1-jin.liu@corigine.com> References: <20220602015304.710197-1-jin.liu@corigine.com> <20220616023939.1798769-1-jin.liu@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0087.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::20) 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: 2039d673-1fb3-4036-8cea-08da4f41ad27 X-MS-TrafficTypeDiagnostic: DM6PR13MB2345: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: 3MZMfdk/BCxB0KvWtrHH8soe+7QgIjzkQN10Nu1at2UKxj0A6eYf4cp2z+mMJ9L4k8rqxXGKLSMmiM9C3ojfctWXupvbVe+i4LPUbXGtriEh8dVmWjcp4PhIPhqBUFfBTk56RNUL8bT4G8HCI9CoIVg8Pxc9vWyDXgF5axal8u6NKuWLZ2EyKEeHA0Sr1STvcksbkCEVlA+2c3QZHjmvC3rmPWTBcTCXD//BQQThGAeFNZsry4cE6V6F1zQzEuELOtLIdphymDM5joVt5znHeRI1ffAWmG6QHn+kwk2RIAumYHOoLI5sd9Lc7w0SN3s5DS7tYxacWvFNkxmjpTLwWs04/KTWknxWCPhCESxE2IM8Vcv30o6/+MbFRk4CwMUfE295VrYL3t55KsSgA63507rW0c6UqU5GJYWRUZ6BY5jb2NBQ8GJYj/nGuz6sdOM1XHgdj7IFQpDzBhW3tU8WRPg0ac8/49sqcrFbAuAT1SnM1Vd73H8J3RO9qymcP4drzdy4BpFtTcFjTC67h2Aw7howbAJWMySAoBT0PouoUkQBKIFxkZYeJCDEtXhRQyFTMJL1qP1aYKpAXC3XpLqI4uS9lZNwzOPq0/fDuhBIbPArcQfo73CiHolG6zCElK946nPjDyRUKNUYFkocdJSqo2dbgJyKmm3gyyn4nhjnJ0VUhA1BeUxq9yqgbLfG1ElNtK6e7+d4DV8is+JLrmBVwQ== 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)(346002)(396003)(366004)(39830400003)(136003)(6506007)(6666004)(26005)(316002)(186003)(107886003)(6486002)(508600001)(41300700001)(2616005)(83380400001)(1076003)(36756003)(54906003)(6916009)(66556008)(8676002)(2906002)(4326008)(44832011)(38350700002)(6512007)(52116002)(5660300002)(66476007)(66946007)(86362001)(8936002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b004R0JpODBKaHhSSHFRZnVBY1Z1UUFxcVBMZ3hGcURqU0VlWkIveTRWdmkr?= =?utf-8?B?TmQxVHNtbVlHcW56bHZFaktiVkwvenUvRUtVT0RweFRSc1VqZDYrMlA2bmp5?= =?utf-8?B?K2R6TmVQNzNlaWo3NFYvQUFXUG5JSk5lSjMyR3hvbUNnZ3pnU1B4a2NVVEhI?= =?utf-8?B?NG5nRnprRk5nREc3dHZqUTllYjVoNmptZTZod2xqOGhvZklLUjB2cXhxN1Fr?= =?utf-8?B?OExFdjN0K1NVTkJoQnNLaUJHU3Q3b2laK2pkM1NkSXkvTFJmVTVLUnRDd0h0?= =?utf-8?B?eC81cmxwVnVTS0huUFNjYmwrSmpjZC9sbTRnSXFUREN1UDBVeFhvd00wa3Bw?= =?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0aEZ5Z2xhWHJSdmoyK1hVRjFHcG9CdG1GMFNyMkNaRGpr?= =?utf-8?B?cHVHZSs3N3NqbFNtNEZpZjZUK3JtM1BxRXI5ZUh1alBkSEtYMzYveGdYc3FX?= =?utf-8?B?WVVaSWtIV0xmSXlZc3pVUjd2cTFJZEhFTmlWdU9XcDlWdGIrMXlBb3JoYkg4?= =?utf-8?B?VUwyUEtKRm1TVy9SRGNPcG5EUnU1YXpMYTdiUTdES29rZDh4emR6QT09?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2039d673-1fb3-4036-8cea-08da4f41ad27 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB3004.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 02:41:12.5521 (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: kgtCRiCmUSfaAX3aXMu5R55m4D8H8dDmJDWieK1sjYFtHpk5ObgVYEMwamLvuTqW9hAc2U3N/aJnCm/25+r2ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB2345 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 --- drivers/net/nfp/nfp_ctrl.h | 2 ++ drivers/net/nfp/nfp_ethdev.c | 49 +++++++++++++++++++++++------- drivers/net/nfp/nfp_ethdev_vf.c | 53 ++++++++++++++++++++++++--------- 3 files changed, 80 insertions(+), 24 deletions(-) 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