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 2A767A0543; Thu, 22 Sep 2022 15:04:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E66FA410D0; Thu, 22 Sep 2022 15:04:25 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2139.outbound.protection.outlook.com [40.107.243.139]) by mails.dpdk.org (Postfix) with ESMTP id 6AC8B40E28 for ; Thu, 22 Sep 2022 15:04:23 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QkGS+UadaT9EF7/ZeHBEfnfDJRbWLmOErmn/dCheO/v9QMn7IBIahZZmsWfpzpreP5UUsusblY/et79uJzsFnlQW9tbmUu1KgImdoOpgjyvtsjDUEBYX3zzmCjcqT+Sb8UpzxQhLc5f73SU1HtxAYbHCxX3hfg+rT5wxeqGpv7EETiH0Scuq1XhOo9rVAsvikDWpqeKdtze0Vmp15a3hR6HvXBbq/W+eNDOHj2D6u+wPZep2sPULXVVW/h5W8KYHof2xvYRykycSaXEt013pcZza7xQBjHX5hRQPCGHWuvoyUjknONtri3mKX8XUgSOoC2uAeOM2hdplS2wIYLp4pw== 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=Gv6cibQEJwk5keWTROjsoOMDByEOfAoNr/b5Q2CUC/w=; b=b9TbFVA0bNP5zBO43quRnk9MkSU2xYVyhqODfqGbLclrojRdjsjW8i1dnQ4Gjph4wMlAf8lO1EXkDMlHgq7g67r2AH771zRNbqNjLX0GE7DvIFG3fimZ13k6Dh1DaWki/rPtjwBS24Zc5OqwSOvdDmoblkN5prnvptAHo/3rCsxdZpEjJ2clwPeO0kGExGv/O5QMi6qTmu8NdYoVefio8+ivJFwH0JD3JMMwXF9beh0I5Mjmg2PM/5gTZkzcbXBo2nsm9BwJZmmXgTttB3sFDhy0hjZT6lvAqGVvXOG/V4M7pK74Lsjow8Ry6cDzTxGt+/l7IdXwF73odUqag9twSQ== 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=Gv6cibQEJwk5keWTROjsoOMDByEOfAoNr/b5Q2CUC/w=; b=HmiOFqtTf7EhiC9p5WBZw5q+zb7VwqhtV1nUpgoeVdDf/xqHjEvVLipnvJc3QRWb0aX1JdRDe5cEaYewfX8xd48tvwKAPz8+Em1DL0C7ZTkBexmdzLBYQYOy4M0QznVBm44gAxEJQtqoCR32rNP2ytgaRGaVFfQ/+CkGbPPBfdU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from DM6PR13MB4431.namprd13.prod.outlook.com (2603:10b6:5:1bb::21) by BN0PR13MB5246.namprd13.prod.outlook.com (2603:10b6:408:159::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.7; Thu, 22 Sep 2022 13:04:21 +0000 Received: from DM6PR13MB4431.namprd13.prod.outlook.com ([fe80::e198:fd7c:5eb4:89c1]) by DM6PR13MB4431.namprd13.prod.outlook.com ([fe80::e198:fd7c:5eb4:89c1%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 13:04:21 +0000 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: dev@dpdk.org Cc: oss-drivers@corigine.com, Jin Liu , Chaoyong He , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 2/2] net/nfp: optimize ethdev struct Date: Thu, 22 Sep 2022 15:03:14 +0200 Message-Id: <20220922130314.694790-3-niklas.soderlund@corigine.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220922130314.694790-1-niklas.soderlund@corigine.com> References: <20220922130314.694790-1-niklas.soderlund@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0146.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:96::20) To DM6PR13MB4431.namprd13.prod.outlook.com (2603:10b6:5:1bb::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR13MB4431:EE_|BN0PR13MB5246:EE_ X-MS-Office365-Filtering-Correlation-Id: 69e59e47-b504-4f5a-d8fd-08da9c9af724 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: expyHw9mdsCVrtnMdckOySj/J47QwlGFJVhGxX+qUu5HebMbPHaQ04BjJsu56Ns4JTncSnEetJmR5CyAsgFXQQlSGRgZJXfhS139ZdDt7U51u4NvmWYdGcxYwLwJOsg0aJ5PhEQJzwmwyfvHkS8OpK09ZABLU3eHQVMJpj6GN8hV61fVihw5Kq7cSUMnJ+SbhaZ3YXbEMdyNlkXZm4lo6M5SBFduxyXLL5h8Ar6D+WTb0M34tbYqH2CG3Canc5UmMlfOrZTty1IcY+i4kRbJRY8Y1nSnWhqbqz6TNZzURle8UjLkN6pwRDILMYlaSHRN1L761AhxLnRWxwzcGjuKdCLfUGkI4SrygmsCIATa/nPTCEYz1SkreZCBeNB3+H5GpsWdGLsos9sf2V1ieK/REz9kQ1SAfJIQhLYBBHxBrL5yIDbe2solObT8Elujb+VpzU817ITv1XD8d0fOEj5+75pmwFzeNwWE9E3NILER6u9LPLNRCy4q8wIbLom7JBFYqH09kK3t6YoCL8LXT3FHr6VP7a/lo3oXo+TylDvqBVzgHGRFTsRyWAXPDpw08XJVy3P5Nk2ME/v/GixSK4Uc+96RE/HNfZYAwecT976CxdL97SzHJIIaWxFtwjdYSHa+kWg4ipMrYlVKfyc77PADj3TOmPn0VHJf67dysDRUQieJfd5r3JPSKTEOe58KdKBJuqfLAiQ08mTsU7Ngm4z0cBc4rRm377LBVhS3cpinLVKU87X0Bnmt+LT9R/2l5tca X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR13MB4431.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(39840400004)(346002)(396003)(136003)(366004)(451199015)(66556008)(4326008)(478600001)(66476007)(66946007)(36756003)(8676002)(52116002)(6506007)(26005)(5660300002)(6512007)(107886003)(41300700001)(2906002)(6666004)(8936002)(83380400001)(2616005)(38100700002)(38350700002)(66574015)(1076003)(186003)(86362001)(316002)(54906003)(6916009)(6486002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YmtZdVZET0RadWhHR3E0UGlUaEU2OWdody9SMGJFaVhoODd4VHBDdUdyRGxC?= =?utf-8?B?RzZCajIySFZRdjViNnVvMG9ucGFaSytGVFlyVE5rak1yL2Z0eWhWbXQ5bXh2?= =?utf-8?B?TzMvZXZrV0ZJQW9xbENFQll2NDBzbmZoQnkzUTE4NzFsUnJteTI4YzBLNmZF?= =?utf-8?B?eTdIMmlvUjVveWMyaTRvRFAydGh6MlRVbEFaWFpxMnVVbXdyaFJsS1ZWek5n?= =?utf-8?B?ZVc2TFd6VVp5Y3lWTkxYTmcwN2Evc0g2djJoK200NUZzWG4xdkozMFZ5TS81?= =?utf-8?B?Q1QzQUZ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zSU8rS0p4?= =?utf-8?B?dFljWFBwNDh1YnRCOXZmQ3dJZ29hb01CL1RJaVdDb05RVkNHZmwzYklGVkIw?= =?utf-8?B?bFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69e59e47-b504-4f5a-d8fd-08da9c9af724 X-MS-Exchange-CrossTenant-AuthSource: DM6PR13MB4431.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 13:04:21.3997 (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: HncDnaT0K1uD6p1VL0c7SBvME75yH2mF8k99zUvHXHs/sK3i63OexDvTfSGvAw5akBEGHTbT0m0qgiLAK9P5XS8m5Y1U9cS7h2mpVDlgULg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR13MB5246 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 From: Jin Liu Before, use two variables to represent the ethdev structure for firmware with NFDk and NFD3, but only a few field values differ between the two variables. Now use one variable only, and to distinguish different firmware versions in specific functions. Signed-off-by: Jin Liu Reviewed-by: Chaoyong He Reviewed-by: Niklas Söderlund Signed-off-by: Niklas Söderlund --- drivers/net/nfp/nfp_ethdev.c | 36 +++------------------------------ drivers/net/nfp/nfp_ethdev_vf.c | 36 +++------------------------------ drivers/net/nfp/nfp_rxtx.c | 33 ++++++++++++++++++++++++++++-- drivers/net/nfp/nfp_rxtx.h | 5 +---- 4 files changed, 38 insertions(+), 72 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index bc69840777eb..3cb889bd015f 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -313,7 +313,7 @@ nfp_net_close(struct rte_eth_dev *dev) } /* Initialise and register driver with DPDK Application */ -static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, .dev_stop = nfp_net_stop, @@ -336,36 +336,7 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, - .tx_queue_release = nfp_net_tx_queue_release, - .rx_queue_intr_enable = nfp_rx_queue_intr_enable, - .rx_queue_intr_disable = nfp_rx_queue_intr_disable, -}; - -static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { - .dev_configure = nfp_net_configure, - .dev_start = nfp_net_start, - .dev_stop = nfp_net_stop, - .dev_set_link_up = nfp_net_set_link_up, - .dev_set_link_down = nfp_net_set_link_down, - .dev_close = nfp_net_close, - .promiscuous_enable = nfp_net_promisc_enable, - .promiscuous_disable = nfp_net_promisc_disable, - .link_update = nfp_net_link_update, - .stats_get = nfp_net_stats_get, - .stats_reset = nfp_net_stats_reset, - .dev_infos_get = nfp_net_infos_get, - .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, - .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_net_set_mac_addr, - .vlan_offload_set = nfp_net_vlan_offload_set, - .reta_update = nfp_net_reta_update, - .reta_query = nfp_net_reta_query, - .rss_hash_update = nfp_net_rss_hash_update, - .rss_hash_conf_get = nfp_net_rss_hash_conf_get, - .rx_queue_setup = nfp_net_rx_queue_setup, - .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_setup = nfp_net_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable, @@ -376,7 +347,6 @@ 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: - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; break; case NFP_NET_CFG_VERSION_DP_NFDK: @@ -385,7 +355,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver)); return -EINVAL; } - eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops; eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts; break; default: @@ -393,6 +362,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) return -EINVAL; } + eth_dev->dev_ops = &nfp_net_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index affea9d17cdf..96c4d3cca7bb 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -218,7 +218,7 @@ nfp_netvf_close(struct rte_eth_dev *dev) } /* Initialise and register VF driver with DPDK Application */ -static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { +static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_netvf_start, .dev_stop = nfp_netvf_stop, @@ -241,36 +241,7 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, - .tx_queue_release = nfp_net_tx_queue_release, - .rx_queue_intr_enable = nfp_rx_queue_intr_enable, - .rx_queue_intr_disable = nfp_rx_queue_intr_disable, -}; - -static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = { - .dev_configure = nfp_net_configure, - .dev_start = nfp_netvf_start, - .dev_stop = nfp_netvf_stop, - .dev_set_link_up = nfp_netvf_set_link_up, - .dev_set_link_down = nfp_netvf_set_link_down, - .dev_close = nfp_netvf_close, - .promiscuous_enable = nfp_net_promisc_enable, - .promiscuous_disable = nfp_net_promisc_disable, - .link_update = nfp_net_link_update, - .stats_get = nfp_net_stats_get, - .stats_reset = nfp_net_stats_reset, - .dev_infos_get = nfp_net_infos_get, - .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, - .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_net_set_mac_addr, - .vlan_offload_set = nfp_net_vlan_offload_set, - .reta_update = nfp_net_reta_update, - .reta_query = nfp_net_reta_query, - .rss_hash_update = nfp_net_rss_hash_update, - .rss_hash_conf_get = nfp_net_rss_hash_conf_get, - .rx_queue_setup = nfp_net_rx_queue_setup, - .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_setup = nfp_net_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable, @@ -281,7 +252,6 @@ 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: - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; break; case NFP_NET_CFG_VERSION_DP_NFDK: @@ -290,7 +260,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver)); return -EINVAL; } - eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops; eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts; break; default: @@ -298,6 +267,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) return -EINVAL; } + eth_dev->dev_ops = &nfp_netvf_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 8429b44de06d..12db07c276f0 100644 --- a/drivers/net/nfp/nfp_rxtx.c +++ b/drivers/net/nfp/nfp_rxtx.c @@ -657,7 +657,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq) txq->rd_p = 0; } -int +static int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf) @@ -991,7 +991,7 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk return i; } -int +static int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, @@ -1108,6 +1108,35 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, return 0; } +int +nfp_net_tx_queue_setup(struct rte_eth_dev *dev, + uint16_t queue_idx, + uint16_t nb_desc, + unsigned int socket_id, + const struct rte_eth_txconf *tx_conf) +{ + struct nfp_net_hw *hw; + + hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { + case NFP_NET_CFG_VERSION_DP_NFD3: + return nfp_net_nfd3_tx_queue_setup(dev, queue_idx, + nb_desc, socket_id, tx_conf); + 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; + } + return nfp_net_nfdk_tx_queue_setup(dev, queue_idx, + nb_desc, socket_id, tx_conf); + default: + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); + return -EINVAL; + } +} + static inline uint32_t nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq) { diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h index 5c005d74e79b..fa90c3e8e751 100644 --- a/drivers/net/nfp/nfp_rxtx.h +++ b/drivers/net/nfp/nfp_rxtx.h @@ -342,12 +342,9 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct rte_mempool *mp); void nfp_net_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx); void nfp_net_reset_tx_queue(struct nfp_net_txq *txq); -int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, - uint16_t nb_desc, unsigned int socket_id, - const struct rte_eth_txconf *tx_conf); uint16_t nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); -int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, +int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, -- 2.37.3