From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 49B5843BDB;
	Mon, 26 Feb 2024 02:45:31 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 148BF42D7D;
	Mon, 26 Feb 2024 02:45:27 +0100 (CET)
Received: from NAM04-MW2-obe.outbound.protection.outlook.com
 (mail-mw2nam04on2090.outbound.protection.outlook.com [40.107.101.90])
 by mails.dpdk.org (Postfix) with ESMTP id C0BB8402B2
 for <dev@dpdk.org>; Mon, 26 Feb 2024 02:45:24 +0100 (CET)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=caWUgt4b7Hgtu/On5Q5sJ/KeeykDJTVhwna02IUvGD51dsfjJuknxvkYx200kCiOC4uoslCW6kzAXRG+yxc7zOLveWpBVVIXqyyqLLJCuNb8XMRJCWPEvq7vlU59UcSamGQq9VQpm6uZ4TEb0hK5bfuWcKxvpgEbgKicUxd2VF9ADaiW3flifOp3IvHxTyXdBS7TM1Mq54lFmwnNobxiU67UN0jplKBKTAGFBLXl7EhbvdwEG6Rg6HUmk1zz+D9M0IjzGDVKoiH0ECm8FEbuHsnndeNSo8UM1iTPfnpFVgsgzgqiHg0weyG5D3ngXL/uUhP9pXtRc9jkWQdLbMdfqA==
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=1WfgTdnRvZwws94dIWHt3M2GAtggp1bQTmrhdkmwUsM=;
 b=FkY6n3O5kt53OgtVTS9gGWtkEaRllfEVEWLnL8AY2CNfZK3Z23/X8X+6cHCFohYj48PuZCXN40WL5hZXcgy3bcKsKnydc0NE8E6NRsNNGdrw03UDLMoFziWiGo8brRpbTI0wR1K9D9mlMzYsnFc1pKeerAEkqD0z2IoHRB8ylPFLIK74C07pQjE8Wir0TXNny6QMHinLZJGLr8DdyMSNKbR0NOJZno/RWsMtW5MyRzojUa82YYQqAV7MpOQs35zpd/PKN23yV5i94Ul38WHkVdDsQ3x14R0hvnK+LqOktWtIgS0WbaczLlHjO0vJLtNkKuKws1uoluqofohXGkdmcw==
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=1WfgTdnRvZwws94dIWHt3M2GAtggp1bQTmrhdkmwUsM=;
 b=eKIcRTXVVbo/5Og9kvqq9LbmM2/QA4pYKrZv9zZzO8MhqDQFUymvkCHgvzu3PAqKsHrX3nSjjZNBc+Lf2AJUNf4AL7g4TH0+7pZcARWp2Sar4rUUNOBq66SjESAj4bRFPFW6U7XxVieIahv2N251vwmua745rqqcvUryM2UvDWE=
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 PH0PR13MB5794.namprd13.prod.outlook.com (2603:10b6:510:11d::20)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb
 2024 01:45:22 +0000
Received: from SJ0PR13MB5545.namprd13.prod.outlook.com
 ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com
 ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7316.032; Mon, 26 Feb 2024
 01:45:22 +0000
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
 Chaoyong He <chaoyong.he@corigine.com>,
 Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v3 1/4] ethdev: add function to check representor port
Date: Mon, 26 Feb 2024 09:44:57 +0800
Message-Id: <20240226014500.3537561-2-chaoyong.he@corigine.com>
X-Mailer: git-send-email 2.39.1
In-Reply-To: <20240226014500.3537561-1-chaoyong.he@corigine.com>
References: <20240223024217.3052031-1-chaoyong.he@corigine.com>
 <20240226014500.3537561-1-chaoyong.he@corigine.com>
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: PH8PR05CA0005.namprd05.prod.outlook.com
 (2603:10b6:510:2cc::14) To SJ0PR13MB5545.namprd13.prod.outlook.com
 (2603:10b6:a03:424::5)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5794:EE_
X-MS-Office365-Filtering-Correlation-Id: 15f81eb3-7793-4d59-ba59-08dc366c9889
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: YKdNM21gVBBXQm72H0+Nn7bniXabDy6RG9nIoS44hgA2OH06DEGYNGes3ODuuEMfDbnO19ytz6RzZGb0PsDzNNPLofrt1AtIO86yBIn4Jv9GYHUzEctl6mFD9N6pDnFm94uicu0pmINnXSyK4P4iNrA5BnbDVHPndR3TIByDinCgIQwqNPQSjmm4iAYPwfzHUkHMMB64GuRGOtLpOZnSsGbl6zLSW80R4otZw+OCNLE/k4dwaREomwSR8a6on62iKzRft7clfJJp+5rbAYMnvGX2GuD6tQrA2iy8vZtqUVsVgEq39BFnW9DhLgGX8jOWflGSjbjiem7w1iP70ohlICWJi5hcR1Oi+VjNZO/BpnLZbs+kuZ97ftvzjoNtDclnG64MaB6alTBBqBtywxMJng45HqNjvfae9LQfJ/uY280OnMKL3ICik9MEhi4zCGzpgdoSt9jUV3t9df5PJJgdif5wZGvz0QRrqChxdYxTkaiuaiU2ML1JCBshHLVAfAq2dygKX5Dckl9mPNG7ITFyvnaP1J/AO7Bu57blQvwF503SkHZclxG4i0s6wK+4XhlcpopzP9ykAUm22qgC4sqRsxmJHQ9LdS1C85aXhTLeZuBlUH2MGPLgd+FNPHte4+GO1Xk6OxAEIYx/04h7WnbGtIOWBG197i6ATS5KqrlTemTBgn2q6EjTyepYCcY0WKVJsh1926vP18nLSWfFVlQJLqozOCccrNwy4Ae3Q+04tok=
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)(38350700005); DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yZ2Qe3RazOB1SgIQYRKPLAW35MWNGUh6Zd6ma7RDY1alvgV9LMZdTDTqhv2N?=
 =?us-ascii?Q?vkSEy7xFjnlwe2TbxIa7aXGFwgnXKtlvrYTU64YwDEpDfDOXfZo7sJ4u/SCI?=
 =?us-ascii?Q?P1DdADewyArKb5izkdp1dpLEY9bebpik0J+SpLm+fH0FV4M0CseC7ETtXtRW?=
 =?us-ascii?Q?YMhgCNiG/OASZS6J/sPY/tUMuyb/gW7HrYZ5lDhG9yLJc0jJbEQSNwEGBAl7?=
 =?us-ascii?Q?ThjPLlu7EqsNCucQcKS9wppEbmwg6KZZUaMFc+jUcDLNiyc+IaswwCHXpO+p?=
 =?us-ascii?Q?sSrObaNNaBAwWRRwA53HLG9j5N06hfh5Y12s3xrSSShyavQ3VTC8rhvYHGGk?=
 =?us-ascii?Q?Z9r4ojyQ/kGtecesXdBxLKQb+vNpZsQJeIINn9FSunf7PlVVnT29g+WOoXKh?=
 =?us-ascii?Q?8S7VDeUqpfBgBJsVlpvpKNrvh1NgnxcUbCF8HsBDk2xK69soleffJQOFHUMa?=
 =?us-ascii?Q?cycJy8YBvP34BBx00MuJ9NpF3CMbQW8mL8QKmK/oZP+8UUiR70+MEv4l4+C9?=
 =?us-ascii?Q?a0HTdN5ZXZ0Ta0MmUStfnZBC7KhEKHsxLStsMEN/PAkuSyloQgkv8V16Up8k?=
 =?us-ascii?Q?2VEDNYgtMYyHVwYt9d4+u7N2ySafqlDo7s63eln5/gVfXGYHppD7RNih7nfy?=
 =?us-ascii?Q?EDQ5tYRcv1Ttip+gWsGejmbxQDGqMy0rZJrtVahnX7nAJQInF/UZC1bVJCTj?=
 =?us-ascii?Q?aPIpcLNJ6jbtyYFc0VXyw3nVJhTClKrFqdXklb3V4+sL5DdmDSwZP6No1+k+?=
 =?us-ascii?Q?T1huC2r4IbarROdV0hyIpMJaMPbml5t8RR1BNPgfRHcxRIP1HNiekG5yZbTX?=
 =?us-ascii?Q?hdHCBfyFXsG/Hez8b0VN7vxtwN7IOw3rN603Un5k/FRF5xuLtW0NDz1ZrAXZ?=
 =?us-ascii?Q?t7hPFRp2xiAUwnGWlssPu7nmHDHXYRKXceuIg0c161BrGSOTPNan6KSqte7G?=
 =?us-ascii?Q?QLwJAohGUOhE2Xzox1g1P75ymJmiIsrejcqTKvXhEcXyBHn/0iAFWDGU9/wq?=
 =?us-ascii?Q?is3L0R3wZiISGAmQhbRuSJSf62HLgX2c/zGOGZNuClnqMpWVst8I+Hjb5mXD?=
 =?us-ascii?Q?e62UozQYhmdnAydatVaDP4/iiCX1yz+e5/uK439Mk6l9Ma3CfuKry+uTTSvo?=
 =?us-ascii?Q?YCumKz0vk29Fhwh7E6uN/KEPKTzv94RqrWsC+3F8m30ey8Ia+joMZx8vfoJP?=
 =?us-ascii?Q?w2HKVr8tA1tlMi00QUN3t7WdJj6wCz8tumb2gHo/Mr7O/dQkrxAMRiIyPtWf?=
 =?us-ascii?Q?1icgMhv3vHamFa2ZivvdKPgFk9aryiLh2qmk8667WU6r/XiD3BGNQg5Z5TTo?=
 =?us-ascii?Q?J/1yO81Qh3uK6exy8NtxWUl+Ykdsvo2eBBQ70hNQGZ9jPto3YLoVbC9eOQLa?=
 =?us-ascii?Q?4BD3HCg1++yk/iMr7wUOUTa3Kt2YGnp0ZvzkZdlgLG49fPZxPTql0jl/jXPQ?=
 =?us-ascii?Q?j8ySU52kc88zmS5oFNwSf+9BIUe6gkYD97ZUI7/Mu2vgDxk/erMDmEhdp942?=
 =?us-ascii?Q?POJVV3Ssh5SyuNIpu5uiwypL2cDaHnWhYFZ5GMljaxy8EfecAkz5FkG7HFX0?=
 =?us-ascii?Q?iBRJs4Hv1xvPYqEqzC9szX+Oj5uk/+5uyTtIsqZ0TrYm+OL0dlxgSXtmXT3s?=
 =?us-ascii?Q?rw=3D=3D?=
X-OriginatorOrg: corigine.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 15f81eb3-7793-4d59-ba59-08dc366c9889
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 01:45:22.6655 (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: fgsUBC4JrdAOi0P2xSV4pKF5DFzFhSqBgoWLxw01Q8nfLBGFMWlk0md6zbMeBs4P46giB33oaIgIGGtYDC2wgwsn3mmF5M+OY+uWjWMMDww=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5794
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Long Wu <long.wu@corigine.com>

Add a function to check if a device is representor port, also
modified the related codes for PMDs.

Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/bnxt/bnxt.h                    |  3 ---
 drivers/net/bnxt/bnxt_ethdev.c             |  4 ++--
 drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c | 12 ++++++------
 drivers/net/bnxt/tf_ulp/bnxt_ulp.c         |  4 ++--
 drivers/net/bnxt/tf_ulp/ulp_def_rules.c    |  4 ++--
 drivers/net/cpfl/cpfl_representor.c        |  2 +-
 drivers/net/enic/enic.h                    |  5 -----
 drivers/net/enic/enic_ethdev.c             |  2 +-
 drivers/net/enic/enic_fm_flow.c            | 20 ++++++++++----------
 drivers/net/enic/enic_main.c               |  4 ++--
 drivers/net/i40e/i40e_ethdev.c             |  2 +-
 drivers/net/ice/ice_dcf_ethdev.c           |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c           |  2 +-
 drivers/net/nfp/flower/nfp_flower_flow.c   |  2 +-
 drivers/net/nfp/nfp_mtr.c                  |  2 +-
 drivers/net/nfp/nfp_net_common.c           |  4 ++--
 drivers/net/nfp/nfp_net_flow.c             |  2 +-
 lib/ethdev/ethdev_driver.h                 | 17 +++++++++++++++++
 lib/ethdev/rte_class_eth.c                 |  4 ++--
 19 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index fcf2b8be97..82036a16a1 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -1204,9 +1204,6 @@ extern const struct rte_flow_ops bnxt_flow_meter_ops;
 	} \
 } while (0)
 
-#define	BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)	\
-		((eth_dev)->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
-
 extern int bnxt_logtype_driver;
 #define RTE_LOGTYPE_BNXT bnxt_logtype_driver
 #define PMD_DRV_LOG_RAW(level, fmt, args...) \
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f8d83662f4..825e9c1941 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3525,7 +3525,7 @@ bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
 	if (!bp)
 		return -EIO;
 
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+	if (rte_eth_dev_is_repr(dev)) {
 		struct bnxt_representor *vfr = dev->data->dev_private;
 		bp = vfr->parent_dev->data->dev_private;
 		/* parent is deleted while children are still valid */
@@ -6781,7 +6781,7 @@ static int bnxt_pci_remove(struct rte_pci_device *pci_dev)
 
 	PMD_DRV_LOG(DEBUG, "BNXT Port:%d pci remove\n", eth_dev->data->port_id);
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+		if (rte_eth_dev_is_repr(eth_dev))
 			return rte_eth_dev_destroy(eth_dev,
 						   bnxt_representor_uninit);
 		else
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c b/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
index 239191e14e..96d61c3ed2 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_tf_pmd_shim.c
@@ -202,7 +202,7 @@ bnxt_pmd_get_svif(uint16_t port_id, bool func_svif,
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port_id];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+	if (rte_eth_dev_is_repr(eth_dev)) {
 		struct bnxt_representor *vfr = eth_dev->data->dev_private;
 		if (!vfr)
 			return 0;
@@ -260,7 +260,7 @@ bnxt_pmd_get_vnic_id(uint16_t port, enum bnxt_ulp_intf_type type)
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+	if (rte_eth_dev_is_repr(eth_dev)) {
 		struct bnxt_representor *vfr = eth_dev->data->dev_private;
 		if (!vfr)
 			return 0;
@@ -285,7 +285,7 @@ bnxt_pmd_get_fw_func_id(uint16_t port, enum bnxt_ulp_intf_type type)
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+	if (rte_eth_dev_is_repr(eth_dev)) {
 		struct bnxt_representor *vfr = eth_dev->data->dev_private;
 		if (!vfr)
 			return 0;
@@ -308,7 +308,7 @@ bnxt_pmd_get_interface_type(uint16_t port)
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev))
+	if (rte_eth_dev_is_repr(eth_dev))
 		return BNXT_ULP_INTF_TYPE_VF_REP;
 
 	bp = eth_dev->data->dev_private;
@@ -330,7 +330,7 @@ bnxt_pmd_get_phy_port_id(uint16_t port_id)
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port_id];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+	if (rte_eth_dev_is_repr(eth_dev)) {
 		vfr = eth_dev->data->dev_private;
 		if (!vfr)
 			return 0;
@@ -350,7 +350,7 @@ bnxt_pmd_get_parif(uint16_t port_id, enum bnxt_ulp_intf_type type)
 	struct bnxt *bp;
 
 	eth_dev = &rte_eth_devices[port_id];
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(eth_dev)) {
+	if (rte_eth_dev_is_repr(eth_dev)) {
 		struct bnxt_representor *vfr = eth_dev->data->dev_private;
 		if (!vfr)
 			return 0;
diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
index 274e935a1f..33028c470f 100644
--- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
+++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c
@@ -1559,7 +1559,7 @@ bnxt_ulp_destroy_vfr_default_rules(struct bnxt *bp, bool global)
 	struct rte_eth_dev *vfr_eth_dev;
 	struct bnxt_representor *vfr_bp;
 
-	if (!BNXT_TRUFLOW_EN(bp) || BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
+	if (!BNXT_TRUFLOW_EN(bp) || rte_eth_dev_is_repr(bp->eth_dev))
 		return;
 
 	if (!bp->ulp_ctx || !bp->ulp_ctx->cfg_data)
@@ -2316,7 +2316,7 @@ bnxt_ulp_eth_dev_ptr2_cntxt_get(struct rte_eth_dev	*dev)
 {
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 
-	if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+	if (rte_eth_dev_is_repr(dev)) {
 		struct bnxt_representor *vfr = dev->data->dev_private;
 
 		bp = vfr->parent_dev->data->dev_private;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
index fe1f65deb9..8237dbd294 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_def_rules.c
@@ -449,7 +449,7 @@ bnxt_ulp_destroy_df_rules(struct bnxt *bp, bool global)
 	uint16_t port_id;
 
 	if (!BNXT_TRUFLOW_EN(bp) ||
-	    BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev))
+	    rte_eth_dev_is_repr(bp->eth_dev))
 		return;
 
 	if (!bp->ulp_ctx || !bp->ulp_ctx->cfg_data)
@@ -514,7 +514,7 @@ bnxt_ulp_create_df_rules(struct bnxt *bp)
 	int rc = 0;
 
 	if (!BNXT_TRUFLOW_EN(bp) ||
-	    BNXT_ETH_DEV_IS_REPRESENTOR(bp->eth_dev) || !bp->ulp_ctx)
+	    rte_eth_dev_is_repr(bp->eth_dev) || !bp->ulp_ctx)
 		return 0;
 
 	port_id = bp->eth_dev->data->port_id;
diff --git a/drivers/net/cpfl/cpfl_representor.c b/drivers/net/cpfl/cpfl_representor.c
index e2ed9eda04..60b72b5ec1 100644
--- a/drivers/net/cpfl/cpfl_representor.c
+++ b/drivers/net/cpfl/cpfl_representor.c
@@ -339,7 +339,7 @@ cpfl_repr_link_update(struct rte_eth_dev *ethdev,
 	struct cpfl_vport_id vi;
 	int ret;
 
-	if (!(ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+	if (!rte_eth_dev_is_repr(ethdev)) {
 		PMD_INIT_LOG(ERR, "This ethdev is not representor.");
 		return -EINVAL;
 	}
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 78778704f2..f46903ea9e 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -233,11 +233,6 @@ struct enic_vf_representor {
 #define VF_ENIC_TO_VF_REP(vf_enic) \
 	container_of(vf_enic, struct enic_vf_representor, enic)
 
-static inline int enic_is_vf_rep(struct enic *enic)
-{
-	return !!(enic->rte_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR);
-}
-
 /* Compute ethdev's max packet size from MTU */
 static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu)
 {
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 7e040c36c4..cad8db2f6f 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1386,7 +1386,7 @@ static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)
 	ethdev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!ethdev)
 		return -ENODEV;
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+	if (rte_eth_dev_is_repr(ethdev))
 		return rte_eth_dev_destroy(ethdev, enic_vf_representor_uninit);
 	else
 		return rte_eth_dev_destroy(ethdev, eth_enic_dev_uninit);
diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index 90027dc676..8988148454 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -1535,14 +1535,14 @@ vf_egress_port_id_action(struct enic_flowman *fm,
 	ENICPMD_FUNC_TRACE();
 	src_enic = fm->user_enic;
 	dst_enic = pmd_priv(dst_dev);
-	if (!(src_enic->rte_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+	if (!rte_eth_dev_is_repr(src_enic->rte_dev)) {
 		return rte_flow_error_set(error, EINVAL,
 			RTE_FLOW_ERROR_TYPE_ACTION,
 			NULL, "source port is not VF representor");
 	}
 
 	/* VF -> PF uplink. dst is not VF representor */
-	if (!(dst_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) {
+	if (!rte_eth_dev_is_repr(dst_dev)) {
 		/* PF is the VF's PF? Then nothing to do */
 		vf = VF_ENIC_TO_VF_REP(src_enic);
 		if (vf->pf == dst_enic) {
@@ -1954,7 +1954,7 @@ enic_fm_copy_action(struct enic_flowman *fm,
 	if (!(overlap & (FATE | PASSTHRU | COUNT | PORT_ID)))
 		goto unsupported;
 	/* Egress from VF: need implicit WQ match */
-	if (enic_is_vf_rep(enic) && !ingress) {
+	if (rte_eth_dev_is_repr(enic->rte_dev) && !ingress) {
 		fmt->ftm_data.fk_wq_id = 0;
 		fmt->ftm_mask.fk_wq_id = 0xffff;
 		fmt->ftm_data.fk_wq_vnic = enic->fm_vnic_handle;
@@ -3226,7 +3226,7 @@ enic_fm_init(struct enic *enic)
 		return 0;
 	ENICPMD_FUNC_TRACE();
 	/* Get vnic handle and save for port-id action */
-	if (enic_is_vf_rep(enic))
+	if (rte_eth_dev_is_repr(enic->rte_dev))
 		addr = &VF_ENIC_TO_VF_REP(enic)->bdf;
 	else
 		addr = &RTE_ETH_DEV_TO_PCI(enic->rte_dev)->addr;
@@ -3240,7 +3240,7 @@ enic_fm_init(struct enic *enic)
 	enic->fm_vnic_uif = vnic_dev_uif(enic->vdev);
 	ENICPMD_LOG(DEBUG, "uif %u", enic->fm_vnic_uif);
 	/* Nothing else to do for representor. It will share the PF flowman */
-	if (enic_is_vf_rep(enic))
+	if (rte_eth_dev_is_repr(enic->rte_dev))
 		return 0;
 	fm = calloc(1, sizeof(*fm));
 	if (fm == NULL) {
@@ -3321,7 +3321,7 @@ enic_fm_destroy(struct enic *enic)
 	struct enic_fm_fet *fet;
 
 	ENICPMD_FUNC_TRACE();
-	if (enic_is_vf_rep(enic)) {
+	if (rte_eth_dev_is_repr(enic->rte_dev)) {
 		delete_rep_flows(enic);
 		return;
 	}
@@ -3358,7 +3358,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
 	int ret;
 
 	ENICPMD_FUNC_TRACE();
-	if (enic_is_vf_rep(pf))
+	if (rte_eth_dev_is_repr(pf->rte_dev))
 		return -EINVAL;
 	cur = pf;
 	cur_a = &RTE_ETH_DEV_TO_PCI(cur->rte_dev)->addr;
@@ -3367,7 +3367,7 @@ enic_fm_allocate_switch_domain(struct enic *pf)
 		dev = &rte_eth_devices[pid];
 		if (!dev_is_enic(dev))
 			continue;
-		if (dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+		if (rte_eth_dev_is_repr(dev))
 			continue;
 		if (dev == cur->rte_dev)
 			continue;
@@ -3597,7 +3597,7 @@ delete_rep_flows(struct enic *enic)
 	struct rte_eth_dev *dev;
 	uint32_t i;
 
-	RTE_ASSERT(enic_is_vf_rep(enic));
+	RTE_ASSERT(rte_eth_dev_is_repr(enic->rte_dev));
 	vf = VF_ENIC_TO_VF_REP(enic);
 	dev = vf->pf->rte_dev;
 	for (i = 0; i < ARRAY_SIZE(vf->vf2rep_flow); i++) {
@@ -3617,7 +3617,7 @@ begin_fm(struct enic *enic)
 	struct enic_flowman *fm;
 
 	/* Representor uses PF flowman */
-	if (enic_is_vf_rep(enic)) {
+	if (rte_eth_dev_is_repr(enic->rte_dev)) {
 		vf = VF_ENIC_TO_VF_REP(enic);
 		fm = vf->pf->fm;
 	} else {
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index a6aaa760ca..2f681315b6 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -824,7 +824,7 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
 	 * Representor uses a reserved PF queue. Translate representor
 	 * queue number to PF queue number.
 	 */
-	if (enic_is_vf_rep(enic)) {
+	if (rte_eth_dev_is_repr(enic->rte_dev)) {
 		RTE_ASSERT(queue_idx == 0);
 		vf = VF_ENIC_TO_VF_REP(enic);
 		sop_queue_idx = vf->pf_rq_sop_idx;
@@ -1053,7 +1053,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
 	 * Representor uses a reserved PF queue. Translate representor
 	 * queue number to PF queue number.
 	 */
-	if (enic_is_vf_rep(enic)) {
+	if (rte_eth_dev_is_repr(enic->rte_dev)) {
 		RTE_ASSERT(queue_idx == 0);
 		vf = VF_ENIC_TO_VF_REP(enic);
 		queue_idx = vf->pf_wq_idx;
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4d21341382..ddbc2962bc 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -706,7 +706,7 @@ static int eth_i40e_pci_remove(struct rte_pci_device *pci_dev)
 	if (!ethdev)
 		return 0;
 
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+	if (rte_eth_dev_is_repr(ethdev))
 		return rte_eth_dev_pci_generic_remove(pci_dev,
 					i40e_vf_representor_uninit);
 	else
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index bebf356f4d..d58ec9d907 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -2131,7 +2131,7 @@ eth_ice_dcf_pci_remove(struct rte_pci_device *pci_dev)
 	if (!eth_dev)
 		return 0;
 
-	if (eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+	if (rte_eth_dev_is_repr(eth_dev))
 		return rte_eth_dev_pci_generic_remove(pci_dev,
 						      ice_dcf_vf_repr_uninit);
 	else
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0cd3d0b105..c61c52b296 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1842,7 +1842,7 @@ static int eth_ixgbe_pci_remove(struct rte_pci_device *pci_dev)
 	if (!ethdev)
 		return 0;
 
-	if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+	if (rte_eth_dev_is_repr(ethdev))
 		return rte_eth_dev_pci_generic_remove(pci_dev,
 					ixgbe_vf_representor_uninit);
 	else
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index e26be30d18..501a8d87bd 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -4321,7 +4321,7 @@ int
 nfp_flow_ops_get(struct rte_eth_dev *dev,
 		const struct rte_flow_ops **ops)
 {
-	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
+	if (!rte_eth_dev_is_repr(dev)) {
 		*ops = NULL;
 		PMD_DRV_LOG(ERR, "Port is not a representor.");
 		return -EINVAL;
diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c
index 255977ec22..6abc6dc9bc 100644
--- a/drivers/net/nfp/nfp_mtr.c
+++ b/drivers/net/nfp/nfp_mtr.c
@@ -1066,7 +1066,7 @@ static const struct rte_mtr_ops nfp_mtr_ops = {
 int
 nfp_net_mtr_ops_get(struct rte_eth_dev *dev, void *arg)
 {
-	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) {
+	if (!rte_eth_dev_is_repr(dev)) {
 		PMD_DRV_LOG(ERR, "Port is not a representor");
 		return -EINVAL;
 	}
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 99c319eb2d..0ee2811926 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -241,7 +241,7 @@ nfp_net_get_hw(const struct rte_eth_dev *dev)
 {
 	struct nfp_net_hw *hw;
 
-	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+	if (rte_eth_dev_is_repr(dev)) {
 		struct nfp_flower_representor *repr;
 		repr = dev->data->dev_private;
 		hw = repr->app_fw_flower->pf_hw;
@@ -2143,7 +2143,7 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev,
 
 	hw = nfp_net_get_hw(dev);
 
-	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+	if (rte_eth_dev_is_repr(dev)) {
 		snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d",
 			hw->ver.extend, hw->ver.class,
 			hw->ver.major, hw->ver.minor);
diff --git a/drivers/net/nfp/nfp_net_flow.c b/drivers/net/nfp/nfp_net_flow.c
index 98e8499756..3b33f3b6e9 100644
--- a/drivers/net/nfp/nfp_net_flow.c
+++ b/drivers/net/nfp/nfp_net_flow.c
@@ -932,7 +932,7 @@ nfp_net_flow_ops_get(struct rte_eth_dev *dev,
 {
 	struct nfp_net_hw *hw;
 
-	if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) {
+	if (rte_eth_dev_is_repr(dev)) {
 		*ops = NULL;
 		PMD_DRV_LOG(ERR, "Port is a representor.");
 		return -EINVAL;
diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
index 0e4c1f0743..0b088fdab7 100644
--- a/lib/ethdev/ethdev_driver.h
+++ b/lib/ethdev/ethdev_driver.h
@@ -1813,6 +1813,23 @@ rte_eth_representor_id_get(uint16_t port_id,
 			   int controller, int pf, int representor_port,
 			   uint16_t *repr_id);
 
+/**
+ * @internal
+ * Check if the ethdev is a representor port.
+ *
+ * @param dev
+ *  Pointer to struct rte_eth_dev.
+ *
+ * @return
+ *  false the ethdev is not a representor port.
+ *  true  the ethdev is a representor port.
+ */
+static inline bool
+rte_eth_dev_is_repr(const struct rte_eth_dev *dev)
+{
+	return ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0);
+}
+
 /**
  * PMD helper function to parse ethdev arguments
  *
diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c
index bc003db8af..b52f1dd9f2 100644
--- a/lib/ethdev/rte_class_eth.c
+++ b/lib/ethdev/rte_class_eth.c
@@ -69,7 +69,7 @@ eth_representor_cmp(const char *key __rte_unused,
 	struct rte_eth_devargs eth_da;
 	uint16_t id = 0, nc, np, nf, i, c, p, f;
 
-	if ((data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0)
+	if (!rte_eth_dev_is_repr(edev))
 		return -1; /* not a representor port */
 
 	/* Parse devargs representor values. */
@@ -143,7 +143,7 @@ eth_dev_match(const struct rte_eth_dev *edev,
 	}
 	/* if no representor key, default is to not match representor ports */
 	if (ret != 0)
-		if ((edev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0)
+		if (rte_eth_dev_is_repr(edev))
 			return -1; /* do not match any representor */
 
 	return 0;
-- 
2.39.1