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 BD94243EAA; Fri, 19 Apr 2024 07:25:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60F2740A73; Fri, 19 Apr 2024 07:24:41 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2104.outbound.protection.outlook.com [40.107.237.104]) by mails.dpdk.org (Postfix) with ESMTP id 2FD58409FA for ; Fri, 19 Apr 2024 07:24:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1UxZFjmBkPf5XkHv59iH8dYJUoz3imkhswdkvlZ/V5Aa6h42Xn7MHuMgqNbzfDDg8e2f4V6Qgd42qW0P3JvSYxq6lxkm61+cj5/cKu8c1z6vUFhL+L3z7mFi8LCgl1jCbVJIzUx+4Zm+vby07xqgBldI2THvqR9wppcJtm27DbD6Eoo1u/ugAMUaSJr6ZXxs84bQj7jbtCK7aYca7kZH/BGU2Qa3TS6pyQ5RlKc9g+38r96udtceWXFMnCq0k5rSeBAcKpXi+uNUObNAfofFz8bLs+cDzGy/Sb9pIcRi0ohHM2eHQZkDHJ2FHiGLnUbt8MaGRKCR6w1jVWsWGWiOQ== 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=fOF507cA1IdFixWs8MrwNvB/V0tFRT1K7afI1C7uQX0=; b=bhqXYs929NnVBUje877VHDPNiUBaBERosN2Cq1d4IlbQu7j4EoEPRSroQmS1GEvjbLq1y8eVaY2Od8oTBGEgXRWnURX4IJmp/08IDYlrlMqvKewPVuZGZ0r2Ft1DSxRqPHeMmtIGiHwsC8PTg0VW1B187GVn+Pjr0/TsCwc64CtOEXzec4nJ9MWF927JB6CtD2YoTsjpyNYI49CgFfc4eiBQW9PqtH6S0iOs6jAm+pSS+e8WqKyjKYRGpsWqXaPLjKh3AVeeUm7nGQmfU9Cw6yubig9u+mttT9EQzlnL33N/6jUNRbxg2NYzWo8PypuyfVYEqjgJI/wSC5vU6IP4dQ== 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=fOF507cA1IdFixWs8MrwNvB/V0tFRT1K7afI1C7uQX0=; b=j2bgf3OEEASvbti6AFDYuFeHJZOeDSl8zGoBlrIEs9tPPPjrQJOak7CIJXTkuLjw85vsZWlJAxpVoxvLtazmORL/LCJLY4PR+lGyyaDcNoUlkQXL7FdoGuDqSe9xdliTABYi2jey3OvAohWrzs+ZHRSnid5fkKJBvmuL5Kh8U3s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by MW3PR13MB3961.namprd13.prod.outlook.com (2603:10b6:303:2c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.42; Fri, 19 Apr 2024 05:24:33 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::ec12:7411:559a:850e%5]) with mapi id 15.20.7472.042; Fri, 19 Apr 2024 05:24:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , Long Wu , Peng Zhang Subject: [PATCH v2 7/8] net/nfp: remove ethernet device data field Date: Fri, 19 Apr 2024 13:23:48 +0800 Message-Id: <20240419052349.1294696-8-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240419052349.1294696-1-chaoyong.he@corigine.com> References: <20240419031226.1191069-1-chaoyong.he@corigine.com> <20240419052349.1294696-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR03CA0087.apcprd03.prod.outlook.com (2603:1096:4:7c::15) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MW3PR13MB3961:EE_ X-MS-Office365-Filtering-Correlation-Id: 15529740-e34e-4340-8ac8-08dc6030fe4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?c3nIQrR7iFH82hgM4bCOSpvpLWkPvy744DGU3hgJ2BYuVnyQNSJc+4BHMqHk?= =?us-ascii?Q?koxSjKHgcSzOauoSX0+Rpfj70gSkfzCNTZZs8mtdTt8r54mRBRGeJTCwRh34?= =?us-ascii?Q?12OXrel5LRaJ7yjAQN8vles5y+cX2j/NNNL9ge6ipEkFzAW9ZsvcqZ6LPplq?= =?us-ascii?Q?fUkdzTG5WYZEWi0PNRlgmuVdwUvLCi93uuwEJdxnlCaA9wNlvDSaGlNy6627?= =?us-ascii?Q?p5k3/LNn4Q+jaB0HTA9iDGItKqLFx8sMfViyMjGPL0Aes/yNKBzSGgGNsshO?= =?us-ascii?Q?LFVZ0iQeSFp3NwHfsZskm4tYKOLv4QHWHSRkqT3X5XdYwAsC6m6n7ZiqhHs/?= =?us-ascii?Q?fYoZdnSTBFgGv2VxK66y3MdNIjnP0Y12QDX8I04RW1ubbUlVvYo4veNas3n+?= =?us-ascii?Q?71vibMUEiSBwxvy/zsXp5RGH1iEF2QEsHhS/En/5PkWdmxXoqDEws9iti6cf?= =?us-ascii?Q?p4JWmaWRQNO95A1qdTpRVoA15GieXUmiNA1/n0G/XFhVovRW588lTcn/WeTO?= =?us-ascii?Q?f7R5+fnLKUVo3hShZpeoDJSByZ0b9K7RWoClf+ge8GaEbvfUzK49WiF8f2gn?= =?us-ascii?Q?RodW4VApMpIXe2zxkeCuVWj7FP59wzRgIgMVd64l9e3/UUbUmpteoTdo8378?= =?us-ascii?Q?BvkwTAqtyUMwVqVG+AUYyEsGDmk9BD8csGhfHBIn7YQz1smEz0tVTkAjvnQE?= =?us-ascii?Q?LZxJfoo2NPOAaUka5zO6BySsxzrbRRuxFqfwmJa0wc58qOvPlZtLKmBgU0JJ?= =?us-ascii?Q?OZD3zCwCNt5Am/eWoqqEM+gPvgcmq6ce0MhtUofCM209gasvY3GgMwceuRTT?= =?us-ascii?Q?B1oP61T5O8tuNcUedpEUVQU0xmk2WqHRjn8Pasy+wM6zSfBlsUGVPk/+MIAN?= =?us-ascii?Q?E9tCsktd8FuvvuG6ELyfvZx+oT5OvHMFLyk+YwSwSlLxUo/2t1hLoaVyRBR6?= =?us-ascii?Q?z0fMkfNeJqKcJCL7LbLHFlo4SKS6vO2J2yj0QHTsg+WF7igROy05ut24QWe2?= =?us-ascii?Q?PaK0HnUuS3uc/UuUgCZI70tMCm35UI18thz83lkbQw+BXomlpOyjR8vKGGSA?= =?us-ascii?Q?d7TctrYPSOi39URDJzZGiXtCCYG6zMumOmVeEfM6GrnWk3myXQHTmXFI+qMM?= =?us-ascii?Q?7c/rYBzfw/E8xV0Kixy1lSKiWp2p2P6cLTFST4wuyH0mfUtooJq2cRXekH6d?= =?us-ascii?Q?GXon3/LwjVJ+8DkWOyGvIei5EZOJALXBFox/VldYjJ7v7DitphJAZJ2fBzG2?= =?us-ascii?Q?OFI5wyHahpRFy7OYYU64MlRcv16nGP3n/b/PDAk11bOV2VquqayoOv5/B7To?= =?us-ascii?Q?Zy2PC2gCngZSQeOPwN+poPKqkuGzX1STnHoJC2VU0CuFhQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(366007)(376005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Gyu2BFCPLl2287zj1RpSLCXtd2L+DxYEezo7KFp4G6Rf5a+pZNlSu4bivagi?= =?us-ascii?Q?7z2wqBF/2Bn5fidUQLfdulsee0UUHrdUEx7vcJe7dio0Y2bWFvg8Sqs8V+dY?= =?us-ascii?Q?dAtOE97wXAbS1bdkJ2KEI9+55MIVjE7O2a7vfiiSS/iNqz17Gw1ZEAgRAd+Z?= =?us-ascii?Q?kAG2mehypvOrK2AqSFQrIClHrCV2BAB731yPFd5eeT01hVhRR1p6a5LXEkRd?= =?us-ascii?Q?U6AcK+AGZAnTrK37ELxOntNo/830tixxXNYilUa1gQYoA+StVfbKNQArsKxx?= =?us-ascii?Q?xfPKz5qYZTFmTkbimsxWqJ8AYZifPQy65HUSEnq5Zoa8o3/SkdDpPYQ+F2+t?= =?us-ascii?Q?1K/jcj1FKILp/BbSDpeIsCVe7nutFa4KW7WefAx0AIJEtkWjrrzTRCl8Sd4f?= =?us-ascii?Q?4MkAgbVhd6obauIl0P0mrXaimb5JTYFp+kbGfyz2v0OZOaYTA98KmrTy/S61?= =?us-ascii?Q?OtmWy2We4KEK529mKIJoQuCpoHmUyef5g+vsgiS/c2tjVgny922IA9jGJ9Xv?= =?us-ascii?Q?nrill1PIMpBxwERxr1k3SSR8ENk5rN0Qr363naBy9Bi6I5avWFKq+BVQNFnM?= =?us-ascii?Q?VC+QH+Z5k6aau5qJgTkUl7b6Xxz1z06B+JMN9i/N7MbAm9HxTF/0tzyhA9VB?= =?us-ascii?Q?woANNo+6l8AWtthEVl/mOnAyyZse01fvZyKHjT7WdCQG9Qdu7Z6agn1zhnhr?= =?us-ascii?Q?N/8UYyh59MVVYTA9PIgQ5go5GnJNeV33Y6ot76uxgbpjueUo57Jum+wcUMS4?= =?us-ascii?Q?cPAUXrMvYlhO7WIWhYk0Lqz5q91OOWEqKFKzeUfH2Hc7IG/3L17VoMwCyfsH?= =?us-ascii?Q?EbHy2fn+dEZzlLg1P6o+qzsSMJFHXdxBF/e7BfGusZZ+ksVI4f13vt6O1SNI?= =?us-ascii?Q?u8fsdiENd336KzZjcH1EBhlpRnutN5AHZCf1TUoiTgoScWfnPtojwxWCJyxC?= =?us-ascii?Q?O3RtNT2GkniOY+esPvJWCtPZzbko6xxRYkekENlhGD7SpN88t3nXYe7X1Wgq?= =?us-ascii?Q?qS8j6Ys5u3c3ZGP2fwuGg2yBUt4mQP39cuhFYfq72uZ3sV8kQ0y1YXO1mAXy?= =?us-ascii?Q?s4oFGpoyZknj0WIDkmGL/oGhSLgqG8ONBkWh4dJo8LTbobMzUcJZTbT+FeVl?= =?us-ascii?Q?jjmdzfJS0oUUx9dPt6O6R8WHlXYygVmVpUqMVBHOm6bNOiXpOI+pu71XsJTm?= =?us-ascii?Q?rmmOEid8WY36PFqZeaoFy8lBImj2lEimh454le5bw9JFuQlcfR/ylY/gxLpB?= =?us-ascii?Q?4lY1tfmugftJwiXcpqbdK2PkF8uLgkv/2q1OgUmG/Jz4LXDmmEOcuUqqS5d4?= =?us-ascii?Q?XaADWcBsVbro6ZnlN6g6XmQHvudHYvHi1U55u7uzZGXH3S3Qr9JNAnJA63ic?= =?us-ascii?Q?c5awXd1aW7t2FeVK5bndWZDVNKEYrw5kLHDBaRfkHA01ML2UOXKpeZKHQ85t?= =?us-ascii?Q?cJfv6szaw9KUA2nGoVj6T84gwjsdFx2AjupqBLmWaqw2FJovJDy8beZpDEll?= =?us-ascii?Q?sf5VFnp0rhEgrCKkwXBmnaomi5cJdHg300xFxTyJ/N2Q21/GzwFEWpatnVvq?= =?us-ascii?Q?BlVxAR3EkQsGW9PN1p1e/KMGM4o71UA8J1qeiM4Gc9Ppd5LyT/MwnCX3/wij?= =?us-ascii?Q?Fg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15529740-e34e-4340-8ac8-08dc6030fe4d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2024 05:24:33.3166 (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: PfOuePKs/qk11F3luzUWUnBWY5IaCWV52oCOr/KIOImAxCUMVlabnyQaVF5uMvgV2v5RUgm8lBEdFXxl0y1aSgcTQndAu1myrPyuDI7wy0Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR13MB3961 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 Remove the 'eth_dev' field in process shared data 'struct nfp_net_hw', and modify the related logic. Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower.c | 16 ++-- drivers/net/nfp/flower/nfp_flower.h | 2 + drivers/net/nfp/flower/nfp_flower_ctrl.c | 8 +- drivers/net/nfp/flower/nfp_flower_flow.c | 16 ++-- .../net/nfp/flower/nfp_flower_representor.c | 76 +++++++++---------- .../net/nfp/flower/nfp_flower_representor.h | 1 - drivers/net/nfp/nfp_ethdev.c | 36 ++++----- drivers/net/nfp/nfp_net_common.h | 3 - 8 files changed, 78 insertions(+), 80 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index 83249feedb..76e5d674f1 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -271,15 +271,15 @@ nfp_flower_init_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower, } /* Allocate memory for the eth_dev of the vNIC */ - hw->eth_dev = rte_zmalloc("nfp_ctrl_vnic", + app_fw_flower->ctrl_ethdev = rte_zmalloc("nfp_ctrl_vnic", sizeof(struct rte_eth_dev), RTE_CACHE_LINE_SIZE); - if (hw->eth_dev == NULL) { + if (app_fw_flower->ctrl_ethdev == NULL) { PMD_INIT_LOG(ERR, "Could not allocate ctrl vnic"); return -ENOMEM; } /* Grab the pointer to the newly created rte_eth_dev here */ - eth_dev = hw->eth_dev; + eth_dev = app_fw_flower->ctrl_ethdev; /* Also allocate memory for the data part of the eth_dev */ eth_dev->data = rte_zmalloc("nfp_ctrl_vnic_data", @@ -529,7 +529,7 @@ nfp_flower_cleanup_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower, char ctrl_rxring_name[RTE_MEMZONE_NAMESIZE]; hw = app_fw_flower->ctrl_hw; - eth_dev = hw->eth_dev; + eth_dev = app_fw_flower->ctrl_ethdev; pci_name = strchr(hw_priv->pf_dev->pci_dev->name, ':') + 1; @@ -562,15 +562,17 @@ nfp_flower_cleanup_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower, } static int -nfp_flower_start_ctrl_vnic(struct nfp_net_hw *net_hw) +nfp_flower_start_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower) { int ret; uint32_t update; uint32_t new_ctrl; struct nfp_hw *hw; struct rte_eth_dev *dev; + struct nfp_net_hw *net_hw; - dev = net_hw->eth_dev; + net_hw = app_fw_flower->ctrl_hw; + dev = app_fw_flower->ctrl_ethdev; hw = &net_hw->super; /* Disabling queues just in case... */ @@ -736,7 +738,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv) } /* Start the ctrl vNIC */ - ret = nfp_flower_start_ctrl_vnic(app_fw_flower->ctrl_hw); + ret = nfp_flower_start_ctrl_vnic(app_fw_flower); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not start flower ctrl vNIC"); goto ctrl_vnic_cleanup; diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 5c2f338a20..ae80782df4 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -63,12 +63,14 @@ struct nfp_app_fw_flower { /** Pointer to the PF vNIC */ struct nfp_net_hw *pf_hw; + struct rte_eth_dev *pf_ethdev; /** Pointer to a mempool for the Ctrl vNIC */ struct rte_mempool *ctrl_pktmbuf_pool; /** Pointer to the ctrl vNIC */ struct nfp_net_hw *ctrl_hw; + struct rte_eth_dev *ctrl_ethdev; /** Ctrl vNIC Rx counter */ uint64_t ctrl_vnic_rx_count; diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 4c2aeb9849..de6e419cac 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -153,12 +153,10 @@ nfp_flower_ctrl_vnic_nfd3_xmit(struct nfp_app_fw_flower *app_fw_flower, uint32_t free_descs; struct rte_mbuf **lmbuf; struct nfp_net_txq *txq; - struct nfp_net_hw *ctrl_hw; struct rte_eth_dev *ctrl_dev; struct nfp_net_nfd3_tx_desc *txds; - ctrl_hw = app_fw_flower->ctrl_hw; - ctrl_dev = ctrl_hw->eth_dev; + ctrl_dev = app_fw_flower->ctrl_ethdev; /* Flower ctrl vNIC only has a single tx queue */ txq = ctrl_dev->data->tx_queues[0]; @@ -232,7 +230,7 @@ nfp_flower_ctrl_vnic_nfdk_xmit(struct nfp_app_fw_flower *app_fw_flower, struct rte_eth_dev *ctrl_dev; struct nfp_net_nfdk_tx_desc *ktxds; - ctrl_dev = app_fw_flower->ctrl_hw->eth_dev; + ctrl_dev = app_fw_flower->ctrl_ethdev; /* Flower ctrl vNIC only has a single tx queue */ txq = ctrl_dev->data->tx_queues[0]; @@ -511,7 +509,7 @@ nfp_flower_ctrl_vnic_process(struct nfp_app_fw_flower *app_fw_flower) struct rte_eth_dev *ctrl_eth_dev; struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; - ctrl_eth_dev = app_fw_flower->ctrl_hw->eth_dev; + ctrl_eth_dev = app_fw_flower->ctrl_ethdev; /* Ctrl vNIC only has a single Rx queue */ rxq = ctrl_eth_dev->data->rx_queues[0]; diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 086cc8079a..8ff13923e5 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -3518,7 +3518,7 @@ nfp_flow_action_rss_add(struct nfp_flower_representor *representor, struct nfp_fl_rss **rss_store) { int ret; - struct nfp_net_hw *pf_hw; + struct rte_eth_dev *eth_dev; struct rte_eth_rss_conf rss_conf; struct nfp_fl_rss *rss_store_tmp; const struct rte_flow_action_rss *rss; @@ -3536,8 +3536,8 @@ nfp_flow_action_rss_add(struct nfp_flower_representor *representor, rss_conf.rss_hf = 0; rss_conf.rss_key = rss_key; - pf_hw = representor->app_fw_flower->pf_hw; - ret = nfp_net_rss_hash_conf_get(pf_hw->eth_dev, &rss_conf); + eth_dev = representor->app_fw_flower->pf_ethdev; + ret = nfp_net_rss_hash_conf_get(eth_dev, &rss_conf); if (ret != 0) { PMD_DRV_LOG(ERR, "Get RSS conf failed."); return ret; @@ -3563,7 +3563,7 @@ nfp_flow_action_rss_add(struct nfp_flower_representor *representor, rss_store_tmp->key_len = rss->key_len; } - ret = nfp_net_rss_hash_update(pf_hw->eth_dev, &rss_conf); + ret = nfp_net_rss_hash_update(eth_dev, &rss_conf); if (ret != 0) { PMD_DRV_LOG(ERR, "Update RSS conf failed."); free(rss_store_tmp); @@ -3580,7 +3580,7 @@ nfp_flow_action_rss_del(struct nfp_flower_representor *representor, struct rte_flow *nfp_flow) { int ret; - struct nfp_net_hw *pf_hw; + struct rte_eth_dev *eth_dev; struct nfp_fl_rss *rss_store; struct rte_eth_rss_conf rss_conf; uint8_t rss_key[NFP_NET_CFG_RSS_KEY_SZ]; @@ -3590,8 +3590,8 @@ nfp_flow_action_rss_del(struct nfp_flower_representor *representor, rss_conf.rss_hf = 0; rss_conf.rss_key = rss_key; - pf_hw = representor->app_fw_flower->pf_hw; - ret = nfp_net_rss_hash_conf_get(pf_hw->eth_dev, &rss_conf); + eth_dev = representor->app_fw_flower->pf_ethdev; + ret = nfp_net_rss_hash_conf_get(eth_dev, &rss_conf); if (ret != 0) { PMD_DRV_LOG(ERR, "Get RSS conf failed."); goto exit; @@ -3612,7 +3612,7 @@ nfp_flow_action_rss_del(struct nfp_flower_representor *representor, rss_conf.rss_key_len = 0; } - ret = nfp_net_rss_hash_update(pf_hw->eth_dev, &rss_conf); + ret = nfp_net_rss_hash_update(eth_dev, &rss_conf); if (ret != 0) PMD_DRV_LOG(ERR, "Update RSS conf failed."); diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 0e19723f57..60f02ad919 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -270,7 +270,6 @@ nfp_flower_repr_tx_burst(void *tx_queue, uint16_t sent; void *pf_tx_queue; struct nfp_net_txq *txq; - struct nfp_net_hw *pf_hw; struct rte_eth_dev *dev; struct rte_eth_dev *repr_dev; struct nfp_flower_representor *repr; @@ -290,8 +289,7 @@ nfp_flower_repr_tx_burst(void *tx_queue, tx_pkts[i], repr->port_id); /* This points to the PF vNIC that owns this representor */ - pf_hw = txq->hw; - dev = pf_hw->eth_dev; + dev = repr->app_fw_flower->pf_ethdev; /* Only using Tx queue 0 for now. */ pf_tx_queue = dev->data->tx_queues[0]; @@ -306,10 +304,9 @@ nfp_flower_repr_tx_burst(void *tx_queue, } static void -nfp_flower_repr_free_queue(struct nfp_flower_representor *repr) +nfp_flower_repr_free_queue(struct rte_eth_dev *eth_dev) { uint16_t i; - struct rte_eth_dev *eth_dev = repr->eth_dev; for (i = 0; i < eth_dev->data->nb_tx_queues; i++) rte_free(eth_dev->data->tx_queues[i]); @@ -319,10 +316,8 @@ nfp_flower_repr_free_queue(struct nfp_flower_representor *repr) } static void -nfp_flower_pf_repr_close_queue(struct nfp_flower_representor *repr) +nfp_flower_pf_repr_close_queue(struct rte_eth_dev *eth_dev) { - struct rte_eth_dev *eth_dev = repr->eth_dev; - /* * We assume that the DPDK application is stopping all the * threads/queues before calling the device close function. @@ -335,17 +330,18 @@ nfp_flower_pf_repr_close_queue(struct nfp_flower_representor *repr) } static void -nfp_flower_repr_close_queue(struct nfp_flower_representor *repr) +nfp_flower_repr_close_queue(struct rte_eth_dev *eth_dev, + enum nfp_repr_type repr_type) { - switch (repr->repr_type) { + switch (repr_type) { case NFP_REPR_TYPE_PHYS_PORT: - nfp_flower_repr_free_queue(repr); + nfp_flower_repr_free_queue(eth_dev); break; case NFP_REPR_TYPE_PF: - nfp_flower_pf_repr_close_queue(repr); + nfp_flower_pf_repr_close_queue(eth_dev); break; case NFP_REPR_TYPE_VF: - nfp_flower_repr_free_queue(repr); + nfp_flower_repr_free_queue(eth_dev); break; default: PMD_DRV_LOG(ERR, "Unsupported repr port type."); @@ -384,18 +380,18 @@ nfp_flower_pf_repr_uninit(struct rte_eth_dev *eth_dev) } static void -nfp_flower_repr_free(struct nfp_flower_representor *repr, +nfp_flower_repr_free(struct rte_eth_dev *eth_dev, enum nfp_repr_type repr_type) { switch (repr_type) { case NFP_REPR_TYPE_PHYS_PORT: - nfp_flower_repr_uninit(repr->eth_dev); + nfp_flower_repr_uninit(eth_dev); break; case NFP_REPR_TYPE_PF: - nfp_flower_pf_repr_uninit(repr->eth_dev); + nfp_flower_pf_repr_uninit(eth_dev); break; case NFP_REPR_TYPE_VF: - nfp_flower_repr_uninit(repr->eth_dev); + nfp_flower_repr_uninit(eth_dev); break; default: PMD_DRV_LOG(ERR, "Unsupported repr port type."); @@ -425,9 +421,8 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev) if (pf_dev->app_fw_id != NFP_APP_FW_FLOWER_NIC) return -EINVAL; - nfp_flower_repr_close_queue(repr); - - nfp_flower_repr_free(repr, repr->repr_type); + nfp_flower_repr_close_queue(dev, repr->repr_type); + nfp_flower_repr_free(dev, repr->repr_type); for (i = 0; i < MAX_FLOWER_VFS; i++) { if (app_fw_flower->vf_reprs[i] != NULL) @@ -575,8 +570,7 @@ nfp_flower_pf_repr_init(struct rte_eth_dev *eth_dev, rte_ether_addr_copy(&init_repr_data->mac_addr, eth_dev->data->mac_addrs); repr->app_fw_flower->pf_repr = repr; - repr->app_fw_flower->pf_hw->eth_dev = eth_dev; - repr->eth_dev = eth_dev; + repr->app_fw_flower->pf_ethdev = eth_dev; return 0; } @@ -668,8 +662,6 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev, app_fw_flower->vf_reprs[index] = repr; } - repr->eth_dev = eth_dev; - return 0; mac_cleanup: @@ -684,28 +676,38 @@ static void nfp_flower_repr_free_all(struct nfp_app_fw_flower *app_fw_flower) { uint32_t i; + struct rte_eth_dev *eth_dev; struct nfp_flower_representor *repr; for (i = 0; i < MAX_FLOWER_VFS; i++) { repr = app_fw_flower->vf_reprs[i]; if (repr != NULL) { - nfp_flower_repr_free(repr, NFP_REPR_TYPE_VF); - app_fw_flower->vf_reprs[i] = NULL; + eth_dev = rte_eth_dev_get_by_name(repr->name); + if (eth_dev != NULL) { + nfp_flower_repr_free(eth_dev, NFP_REPR_TYPE_VF); + app_fw_flower->vf_reprs[i] = NULL; + } } } for (i = 0; i < NFP_MAX_PHYPORTS; i++) { repr = app_fw_flower->phy_reprs[i]; if (repr != NULL) { - nfp_flower_repr_free(repr, NFP_REPR_TYPE_PHYS_PORT); - app_fw_flower->phy_reprs[i] = NULL; + eth_dev = rte_eth_dev_get_by_name(repr->name); + if (eth_dev != NULL) { + nfp_flower_repr_free(eth_dev, NFP_REPR_TYPE_PHYS_PORT); + app_fw_flower->phy_reprs[i] = NULL; + } } } repr = app_fw_flower->pf_repr; if (repr != NULL) { - nfp_flower_repr_free(repr, NFP_REPR_TYPE_PF); - app_fw_flower->pf_repr = NULL; + eth_dev = rte_eth_dev_get_by_name(repr->name); + if (eth_dev != NULL) { + nfp_flower_repr_free(eth_dev, NFP_REPR_TYPE_PF); + app_fw_flower->pf_repr = NULL; + } } } @@ -719,7 +721,7 @@ nfp_flower_repr_priv_init(struct nfp_app_fw_flower *app_fw_flower, repr = app_fw_flower->pf_repr; if (repr != NULL) { - eth_dev = repr->eth_dev; + eth_dev = rte_eth_dev_get_by_name(repr->name); if (eth_dev != NULL) eth_dev->process_private = hw_priv; } @@ -727,7 +729,7 @@ nfp_flower_repr_priv_init(struct nfp_app_fw_flower *app_fw_flower, for (i = 0; i < NFP_MAX_PHYPORTS; i++) { repr = app_fw_flower->phy_reprs[i]; if (repr != NULL) { - eth_dev = repr->eth_dev; + eth_dev = rte_eth_dev_get_by_name(repr->name); if (eth_dev != NULL) eth_dev->process_private = hw_priv; } @@ -736,7 +738,7 @@ nfp_flower_repr_priv_init(struct nfp_app_fw_flower *app_fw_flower, for (i = 0; i < MAX_FLOWER_VFS; i++) { repr = app_fw_flower->vf_reprs[i]; if (repr != NULL) { - eth_dev = repr->eth_dev; + eth_dev = rte_eth_dev_get_by_name(repr->name); if (eth_dev != NULL) eth_dev->process_private = hw_priv; } @@ -750,7 +752,6 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, int i; int ret; const char *pci_name; - struct rte_eth_dev *eth_dev; struct rte_pci_device *pci_dev; struct nfp_eth_table *nfp_eth_table; struct nfp_eth_table_port *eth_port; @@ -760,7 +761,6 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, }; nfp_eth_table = hw_priv->pf_dev->nfp_eth_table; - eth_dev = app_fw_flower->ctrl_hw->eth_dev; /* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */ ret = nfp_flower_cmsg_mac_repr(app_fw_flower, nfp_eth_table); @@ -783,7 +783,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, "%s_repr_pf", pci_name); /* Create a eth_dev for this representor */ - ret = rte_eth_dev_create(eth_dev->device, flower_repr.name, + ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, sizeof(struct nfp_flower_representor), NULL, NULL, nfp_flower_pf_repr_init, &flower_repr); if (ret != 0) { @@ -808,7 +808,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, * Create a eth_dev for this representor. * This will also allocate private memory for the device. */ - ret = rte_eth_dev_create(eth_dev->device, flower_repr.name, + ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, sizeof(struct nfp_flower_representor), NULL, NULL, nfp_flower_repr_init, &flower_repr); if (ret != 0) { @@ -837,7 +837,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, "%s_repr_vf%d", pci_name, i); /* This will also allocate private memory for the device */ - ret = rte_eth_dev_create(eth_dev->device, flower_repr.name, + ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, sizeof(struct nfp_flower_representor), NULL, NULL, nfp_flower_repr_init, &flower_repr); if (ret != 0) { diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h index 41965f6e0e..d539e53b23 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.h +++ b/drivers/net/nfp/flower/nfp_flower_representor.h @@ -20,7 +20,6 @@ struct nfp_flower_representor { struct rte_ring *ring; struct rte_eth_link link; struct rte_eth_stats repr_stats; - struct rte_eth_dev *eth_dev; }; int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index 258b617eb2..d450c9472e 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -100,15 +100,14 @@ nfp_devargs_parse(struct nfp_devargs *nfp_devargs_param, static void nfp_net_pf_read_mac(struct nfp_app_fw_nic *app_fw_nic, - uint16_t port) + uint16_t port, + struct nfp_net_hw_priv *hw_priv) { struct nfp_net_hw *hw; - struct nfp_net_hw_priv *hw_priv; struct nfp_eth_table *nfp_eth_table; /* Grab a pointer to the correct physical port */ hw = app_fw_nic->ports[port]; - hw_priv = hw->eth_dev->process_private; nfp_eth_table = hw_priv->pf_dev->nfp_eth_table; @@ -582,17 +581,14 @@ nfp_net_uninit(struct rte_eth_dev *eth_dev) static void nfp_cleanup_port_app_fw_nic(struct nfp_pf_dev *pf_dev, - uint8_t id) + uint8_t id, + struct rte_eth_dev *eth_dev) { - struct rte_eth_dev *eth_dev; struct nfp_app_fw_nic *app_fw_nic; app_fw_nic = pf_dev->app_fw_priv; if (app_fw_nic->ports[id] != NULL) { - eth_dev = app_fw_nic->ports[id]->eth_dev; - if (eth_dev != NULL) - nfp_net_uninit(eth_dev); - + nfp_net_uninit(eth_dev); app_fw_nic->ports[id] = NULL; } } @@ -691,7 +687,7 @@ nfp_net_close(struct rte_eth_dev *dev) if (pf_dev->app_fw_id != NFP_APP_FW_CORE_NIC) return -EINVAL; - nfp_cleanup_port_app_fw_nic(pf_dev, hw->idx); + nfp_cleanup_port_app_fw_nic(pf_dev, hw->idx, dev); for (i = 0; i < app_fw_nic->total_phyports; i++) { id = nfp_function_id_get(pf_dev, i); @@ -971,7 +967,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) net_hw->tx_bar = pf_dev->qc_bar + tx_base * NFP_QCP_QUEUE_ADDR_SZ; net_hw->rx_bar = pf_dev->qc_bar + rx_base * NFP_QCP_QUEUE_ADDR_SZ; - eth_dev->data->dev_private = net_hw; PMD_INIT_LOG(DEBUG, "ctrl_bar: %p, tx_bar: %p, rx_bar: %p", hw->ctrl_bar, net_hw->tx_bar, net_hw->rx_bar); @@ -1002,7 +997,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) goto xstats_free; } - nfp_net_pf_read_mac(app_fw_nic, port); + nfp_net_pf_read_mac(app_fw_nic, port, hw_priv); nfp_write_mac(hw, &hw->mac_addr.addr_bytes[0]); if (rte_is_valid_assigned_ether_addr(&hw->mac_addr) == 0) { @@ -1580,7 +1575,6 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) /* Add this device to the PF's array of physical ports */ app_fw_nic->ports[id] = hw; - hw->eth_dev = eth_dev; hw->idx = id; hw->nfp_idx = nfp_eth_table->ports[id].index; @@ -1605,12 +1599,18 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv) port_cleanup: for (i = 0; i < app_fw_nic->total_phyports; i++) { - id = nfp_function_id_get(pf_dev, i); - hw = app_fw_nic->ports[id]; + struct rte_eth_dev *eth_dev; - if (hw != NULL && hw->eth_dev != NULL) { - nfp_net_uninit(hw->eth_dev); - rte_eth_dev_release_port(hw->eth_dev); + if (pf_dev->multi_pf.enabled) + snprintf(port_name, sizeof(port_name), "%s", + pf_dev->pci_dev->device.name); + else + snprintf(port_name, sizeof(port_name), "%s_port%u", + pf_dev->pci_dev->device.name, i); + eth_dev = rte_eth_dev_get_by_name(port_name); + if (eth_dev != NULL) { + nfp_net_uninit(eth_dev); + rte_eth_dev_release_port(eth_dev); } } nfp_cpp_area_release_free(pf_dev->ctrl_area); diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 40f314af0a..a4eaed6433 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -167,9 +167,6 @@ struct nfp_net_hw { /** The parent class */ struct nfp_hw super; - /** Backpointer to the eth_dev of this port */ - struct rte_eth_dev *eth_dev; - /** TX pointer ring write back memzone */ const struct rte_memzone *txrwb_mz; -- 2.39.1