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 B1F3A45C11; Wed, 30 Oct 2024 09:28:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2CEF4336D; Wed, 30 Oct 2024 09:28:31 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2131.outbound.protection.outlook.com [40.107.101.131]) by mails.dpdk.org (Postfix) with ESMTP id A5C3443363 for ; Wed, 30 Oct 2024 09:28:27 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mMc7AlWMlou1nrleTY2erLR0S6wqDfhGwYNLsZuOWuzzxLZeOqD9umaib/IqUdr6HK2KVxs46fozXur6zz2LysWgK5kbGJb3gUIZInjw4iC+HvRzaUxv1TfrWWdmj3jo48dy/UKZLD6l3DM/l0F3hZBLa1cGpWn3wng3kCqQnoQgtqAFnIW4pqdYKUjSDvkXeSl7Jn8N1wEALK475rNRgt1qj0nP3/Leh/M0hP1xAEJCivPLbwe8K21tMRG9Rehf0VuAVKi9EzqMjkOr0m/H5gSuQHgWgKun0f83eWyO7u/5b7/SG8eHPUp7qDNulAToJIzOvv/I77saMwfvoeSI+g== 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=nyFVGl5jN4vpD9P5Cf7KAF/A97IOfTzzzFAdsSQRdi0KhspxYrHJ0nbLkzTwCDGr3ezJpnTLSEAHXBtezThRj3J6XEtLgIY7Ag3HRvHKpB2NLntTSw/yJVsk5z2qVfdWrPbfpL0VZae4LrMhg8gVt7d7yhVe78pdx/TgcC8bhCoV5MDVR8SGh8fGgdoB02o673DmtICxosGiqfqZMCmdASPN5Ny7WLBqsmtMsRYGFyyxqmiiOx6d8JmEKatgNBT71NTwRIl5mBh7DIaK3/PLiYwCFTCX9QrodOICusFPRz6Qs8DoiGRGqQqOrTAxOOkiPyowl6TxD85xqAXb6rL6sQ== 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=hFXi9detgIJyphLOrzb5UV1SX9obXAaV8YFUcZf4f1JXweuWQRzZDmeXxSxXOey4qJYa3tMgZplQpNOksoz02tnmWcqam3n7j3wxNjUE6tgpsGDJ+Sg//8+E0GpbDGR+Cf2KbVJKmBS7I71MUXuSybdN23XiqjJChkzGhYCo6g0= 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 LV8PR13MB6775.namprd13.prod.outlook.com (2603:10b6:408:233::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 08:28:21 +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:28:21 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH 2/4] net/nfp: extract function to check physical reprsentor Date: Wed, 30 Oct 2024 16:27:57 +0800 Message-ID: <20241030082759.209617-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241030082759.209617-1-chaoyong.he@corigine.com> References: <20241030081910.209308-1-chaoyong.he@corigine.com> <20241030082759.209617-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0120.apcprd02.prod.outlook.com (2603:1096:4:92::36) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|LV8PR13MB6775:EE_ X-MS-Office365-Filtering-Correlation-Id: 5be00c9b-ef46-49d0-d7f8-08dcf8bcd068 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+7i4bptpfPisVq62rtXaxBuIe4HkFNGipMwP8Wjqelq2jml3kJ4SdbDsCULi?= =?us-ascii?Q?YG9KH0H4MElBcYZ03Clroqxpoovz8qc/ZpLvaf+OQ9Mj6oWNgeo8OYpB0om3?= =?us-ascii?Q?1c5Grt05fDPwsobyIx/71Sio4EiIArY5jSUv85drr2FawPrqv10pzXdlqWX3?= =?us-ascii?Q?qxVdHiYnf8f/JyR+oJmTzhXJ67pHukanIUrlgr2SuVcxPNpRzV60Sa0zTaRa?= =?us-ascii?Q?i/vUVk912Y/IqO5LobCtI4GE2BZqER/bfKFkwHzv2as6qQ1cAcA9I5kBMscK?= =?us-ascii?Q?3q2N5oJ2aRTxIe68VOgAKWmMQkHS6UGblwTL8LMaB7x+eQoW3VzM/6pyD7Uz?= =?us-ascii?Q?dbMItHzg//nqqTM8LlLrvok7fx5iLa8axDnx4PZp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aNYDv38txsrqzBxkMelRqvlsBWZqMzL8xvD?= =?us-ascii?Q?utajnURL56fu9tX09oMjNeIR/tQMO6kjj1P76aRCA9j9oEARYGmtOMsXPXey?= =?us-ascii?Q?uaUjPLw=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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BpxljXGiKjBF+Y+iOs3c5MvTBF9R+xYBZWWP/ZiL45dOVWIr/je0JrW7KCpe?= =?us-ascii?Q?sRTUZSD3LPmPh5n4mREnzZconv/DDSuvAVNyrEOz3JTIzVSfmn5WvACuRJth?= =?us-ascii?Q?XhmeadkzDqr54om95cdIBrY3lyd7uqd6cIFuzCs2PuIwUT4RUoQ9oF5ILxoq?= =?us-ascii?Q?C0Ng3f1m21qqQtLJ5bUaUO7zGhI8+zhyuanmxaf2nP3xQPlznvahudYOhPjA?= =?us-ascii?Q?Bq/8PwflW9OfP/jqVyFJvuIiq18S0s5g3Ze0dbM45VPeb90LRfWFCmL09fD/?= =?us-ascii?Q?gvw8thoaEAgF0Ih5xk6ttgDBWh2RA8JmIGEIZ8vgnx9cS9urI49rNku18c+v?= =?us-ascii?Q?hRwrv1Boa+c3lof70akJyzYhFagRM0SCrkesTzQFmsSM9YNIQM7fNL0SZPEr?= =?us-ascii?Q?3Hudhn0JVICG6vgkbHb8+lXCHalMlS+n4npdoipdpHnDcw9UVAEADqCbkN+5?= =?us-ascii?Q?YTmBzBfiHzV7O+Xlk+xSGGwpHrlfX8zb3exEFbg5Zb9U49erSEUsB78NVwce?= =?us-ascii?Q?O/oBtvGMelVz/TGXocSG2oZOj57MpZWyiFtH/qrGmWRtVLNbevp5ONSag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4rOz8lEIN+3M2t1t1l1AnTvaAKB0YoJnTMJ7D?= =?us-ascii?Q?XbsUYAvnpUzppS0DGnq9lu+klEA1ooGiGwELGm6vr/qKRLolkMOD+nw2+Xlp?= =?us-ascii?Q?Os2jvomOW0zYiHKBYf2C4JTNsdbnz7R6MrYTbqrowVL/T1a0ZMYsdBTP1JVN?= =?us-ascii?Q?EA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5be00c9b-ef46-49d0-d7f8-08dcf8bcd068 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:28:21.5697 (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: NJdNmCwW9o2RW1rTIcUu9NzbcAnAQwp3rJcxAzax1ccCe8SI1WfGpSECy6ErBJqXHR4mZ7dKkOwb4rvIC/Ztn/Y3NvrGXoG7UAPf2TgfXUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR13MB6775 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