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 0C83445C22; Fri, 1 Nov 2024 03:57:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC22C40265; Fri, 1 Nov 2024 03:57:39 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2096.outbound.protection.outlook.com [40.107.236.96]) by mails.dpdk.org (Postfix) with ESMTP id BF09640265 for ; Fri, 1 Nov 2024 03:57:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GHAPVNYFf9j1LGfNIFig4mOCqHcfqrzVbm8GaCYimcz1RcjzwArHkd6MWwWicVlgMwQfVeJEd29LXKtdluN65AkuE59Deo95OQ13RZdXADtstyQKG4+tow4vGObfk+hqT/nFB64ApA5ebMEDMhnYvkVmTME7eHAo49f7IDFRVX5F9WEzcltQqVovPBktKAgSKNmTVn8eNnQMqqahr7xCdyRxbFuARpkhHX2x8EVtNYzNSCpjiCpQ8ZX8DMnLCKYCLOPOE0xohrtQTXLjo+pxgTvqSquAWi3pYa8jx3MTkuCkoCaaiIzfJapEHhstIrzcMhHvILPdItvjOG49JRT92g== 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=G3soE1Zf0c6p+wK4avafrCc3lTkcU4u27XNmrPUl238=; b=d3dnuLWYcbKFvEARe0cJ9xIWyGwsftbAXcBgkicuu7sDzkt0eKw+KAPeDRR6tkR5fVzOZ52uAc59wlPRFS5PdhRXkmYA4jSOnaLkpI9TzeyC0gO9b7CoNmoM3sHkdpaRrErUWgHFsjpPIz+MNJJCVCua2m6LkU5JoK3seo0wntZON1GB2xB25RtsvtmeQNmFAbinngu/LIIHdpD4fkA5XCSYVUZRcOO7bKPLucb6Cm+9msXTKXYuHofCmF9PfsCw9oarAr5DP1DvWibAZW1SjttMamaXndk6nn6tNlQD19DF8c6b95kyygqLuL31kYmw6RxbUTtqc2Cr/hecXUmxog== 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=G3soE1Zf0c6p+wK4avafrCc3lTkcU4u27XNmrPUl238=; b=d9wSGtJHj8uW+4fMzPOJnhMKv7njady8MyczcaHdbrS5+1mdQOYt3R4d8U8ixspzNvwscfI1mYtg8TkFbLgtRJNFygRAJY8j+RLGsj2VSJZ/y3Ma4tmOIu9quUl2NtLa5+UK+WMOCu+PIsvhqmusPTNzJcWI+SBS87WjgvjcxhE= 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 PH0PR13MB4891.namprd13.prod.outlook.com (2603:10b6:510:96::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Fri, 1 Nov 2024 02:57:34 +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; Fri, 1 Nov 2024 02:57:34 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH v3 2/4] net/nfp: extract function to check physical reprsentor Date: Fri, 1 Nov 2024 10:57:11 +0800 Message-ID: <20241101025713.290462-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241101025713.290462-1-chaoyong.he@corigine.com> References: <20241030082759.209617-1-chaoyong.he@corigine.com> <20241101025713.290462-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TP0P295CA0031.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:4::12) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB4891:EE_ X-MS-Office365-Filtering-Correlation-Id: 93df8849-6231-444c-8c4a-08dcfa20ef8c 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?Q0EAiGEpyLgyLujirOVwi/zl86/JHJ37Vv/yedG88TBq8RBUEVV4b6M1C5sP?= =?us-ascii?Q?AXc62QQmJAFFhqDQZsJZRMmrr4yuOgAKbG9CCATu0M0YRhxMsfyaf5dlUXB4?= =?us-ascii?Q?N2sQWCHzxc9g3JAB1yNZaf9uIE3H05og9aj3d+QmX0He8LECRjP+3g6H2D1p?= =?us-ascii?Q?DV9cQg3vQM0zYacIVOe3XcrP9yUX8TmTnkJitVJT9FYii+DlhU/Z9uZsCFEp?= =?us-ascii?Q?HkNuH3D7X8nLjNhOzmITs9PfBEDoaXKXC3OFbnANXGUaO4DFAHLeJ67bSGGi?= =?us-ascii?Q?9h+awvdO/F8pF8+y22iOwTend+ufzOTkrVpJMQwLPUbAmdpNbNkMfWbS4EtF?= =?us-ascii?Q?5IOEwfFLoK1pc+mwfCxONjGoKQn9sRCJoMX3pM/iD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TXEzIAZFqP7j5DsHlwOrisJlauSSJmv2BCS/fS?= =?us-ascii?Q?u8y9Vl+XQg0YSfQmY29jYytMcLuHz2vD7EMptfc7HyG6glz0Zk77KoSayBce?= =?us-ascii?Q?zU628yA=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?i3osAHTVAmRuaM8BZyRF7bwl6ZY0RqU8/JerHyp/MFU+o/Vavd/YSZroiGdc?= =?us-ascii?Q?dkmV0Xt5ipCeLutbU3zTd6FNNh9XO1QyAjG9rT6uIJ+aSOtrqH5HzfXpl+gq?= =?us-ascii?Q?qB3+LygwvO7pAxDLvBj/Cxn9APuKariDtNrciJMNYLa93iOGM1vug9aQMl0O?= =?us-ascii?Q?ODleBMbmB2q2uIJOlvp/NkAwbZq1VEaXO0KSAxwOpVpQK91YwuGkRJOChmo2?= =?us-ascii?Q?1dnDPfV7WwlvzhJdngK6np4Pss3Orrm3o/8XYTW7sG54hbK0ONcI5GTxGVai?= =?us-ascii?Q?ybiUmPwSv79l+C1rLmDRHL3nYbZnfIUMLBo4J/ogdAe1mONCbPF7CG7K8Gpi?= =?us-ascii?Q?s/OpTyMznqjo9sQLbc9epvpIOA0YpCVBdgeHRZTF72w2ND7wanfJvEZ37O36?= =?us-ascii?Q?AGSaFwkzxxS0KmLAr7eCzwIMryHoymmyqATi64qpfsxOPnzUDMblGgZUKWud?= =?us-ascii?Q?s7ESoTXo/uxoDei7flLx74uhHnAwodokLtjFwFsPxBz143rYXh9YvDr8ymQg?= =?us-ascii?Q?DRZzgozGpacMLji2cCvAJHER46Z/3q1oq5XxpU3KndGa+UoFuC+luLct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liVJcUmlG39+txPlJ8kfbSLx6L?= =?us-ascii?Q?JUvm0wR44M+HukLPdlNvqrWs3BncDfimsj327gnU4DFcaghFXuFKtixqZGy5?= =?us-ascii?Q?AhobKA4hv1BN1PJ7SC6zykdhB5ht3r3jS20SLPTUQiB3JOunStsFKccL8vQh?= =?us-ascii?Q?Dg=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93df8849-6231-444c-8c4a-08dcfa20ef8c X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2024 02:57:34.6594 (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: JI+UoaCTagFK7AKDvT+6AndBIf7KscD5c2NGtt9ky1i89rsyjm8h4D7sp4ZpcmHaJFwcEwIg3znlXZ8nZYjNF5WruRMWLPmP0GRWnNal3KI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB4891 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 56690ec42b..5a45c44867 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