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 4E241A0548; Fri, 27 Aug 2021 11:18:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6C05406B4; Fri, 27 Aug 2021 11:18:07 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by mails.dpdk.org (Postfix) with ESMTP id 09A304067C for ; Fri, 27 Aug 2021 11:18:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mUsHvyiqmLXiT/KvtxcfanSIEOprPi9eSwQx0L6QYhHdvjy+NrvIvinzRrZfzupcSLxruzDuqWKfuRbbgj1JsWipuMzsgX+t+6eYTRbaf8+kMc/qw3SvXxLgqN6alhtr6ALYYCSciYbnBQ0p2KMu+j/rgrsibVOg+ZCE2OM9pODSl111aZ4Oix8hS7/XFcwWe74CkfZFkdXByvADX+/XiWkgISJi+IHSQk+foiSd8LpsxxhFpwgANjlAlDyU6KOlXP30B8tOL7bhugsox9OrviumUCYihfo4xBeLL3+Lx7uS8sFZ/JA83ItHIhVunbv+mHJ8eLr666DV62QsvzklXQ== 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-SenderADCheck; bh=ME5yAf0M4xs4P4br3TVFxsoF1NZhY2VlLlWMaOf1ynI=; b=WO2TNdcfkL+q71i/P5bi2cge/iBwyH+2+iGlFSe2bTE+93ciU1zIeX8Q4pDv0YyeeXA5aApmjnHsGPTAwEtEESNeT8Sh3AvnYmRNQfstPj2luGw5MvkY/oCcb5o6aBAwb4CIg2F1BVv1YgryzM9GcYHngl8m5xfDHz/gkLR8yUX1PZ6CFVcGPeEXydCe++W+1b/LXBFtyocFdszGJJXdO2EVAWFlcLOp0PZC0rARgzXwbORtgSfXwYTgY4cqAcPpj1vjieaPSUKHfEJabBLQeKPnREErXGotHMYNIRPj1WJS1XZ45Su9CyixipTLG9+mptDpkDgz7D9S1cnwCOmbUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ME5yAf0M4xs4P4br3TVFxsoF1NZhY2VlLlWMaOf1ynI=; b=o7q0+5HA75jrtiRc4eRzoJ7EygDR+0tE97MzPSGx8G/q8djy3nyz3B779n1pcuxYTAP58y1tuKHNmzn0mFE1Mtpl5+5Sce4q2zbsWVh2aQ861/WEd3XRdrMNs5ljMiZ3RGgf/y1uJ+Q264LiRUkjl7HnefQ1TnzNU7nitUIjGufq92ljtSqGzIUVLCXFKQUF/7vgdwxnuUwWCVkgwaZLtjXGy1XpM2wXCst5w/L514EaZIJaj2a7CHI/DQbYAuhQVJzyJgft9Azbir3Zd86MBfuOiXwzZoM458dhyvce/rIZERCNmNI0tUq1ADIIXGv2uNOZfL5tOePIMDAJeoQ4vA== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39a::17) by DM6PR12MB5517.namprd12.prod.outlook.com (2603:10b6:5:1be::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.20; Fri, 27 Aug 2021 09:18:03 +0000 Received: from DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::20f5:dbdd:64b1:617b]) by DM4PR12MB5373.namprd12.prod.outlook.com ([fe80::20f5:dbdd:64b1:617b%9]) with mapi id 15.20.4415.023; Fri, 27 Aug 2021 09:18:03 +0000 From: "Xueming(Steven) Li" To: Andrew Rybchenko , Ajit Khaparde , Somnath Kotur , John Daley , Hyong Youb Kim , Beilei Xing , Qiming Yang , Qi Zhang , Haiyue Wang , Matan Azrad , Shahaf Shuler , Slava Ovsiienko , NBU-Contact-Thomas Monjalon , Ferruh Yigit CC: "dev@dpdk.org" , Viacheslav Galaktionov Thread-Topic: [PATCH v2] ethdev: fix representor port ID search by name Thread-Index: AQHXlDllfmkq6KXETEOza9FJTMyvfquHH0aQ Date: Fri, 27 Aug 2021 09:18:03 +0000 Message-ID: References: <20210712161747.958019-1-andrew.rybchenko@oktetlabs.ru> <20210818140004.2812575-1-andrew.rybchenko@oktetlabs.ru> In-Reply-To: <20210818140004.2812575-1-andrew.rybchenko@oktetlabs.ru> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 20c3ebb9-da1b-4ab5-d529-08d9693b9299 x-ms-traffictypediagnostic: DM6PR12MB5517: x-ld-processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3631; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0B8ZHWd8knTYd6VGF+EQqGvu8Mi+COwX5kFm3Giu2TxY4heqW8a7oeQNuVEB3KrtpzQ7i2xiFztkX5UxccrnzjbkhPuc8oy148pXXKrJNZkNFPpn68vxwestkO9UOLPCqyDS7MlqW0pNUVc0ZHoC5tjBRkrdenh9PKFjcmH4IAIHiVuK6DKevoESLBdSs6dDkUMureMxxtTqD2dcfWJnOwL9hy8Vs4CWwqX0B8sgd3WEu0KtoNJZml3L8Gt64XFArgUE3rBfok3NwBwfyBgaAa274CKBe9NioD1C2YsouPHCnms/C5SsZPdKPLCGmMMchu/Vk8Cy/mx+IYlicen7SRkSMJ+8PYRz41soTs6zNQr8e13QNyt7KXZqyWsuQ+o8mkdnG1/kgEGmSg0wDg5vh1ckYaWKt6Sc+HR8g1j04KRq3ObeMyQxnd/JoRJbw2KPBa1rYEo/OyLshYrPl3u6sZdQZ6Tt7qniqv/6VeiW//skweYtZQwdp7BSwkL2y2tcMdBziTs6s6hkA/QpNPnSAAWi26SHN1Lcc93lky/ITIwmLuNUsmURQb/jiWs/EADZtV78JMv90pLq0rq/lt/muMTVXu9QyfR7aijkZnzL1vIlYzlGu9o72unKOZ5+k6dmVbuXxTprqdBio+EhKX1TyAfE1vRBr5D8iYZ6NHlBmEeUbWb+edtP7E7PUSgqzXVa6IOvd3206OwCEfOcXRkxwlKW08R9hV6NngBhMeLFNgEkfcBaw0RH9ccOnfqJtbp+AJxcWrX6h6Sxnm9nkmERnr+CprQQl09il4drVSnkpXJwAUqrl6VMSabX/rst3E92 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR12MB5373.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(110136005)(7696005)(66476007)(54906003)(122000001)(30864003)(7416002)(921005)(38070700005)(53546011)(4326008)(2906002)(52536014)(71200400001)(38100700002)(5660300002)(6506007)(316002)(33656002)(186003)(66556008)(66446008)(9686003)(8936002)(66946007)(478600001)(966005)(8676002)(83380400001)(55016002)(26005)(76116006)(86362001)(64756008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?VZeFoj4/zz3WTnOXDd9QK/E1atNqwW2G/aqg9dnsjqqD5u/jxBqtIeQL8bRa?= =?us-ascii?Q?OibL09Yk9yZERbq1EGMAHiJl7DQvWIlRnO4dEBR7C1YWxSpjZSfk6G8Af7+5?= =?us-ascii?Q?Zt4V6g1boSbHX38VChpcHWzzHumS3KHdtmOZIY0h56f3RTo4iK7sWoMX/0+C?= =?us-ascii?Q?WG4gPZTQUQsb+1FGkGLs1UOJp18DuNsw9NnBc3/3qCsV0DjnA/5KQFc2+JHm?= =?us-ascii?Q?F7+0axztBWuexmGyIL6tqxoRVecuYUfwKqFb4fQN0yrCCVVgTD/e/gNd4B6R?= =?us-ascii?Q?VrtcQQOWQYFJBu1yq02lWslOO2Sddjx75p2XTAZjgbg1qiBoH/mtpYRl3hRR?= =?us-ascii?Q?jUiDdxn+4yIB59qPG1ujMAl5rAWCTZFG+7rxr6Q0yF8oCJmasvDdSkWf6MF9?= =?us-ascii?Q?bCr1z97lz9/WrXLZiJ4Es09pPtLukRQ3TpJrKze+hihkNoxmdGlBGDBABZSN?= =?us-ascii?Q?WW5X1eUUDofyt1vU2wNKAYSER4jfyarINZ/3GWJ1ceXPF3s6dSarYvbgvFVc?= =?us-ascii?Q?kptnfsJ0cbT/waZoACN1JDAxfLFKktMUQ0QfdnrHogRR8DoaWUR9EqML29Mt?= =?us-ascii?Q?0x9a4N2iQhDJmBQZ559i5v19CNHSY3CbzbZ4h9Ovz3KeA4zC8ZYDvA/Btoqo?= =?us-ascii?Q?NZiRnkIuzoZ1GffWEpiAstLALxAFRj+SBQkf+Amg2I8WV5DTPpwxC+UTZdyr?= =?us-ascii?Q?jECsTBKhnY1aIHSJbhrucJR6E65GXtYPPWkmVAtMC62MDAiTQ8BSZvql+3/J?= =?us-ascii?Q?nU+lMK71S4FuUInYAuRdn/8BbvV8WljTjD5o/2ObXZJBzlkvp31lPBiHtt/W?= =?us-ascii?Q?6uJlgiqEY4+ccbneJPpgs7kCPiG1E2irWRUjYuBfX33Zf8bLvssL50RNEA/p?= =?us-ascii?Q?2x3CJSRB7tkU5NvCBpdfv2qhvLZBsK513j/FItNNxvVeaxQk5XkFxE36g2D5?= =?us-ascii?Q?GpeXi5oKgWGtlFJFHdv9+Kdn7nu4/n5Y0YPhLbPVtoW9qParcTlxgOvr22IU?= =?us-ascii?Q?A1+svRJZMXGh8/dVU4ujkZ5d4mjVBqKY7zsDm9b71BTGotkmPTpzf5k21KA9?= =?us-ascii?Q?q8Oytj3hIvXLY/i1GTUKbjVQDJrQe1hTtQnNPk3vmfaZ8R0U6f6VPYhLrBuW?= =?us-ascii?Q?Q5bWXsi1ereY/nR2J2cCClFpYQhTwHvo4RXNGLZ5T3lfXnjeqOAfDOF/s13N?= =?us-ascii?Q?FZBQpQB74xSJad2OCKIPEPlEt02RNjJAIV1ZsVlEj2+MLq3MK8XbkGsx0i9S?= =?us-ascii?Q?DY6Do5NAtjW+X4y5uzFa7W8vejSkFza0crrsNaIbwy2/fdH8u1HSEQOz3U5y?= =?us-ascii?Q?BFmNgVSlTezT600d0ejbWEzc?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5373.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20c3ebb9-da1b-4ab5-d529-08d9693b9299 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Aug 2021 09:18:03.2032 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: X0ZFCgYtRzeR30gow2XYy7t4L1xbrTEsrNu1NS7W5DSMdlJrSSsqjGOn60iTqwON4Axij5M9BuQgm9QMR6PQuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5517 Subject: Re: [dpdk-dev] [PATCH v2] ethdev: fix representor port ID search by name 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 Sender: "dev" > -----Original Message----- > From: Andrew Rybchenko > Sent: Wednesday, August 18, 2021 10:00 PM > To: Ajit Khaparde ; Somnath Kotur ; John Daley > ; Hyong Youb Kim ; Beilei Xing ; Qiming Yang > ; Qi Zhang ; Haiyue Wang ; Matan Azrad > ; Shahaf Shuler ; Slava Ovsiienko <= viacheslavo@nvidia.com>; NBU-Contact-Thomas > Monjalon ; Ferruh Yigit > Cc: dev@dpdk.org; Viacheslav Galaktionov ; Xueming(Steven) Li > Subject: [PATCH v2] ethdev: fix representor port ID search by name >=20 > From: Viacheslav Galaktionov >=20 > Getting a list of representors from a representor does not make sense. > Instead, a parent device should be used. >=20 > To this end, extend the rte_eth_dev_data structure to include the port ID= of the parent device for representors. >=20 > Signed-off-by: Viacheslav Galaktionov > Signed-off-by: Andrew Rybchenko > --- > The new field is added into the hole in rte_eth_dev_data structure. > The patch does not change ABI, but extra care is required since ABI check= is disabled for the structure because of the libabigail bug [1]. >=20 > Potentially it is bad for out-of-tree drivers which implement representor= s but do not fill in a new parert_port_id field in > rte_eth_dev_data structure. Do we care? >=20 > May be the patch should add lines to release notes, but I'd like to get i= nitial feedback first. >=20 > mlx5 changes should be reviwed by maintainers very carefully, since we ar= e not sure if we patch it correctly. >=20 > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=3D28060 >=20 > drivers/net/bnxt/bnxt_reps.c | 1 + > drivers/net/enic/enic_vf_representor.c | 1 + > drivers/net/i40e/i40e_vf_representor.c | 1 + > drivers/net/ice/ice_dcf_vf_representor.c | 1 + drivers/net/ixgbe/ixgbe= _vf_representor.c | 1 + > drivers/net/mlx5/linux/mlx5_os.c | 17 +++++++++++++++++ > drivers/net/mlx5/windows/mlx5_os.c | 17 +++++++++++++++++ > lib/ethdev/ethdev_driver.h | 6 +++--- > lib/ethdev/rte_class_eth.c | 22 ++++++++++++++++++++-- > lib/ethdev/rte_ethdev.c | 8 ++++---- > lib/ethdev/rte_ethdev_core.h | 4 ++++ > 11 files changed, 70 insertions(+), 9 deletions(-) >=20 > diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c = index bdbad53b7d..902591cd39 100644 > --- a/drivers/net/bnxt/bnxt_reps.c > +++ b/drivers/net/bnxt/bnxt_reps.c > @@ -187,6 +187,7 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev= , void *params) > eth_dev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > eth_dev->data->representor_id =3D rep_params->vf_id; > + eth_dev->data->parent_port_id =3D rep_params->parent_dev->data->port_id= ; >=20 > rte_eth_random_addr(vf_rep_bp->dflt_mac_addr); > memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr, diff --git a/driv= ers/net/enic/enic_vf_representor.c > b/drivers/net/enic/enic_vf_representor.c > index 79dd6e5640..6ee7967ce9 100644 > --- a/drivers/net/enic/enic_vf_representor.c > +++ b/drivers/net/enic/enic_vf_representor.c > @@ -662,6 +662,7 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_= dev, void *init_params) > eth_dev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > eth_dev->data->representor_id =3D vf->vf_id; > + eth_dev->data->parent_port_id =3D pf->port_id; > eth_dev->data->mac_addrs =3D rte_zmalloc("enic_mac_addr_vf", > sizeof(struct rte_ether_addr) * > ENIC_UNICAST_PERFECT_FILTERS, 0); > diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i4= 0e_vf_representor.c > index 0481b55381..865b637585 100644 > --- a/drivers/net/i40e/i40e_vf_representor.c > +++ b/drivers/net/i40e/i40e_vf_representor.c > @@ -514,6 +514,7 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, = void *init_params) > ethdev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > ethdev->data->representor_id =3D representor->vf_id; > + ethdev->data->parent_port_id =3D pf->dev_data->parent_port_id; >=20 > /* Setting the number queues allocated to the VF */ > ethdev->data->nb_rx_queues =3D vf->vsi->nb_qps; diff --git a/drivers/ne= t/ice/ice_dcf_vf_representor.c > b/drivers/net/ice/ice_dcf_vf_representor.c > index 970461f3e9..c7cd3fd290 100644 > --- a/drivers/net/ice/ice_dcf_vf_representor.c > +++ b/drivers/net/ice/ice_dcf_vf_representor.c > @@ -418,6 +418,7 @@ ice_dcf_vf_repr_init(struct rte_eth_dev *vf_rep_eth_d= ev, void *init_param) >=20 > vf_rep_eth_dev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR; > vf_rep_eth_dev->data->representor_id =3D repr->vf_id; > + vf_rep_eth_dev->data->parent_port_id =3D > +repr->dcf_eth_dev->data->port_id; >=20 > vf_rep_eth_dev->data->mac_addrs =3D &repr->mac_addr; >=20 > diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe= /ixgbe_vf_representor.c > index d5b636a194..7a2063849e 100644 > --- a/drivers/net/ixgbe/ixgbe_vf_representor.c > +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c > @@ -197,6 +197,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev,= void *init_params) >=20 > ethdev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR; > ethdev->data->representor_id =3D representor->vf_id; > + ethdev->data->parent_port_id =3D representor->pf_ethdev->data->port_id; >=20 > /* Set representor device ops */ > ethdev->dev_ops =3D &ixgbe_vf_representor_dev_ops; diff --git a/drivers= /net/mlx5/linux/mlx5_os.c > b/drivers/net/mlx5/linux/mlx5_os.c > index 5f8766aa48..a68fa7beb7 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -1677,6 +1677,23 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > if (priv->representor) { > eth_dev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR; > eth_dev->data->representor_id =3D priv->representor_id; > + MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { > + struct mlx5_priv *opriv =3D > + rte_eth_devices[port_id].data->dev_private; > + if (opriv && > + opriv->master && > + opriv->domain_id =3D=3D priv->domain_id && > + opriv->sh =3D=3D priv->sh) { > + eth_dev->data->parent_port_id =3D > + rte_eth_devices[port_id].data->port_id; > + break; > + } > + } > + if (port_id >=3D RTE_MAX_ETHPORTS) { > + DRV_LOG(ERR, "no master device for representor"); > + err =3D ENODEV; > + goto error; > + } > } > priv->mp_id.port_id =3D eth_dev->data->port_id; > strlcpy(priv->mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN); diff --gi= t a/drivers/net/mlx5/windows/mlx5_os.c > b/drivers/net/mlx5/windows/mlx5_os.c > index 7e1df1c751..0c5a02bfcb 100644 > --- a/drivers/net/mlx5/windows/mlx5_os.c > +++ b/drivers/net/mlx5/windows/mlx5_os.c > @@ -543,6 +543,23 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > if (priv->representor) { > eth_dev->data->dev_flags |=3D RTE_ETH_DEV_REPRESENTOR; > eth_dev->data->representor_id =3D priv->representor_id; > + MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { > + struct mlx5_priv *opriv =3D > + rte_eth_devices[port_id].data->dev_private; > + if (opriv && > + opriv->master && > + opriv->domain_id =3D=3D priv->domain_id && > + opriv->sh =3D=3D priv->sh) { > + eth_dev->data->parent_port_id =3D > + rte_eth_devices[port_id].data->port_id; Could this value different than port_id? > + break; > + } > + } > + if (port_id >=3D RTE_MAX_ETHPORTS) { > + DRV_LOG(ERR, "no master device for representor"); > + err =3D ENODEV; > + goto error; Here shouldn't be an error. Parent port ID default to 0, it could be wrong if multiple PF probed, let's= default to current port ID. > + } > } > /* > * Store associated network device interface index. This index diff --g= it a/lib/ethdev/ethdev_driver.h > b/lib/ethdev/ethdev_driver.h index fd5b7ca550..d1a1499538 100644 > --- a/lib/ethdev/ethdev_driver.h > +++ b/lib/ethdev/ethdev_driver.h > @@ -1287,8 +1287,8 @@ struct rte_eth_devargs { > * For backward compatibility, if no representor info, direct > * map legacy VF (no controller and pf). > * > - * @param ethdev > - * Handle of ethdev port. > + * @param port_id > + * Port ID of the backing device. > * @param type > * Representor type. > * @param controller > @@ -1305,7 +1305,7 @@ struct rte_eth_devargs { > */ > __rte_internal > int > -rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, > +rte_eth_representor_id_get(uint16_t port_id, > enum rte_eth_representor_type type, > int controller, int pf, int representor_port, > uint16_t *repr_id); > diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c inde= x 1fe5fa1f36..167d2d798c 100644 > --- a/lib/ethdev/rte_class_eth.c > +++ b/lib/ethdev/rte_class_eth.c > @@ -95,14 +95,32 @@ eth_representor_cmp(const char *key __rte_unused, > c =3D i / (np * nf); > p =3D (i / nf) % np; > f =3D i % nf; > - if (rte_eth_representor_id_get(edev, > + /* > + * rte_eth_representor_id_get expects to receive port ID of > + * the master device, but in order to maintain compatibility > + * with mlx5's hardware bonding and legacy representor > + * specification using just VF numbers, the representor's port > + * ID is tried first. > + */ > + ret =3D rte_eth_representor_id_get(edev->data->port_id, > eth_da.type, > eth_da.nb_mh_controllers =3D=3D 0 ? -1 : > eth_da.mh_controllers[c], > eth_da.nb_ports =3D=3D 0 ? -1 : eth_da.ports[p], > eth_da.nb_representor_ports =3D=3D 0 ? -1 : > eth_da.representor_ports[f], > - &id) < 0) > + &id); > + if (ret =3D=3D -ENOTSUP) > + ret =3D rte_eth_representor_id_get( > + edev->data->parent_port_id, > + eth_da.type, > + eth_da.nb_mh_controllers =3D=3D 0 ? -1 : > + eth_da.mh_controllers[c], > + eth_da.nb_ports =3D=3D 0 ? -1 : eth_da.ports[p], > + eth_da.nb_representor_ports =3D=3D 0 ? -1 : > + eth_da.representor_ports[f], > + &id); > + if (ret < 0) > continue; > if (data->representor_id =3D=3D id) > return 0; > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 9d95= cd11e1..228ef7bf23 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -5997,7 +5997,7 @@ rte_eth_devargs_parse(const char *dargs, struct rte= _eth_devargs *eth_da) } >=20 > int > -rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, > +rte_eth_representor_id_get(uint16_t port_id, > enum rte_eth_representor_type type, > int controller, int pf, int representor_port, > uint16_t *repr_id) > @@ -6013,7 +6013,7 @@ rte_eth_representor_id_get(const struct rte_eth_dev= *ethdev, > return -EINVAL; >=20 > /* Get PMD representor range info. */ > - ret =3D rte_eth_representor_info_get(ethdev->data->port_id, NULL); > + ret =3D rte_eth_representor_info_get(port_id, NULL); > if (ret =3D=3D -ENOTSUP && type =3D=3D RTE_ETH_REPRESENTOR_VF && > controller =3D=3D -1 && pf =3D=3D -1) { > /* Direct mapping for legacy VF representor. */ @@ -6028,7 +6028,7 @@ = rte_eth_representor_id_get(const struct > rte_eth_dev *ethdev, > if (info =3D=3D NULL) > return -ENOMEM; > info->nb_ranges_alloc =3D n; > - ret =3D rte_eth_representor_info_get(ethdev->data->port_id, info); > + ret =3D rte_eth_representor_info_get(port_id, info); > if (ret < 0) > goto out; >=20 > @@ -6047,7 +6047,7 @@ rte_eth_representor_id_get(const struct rte_eth_dev= *ethdev, > continue; > if (info->ranges[i].id_end < info->ranges[i].id_base) { > RTE_LOG(WARNING, EAL, "Port %hu invalid representor ID Range %u - %u,= entry %d\n", > - ethdev->data->port_id, info->ranges[i].id_base, > + port_id, info->ranges[i].id_base, > info->ranges[i].id_end, i); > continue; >=20 > diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h = index edf96de2dc..13cb84b52f 100644 > --- a/lib/ethdev/rte_ethdev_core.h > +++ b/lib/ethdev/rte_ethdev_core.h > @@ -185,6 +185,10 @@ struct rte_eth_dev_data { > /**< Switch-specific identifier. > * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > */ > + uint16_t parent_port_id; > + /**< Port ID of the backing device. > + * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > + */ >=20 > pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex. */ > uint64_t reserved_64s[4]; /**< Reserved for future fields */ > -- > 2.30.2