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 E5F9D45C11; Wed, 30 Oct 2024 09:19:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D45904025C; Wed, 30 Oct 2024 09:19:42 +0100 (CET) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2138.outbound.protection.outlook.com [40.107.96.138]) by mails.dpdk.org (Postfix) with ESMTP id 9F4D643330 for ; Wed, 30 Oct 2024 09:19:40 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=i8j56TI6pI6qmf5t+8GjMb+bY4eAh73jTafUXtq+hIc8ov82TluZ1j3kQx5WXNs2LlbpiOmn8fjJHpYYW3OS7rmZS0amLEzbAoCLbv9TJ66/eEKzGqE2eJWFzzO59q7LS9xr1YTcEm2kXr37ONyiwPW1/DJQ9/HteURrz7tx4nZW01u7iSMiP6kppyZotLr0ML+KPObuF/Gfse80+3FhsVbeYv9Tibxi4riQuqMb+vC1FM9RhZN+7bv5+lx6JGWuJD3F5XOm3K+CzPmX+Wz+uMzrhFI6aq9BjeaOdvi5fBOVzm9MPZBes5dWpXXCXse6y1+NRFDdeAdZMhnxJiTMdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=c3aJsJtfL1bQeh8N4op5huKWuz0PwFflV0CuME812as=; b=wC3ClFpy/M/nj5fG0sAXqYd4CNF7GDPCzmbtpD+HiZvGk8agmvOt751YT1RUr9EpoTRorlS5bbYwQOntFLuXx/Fh+eXoec0zIpshB2w+ddjZxReMg38zUsTneMr/JPmmVHp8BszwEOdTVXB2aG3Q7YC5TbsKRngmyVg4DqE0DNZMt0TBXizdAXcsMCJSuIFpC3hFuL7/pT6fXep+a85hvPBhSE0rjfU1N3dZb1QLTaFZIYqIihiFtapNdA2qoSyaGL9KSascZ7L+zaLo64t3i9crNnIJOuCz+ZF5koukfxHylgPK9yfxL0jRtl+s7xuDLMkmOHG/rueK3hwzqt3isg== 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=c3aJsJtfL1bQeh8N4op5huKWuz0PwFflV0CuME812as=; b=INsuBdgPevX/YLfY5IZ4klFJOku8iiaHkpSvBSSvbFlgFKH0o3wJCtBN3lNLrbfKOSwajkLz+3uEujpvZJQIB2cCzgB5EnqdCDKY7MN89jbJaVS2hevRQRGat4yYxx11n3mdQj2lf+4f5VURPZz88x+x8l884gi6etLN1wK0Em0= 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 MN2PR13MB3973.namprd13.prod.outlook.com (2603:10b6:208:267::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct 2024 08:19:33 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8093.027; Wed, 30 Oct 2024 08:19:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH 1/3] net/nfp: extract function to check physical reprsentor Date: Wed, 30 Oct 2024 16:19:08 +0800 Message-ID: <20241030081910.209308-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241030081910.209308-1-chaoyong.he@corigine.com> References: <20241030081910.209308-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR04CA0003.apcprd04.prod.outlook.com (2603:1096:4:197::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|MN2PR13MB3973:EE_ X-MS-Office365-Filtering-Correlation-Id: 82a932c9-e378-4755-3e3a-08dcf8bb95ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7LG9UbUHF2q8rFHNYRlAFdh7ZCcKITPMnBhjP1kFucIuYRSRQnf5Mt1WLh9k?= =?us-ascii?Q?o9lt0ju2vJmiUleWi2PSO06pIFcy3LVQl49FvKsGRppQOXau2ICEl0zb/xe2?= =?us-ascii?Q?0ADMSrZWzsJM+i70Y2HxwjXme6z/Ty5d4ijFMkEYybjddNRI7yaq1nsesVYH?= =?us-ascii?Q?yl0BJM+xyFmeftOn8pn99UQdT44ya1R53Gepqb2wPW/UX04Cil8gZxPCEbFA?= =?us-ascii?Q?Z1Wuxm5Te8Tw4SoFBCBEAMwz+cGnwRqnfgyGUHlswb1HPZfY2QcIIa1u94AC?= =?us-ascii?Q?x8mGEJmdNlcRQ75OaVSPuAqbAKXs/Ms3fQKGPKFBTSPqDRoOgGHwHOfMC4Yx?= =?us-ascii?Q?hMQjDry6x+SxRmZcstHT3GS9/76Z5Va2shYuERW8DBPYoJxibCIqDWYq2S04?= =?us-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UzLT334sdni7V/KC?= =?us-ascii?Q?HCz9f5U2WoPZNb/3sEY15IhjYjV47jFIZcjEzWLBrF7vuMsGKJAyXthmAlzV?= =?us-ascii?Q?QmYa9BM=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:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ex8ul9rU2faDvoiLEgMtMYBCCPRaZ/gQh3hKs1jL8W2LYYAW1Poe8EN03Efb?= =?us-ascii?Q?4MxduW9qeYM1sm3vmkZexfROy8nOfvEeZDC3dqtOrHKGiynZonAysmOqnVsD?= =?us-ascii?Q?8HW1IAILt8UxQn/O+M24ktQXgimBeBqTA6MJ5ujlKnJGkhvSSZ5zJ9TyVi5I?= =?us-ascii?Q?1W29mn2pTp/+2B+T3x3ZAo/6P3lJwJikl65HrJ25E1wgITQEaCSg4ZaCMy+l?= =?us-ascii?Q?MJZc0W06tEA5Y2VqKjhQfwMOOgzJen856TiierNcOmCl6Brw3+vTKoI7Z21t?= =?us-ascii?Q?mZc8CwV2PEZ4q7HuwTEetIBtKIkip4UTEb0PAscEC/f73XAv6tnydqSDce7G?= =?us-ascii?Q?z+2p/jR0SFTl+CbRXGVmKnDF9yG6o8mz0x/QFziykRRR6dU4mwRjRIenqm+i?= =?us-ascii?Q?AqFJOOG8DM592Wnlqmy3ydOHwmDsmmXBEAyUz92f5mFfGEIRxx3bLHgAQ1ni?= =?us-ascii?Q?LD7lt3UdvP8MmSqLqh2vq/QOjXv0RuVULugvQ6blZO/pxVkgwZrH+EVgE4jC?= =?us-ascii?Q?58an3WG16QStaJtDCy/3/YzbRBgO0/wNXYWKNlOBNrT7FNjHXU6JUjEoP0Am?= =?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il0f6sJhywfBTxmleUg4KFQ3yL0+8BQcR5o?= =?us-ascii?Q?7ESaZbKyTRym6kIy8y4BsRovy07oBvO3bz5i/n6Hbm/Oq/aARAK79wkIaVG/?= =?us-ascii?Q?Zfopq0Yn9kMUSBCf/SSn8ksTVQn7rLGC8eWWppUpvvPxo2dS/Unzm2V361k+?= =?us-ascii?Q?Kw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82a932c9-e378-4755-3e3a-08dcf8bb95ce X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 08:19:33.8267 (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: QeiRXsxZlvFs7F53qTfjuZO1NT2VRr2P63nZsTDpxgxSYfYOuUOdQ+kYlZc50foO647L5AP2N8/lEoflUy3IWmlz5+K9Gb0pzhfxsMjo6SY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR13MB3973 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 Extract a helper function to check the physical representor port. Signed-off-by: Chaoyong He --- .../net/nfp/flower/nfp_flower_representor.c | 18 ++++++++++++------ .../net/nfp/flower/nfp_flower_representor.h | 1 + 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 7c55f0ed21..8efef482b5 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -96,7 +96,7 @@ nfp_flower_repr_dev_start(struct rte_eth_dev *dev) hw_priv = dev->process_private; app_fw_flower = repr->app_fw_flower; - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + if (nfp_flower_repr_is_phy(repr)) { ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 1); if (ret < 0) return ret; @@ -127,7 +127,7 @@ nfp_flower_repr_dev_stop(struct rte_eth_dev *dev) nfp_flower_cmsg_port_mod(app_fw_flower, repr->port_id, false); - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + if (nfp_flower_repr_is_phy(repr)) { ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 0); if (ret == 1) ret = 0; @@ -411,7 +411,7 @@ nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev) nfp_flower_repr_base_uninit(repr); rte_free(repr->ring); - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + if (nfp_flower_repr_is_phy(repr)) { index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id); repr->app_fw_flower->phy_reprs[index] = NULL; } else { @@ -768,14 +768,14 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev, goto ring_cleanup; } - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) + if (nfp_flower_repr_is_phy(repr)) eth_dev->data->representor_id = repr->vf_id; else eth_dev->data->representor_id = repr->vf_id + app_fw_flower->num_phyport_reprs + 1; /* Add repr to correct array */ - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + if (nfp_flower_repr_is_phy(repr)) { index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id); app_fw_flower->phy_reprs[index] = repr; } else { @@ -783,7 +783,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev, app_fw_flower->vf_reprs[index] = repr; } - if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { + if (nfp_flower_repr_is_phy(repr)) { repr->mac_stats = hw_priv->pf_dev->mac_stats_bar + (repr->nfp_idx * NFP_MAC_STATS_SIZE); } @@ -1183,3 +1183,9 @@ nfp_flower_repr_is_vf(struct nfp_flower_representor *repr) { return repr->repr_type == NFP_REPR_TYPE_VF; } + +bool +nfp_flower_repr_is_phy(struct nfp_flower_representor *repr) +{ + return repr->repr_type == NFP_REPR_TYPE_PHYS_PORT; +} diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h index 4211ddf798..3f6ee32fe4 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.h +++ b/drivers/net/nfp/flower/nfp_flower_representor.h @@ -30,6 +30,7 @@ struct nfp_flower_representor { int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, struct nfp_net_hw_priv *hw_priv); bool nfp_flower_repr_is_vf(struct nfp_flower_representor *repr); +bool nfp_flower_repr_is_phy(struct nfp_flower_representor *repr); int nfp_flower_repr_stats_reset(struct rte_eth_dev *ethdev); #endif /* __NFP_FLOWER_REPRESENTOR_H__ */ -- 2.43.5