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 5A64F45C2A; Mon, 4 Nov 2024 02:35:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 064A84068A; Mon, 4 Nov 2024 02:35:24 +0100 (CET) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2124.outbound.protection.outlook.com [40.107.101.124]) by mails.dpdk.org (Postfix) with ESMTP id 3F3054065B for ; Mon, 4 Nov 2024 02:35:21 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uEY4LRS9zf2HTJDv7tRspYTAZLBak+RTbbN/O6cTfzYYDTxCrngJEBosXUXy3R9JWnd2WGXZ0Hd5X5Tub1IKlB2qvTEnq0CJvUs3FHE0V3cV0+wJs9bO9QaOFDchbImqaD99sUsS5aABRW2tKBQa7Pgiz2r9pq9AXF8N0sBMMQ6I7BRJqFGDoklEJB48v0Exbph9Nf4IBw+X1CpaazEdsjPKv2VM/8wLV5/XDcn6hPr7wnq4fWqcYFfPFiTfe+GDCaAO9elJlTCnauKEjICKouScWpPK7nJAjpOIukZnwZUSGGOlnYhiUYW/XvDaSrLawOqw8M1KPmigMaIS8P2RKg== 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=bdtICzam0mUbdBAAmQWXNBBe1bh38eVdMOKlNyNXKvvGtNZpqkDuXWXIrzaek8gRBnTT5z6X0j+m5bia/ptsstYpDom/usi8FHuh6xh5BZe+cpWpEiOpbsXao+X5JFexr1Iys5WF+xNcSn2mbSrPq8Wcr88BX6TSpG3k9JP1AfUwZCOGMIrSqyS/FkLwd0icXwXaJcxOxwy6H+rBkvzqcWUn7xf5PWIEBbrYwiF6/p0iyK8V9r66MUMaA7+W7/A/6iMAY9B0/di/1eUzBIcyKWh4RVSbBFuqshzvrGE8yBa0vsO3jjRXyDazf7tq6qk6/3L6KUxU26foSNm3+cSEtw== 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=H7Xq/g8MrZt6b/E3POoAZcielnrSbEHjoiYhejWjGoXW6hIt0/NJ9YyWWivXE/MSGiuSaYu5OGAI1KNxQSi0pw6bBE07gwoNsz8jC4JFOeDk+IGJh+xF7f3EpBlHpdMNrDUWLurXpoa7+0nMtUxZtxItxelRFjCkUpfGdpfz2dU= 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 SN7PR13MB6158.namprd13.prod.outlook.com (2603:10b6:806:323::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.30; Mon, 4 Nov 2024 01:35:19 +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.8114.028; Mon, 4 Nov 2024 01:35:19 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He Subject: [PATCH v4 2/4] net/nfp: extract function to check physical reprsentor Date: Mon, 4 Nov 2024 09:34:40 +0800 Message-ID: <20241104013442.308780-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241104013442.308780-1-chaoyong.he@corigine.com> References: <20241101025713.290462-1-chaoyong.he@corigine.com> <20241104013442.308780-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0009.apcprd06.prod.outlook.com (2603:1096:4:186::17) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|SN7PR13MB6158:EE_ X-MS-Office365-Filtering-Correlation-Id: 33cbd43d-6a40-4cf3-2483-08dcfc70f12b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3vdnslwydAYqxEjmYDJ46lhMKO6Y95yGZvGJDhcD/EZUbEBBDTc8dG8Wc87C?= =?us-ascii?Q?wpS1cHQm12g6dX0seec/yFzJmWWBXMD70hUvdnFgqCpJRDCdsG9yZHtB1zOV?= =?us-ascii?Q?RxLS3QL+q5No20lC87b4BgPN4nBURsItRetJ+0x8HEfSXVVes6wKhxYnWZ1E?= =?us-ascii?Q?4/eRbuT2ydVvDzKZpQ/DGDFle/szM8mq6kXLga8B/Ntvw8LF0hGqL9wTKbtq?= =?us-ascii?Q?a6E/P1hLb2P8cSy/xXbOM04VPbTwbZzJ4R+OGMQuZRfKGrupbv+CqiXsqGsH?= =?us-ascii?Q?iu+MlWCTSBNKu+EmKTtmDBxHU4vrRzGVthfpgEbiUi2EFNHZuxqpVXZCLBK6?= =?us-ascii?Q?E/6g1XtHDlM2Z1bnW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DJd9NWeFmvY77?= =?us-ascii?Q?8unNGs6rKfMLffb0j3tBx0wXHDONOdKAfia+N+GZeioXL4XymMcFuPX70V2D?= =?us-ascii?Q?zRe/KjVLlYnXNg8/CrytITyRxwaL3fFeSd2UODq9KpBcsnsy03dSBuJsEXN1?= =?us-ascii?Q?bBRlx98=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)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?y0Y4WALL9zerpY/tewCJ/fnua5GM2VwM+tjoj+MYtmtwyRqgQjyTKY7jckTt?= =?us-ascii?Q?nACQmYxD4JDleqp5pBJJRrt1OCkd5OjpsiXX2rHOswshwxZOBGOD63F4CE6N?= =?us-ascii?Q?YrosyH2pFH9hoc0IFVSxzVwNLkrTkM2Szgwxfjy7rd7cXnyjfxZeEI9Zaclp?= =?us-ascii?Q?cvHvotNhPex+HtYvS6888dg8NjvlxsUB09OefYQuqEcy6m6cRtllTo6ndTZX?= =?us-ascii?Q?EeBMt3nS/79YCwhcL52l5/SY9F2/Ql88wY5KJ6V4nPMvVE118r7pGT1qS8qI?= =?us-ascii?Q?HEINJ7AxJhc1ZRegaeOhPVPnzB0wOXzsOo3jqERuYEAaANnc4KW4Anxp3FA7?= =?us-ascii?Q?Sh8YkkSY27KILsnc4DuwOnU4KEUugMXN6Ypb1O0WyvrCflp0StkputiVrUFu?= =?us-ascii?Q?NQf+EcSve44cq3H7uFalwm9O8E80Ueg0+0e2qyHuAMcXxOEOZN2mUHyhzGHP?= =?us-ascii?Q?4bg5bbvEisBb24zhH8znjs7w1q8EXoGYTGIZsysW/LhEvetf0dCS10K0hBOy?= =?us-ascii?Q?/7X5SwH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POoi?= =?us-ascii?Q?4s7r7hdBPejHeMIJ86BClUc8j2OeRYveaJTM+pxFK096CFRPxOKNlT+4jGlU?= =?us-ascii?Q?DoIrRaMCCEN46F6TK+VO1CxvR43GFNL7oi1q7y2QzUIonEZ56CXSKy8XjgKd?= =?us-ascii?Q?6Zs1YTy7L0i0AJgrHWActwzCGWX2G6oCA/99exG/2n+n5LbXCDOKN8bbQdQ6?= =?us-ascii?Q?iA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33cbd43d-6a40-4cf3-2483-08dcfc70f12b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2024 01:35:19.4154 (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: F9TwHubVuOdorAu+8voHAQ+XTHywi8gXE8BelyG2EYpUQ2rl61Fc/8zi/J8zSpORqGiBR7BA5/xYA8fKH584sGGrSCLcvWCLTi7dnAis0HI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR13MB6158 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