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 877A2A0C46; Mon, 19 Jul 2021 08:58:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2C0A64068B; Mon, 19 Jul 2021 08:58:52 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2072.outbound.protection.outlook.com [40.107.94.72]) by mails.dpdk.org (Postfix) with ESMTP id 843504067A; Mon, 19 Jul 2021 08:58:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dCaFp+4qP0tx5HtZrUXKEHP2rO5y0gDYKGu/KZ1HL1djT0Gt87Zhg2XE9Pai39hIrvVlxrVmoVOEITRp+P6zjjwd2eg7Jbrt0RD7lXcuJwM/dcqBdz3dTqg9XVKLvM6MT6XS9GDfNG4QeIlJ3FZ3ILv1GBn+zf11nYwzoJC+K4k8HivSyIRKscmqNxR6FITTlfCw9T+peM26Rtdi/AjWSvJ9tdKZDW5C+waNb+aPqEFdKa7bGmXMwHLWiVY4NTita66jO/noosj4suCVuOB5B9k14wPbaZIXO625wXcVjS5oFR6D0KYbOMSZGJ4QIpsCvOP0QezT59UVxYS/TDfKoQ== 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=7VEkI2LRzsqZQul86hF42T8bMeOCTW8KPRAsaZ8Yo/w=; b=EUzrITKhm0wd3JUeOdDoq5N6bKo8SU9brHufKi0udGwBy/MqUvRyJWjqFWqB7T45yRSRnxnVDRJM2B5Ae8CYz3BeCnp7f8ASKzDcflriIoJWglTY5ZRG4tGPcalezO86JmoJUpWvaVx2dsiVBubYfRZTXXLhqsIJOai9PVlGjPxF8fOe9eCfFTrLYp6sv4JTtJaBVulFHqXZGmetsFVoKe+LUKFn1VfAn9sKLZutx2UQS08sFAzZU3yD2mI9NJ+6eigPNX46ETJ8Z0gcY6jw81yP2oTf0srQLZms+wniwrPGcmv5C5q6vMMry7elQBl7HnHZfzifK3wuujfqik3FqQ== 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=7VEkI2LRzsqZQul86hF42T8bMeOCTW8KPRAsaZ8Yo/w=; b=C2MXbV7AYDmJYdzp6SMNZqvTrO+N/luAHVS9RETL3EmaSZBSBwq87IIEk5GZdDTcJ9VOi232YM+c63P8tc2iynOzibp7dmtA11GvgwYRXJCXezUPbHihK3frWRfoxBkQC6/Ibz5er+TobQXQcHEd9OczQ8R/MUPHmOLQ40/VPLt3xX2D8JBLWzREL+w/xeCdN5m4hGPxxqriGJWzR6eGT/P6Y93S2lY2V4arzP4AO2wfwExcT1in9vfl37C9lacg4EZdWogsSmcn7SeN2t1eLjBUr6W72yHKGEb2e0519fYT33FYeMwtrhG4+m9q2UuUXY6lxVJ+nn8XeBDVXTnewA== Received: from DM4PR12MB5373.namprd12.prod.outlook.com (2603:10b6:5:39a::17) by DM4PR12MB5040.namprd12.prod.outlook.com (2603:10b6:5:38b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 06:58:48 +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.4331.032; Mon, 19 Jul 2021 06:58:48 +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 , "stable@dpdk.org" Thread-Topic: [PATCH] ethdev: fix representor port ID search by name Thread-Index: AQHXdzmBL03cdLFgc0azq8W9R2FptatJ5kow Date: Mon, 19 Jul 2021 06:58:48 +0000 Message-ID: References: <20210712161747.958019-1-andrew.rybchenko@oktetlabs.ru> In-Reply-To: <20210712161747.958019-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: 430f922a-b03e-4600-1fdb-08d94a82a8d1 x-ms-traffictypediagnostic: DM4PR12MB5040: 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:935; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a9mtjOeeF6l4GDw0DJNd9un6nF40Nvo8NKwwEH8qFeZIm5J7zlBoUwVG5tzshaocLAn/B60XJryKn/DvlEc1xFWVr6LTXbtdodMEwTLN5uAHLiLIBhpFb8R73AwIxjV7XzHL+RYS9JjPVrVlgcFYMXEv0S5gpqTfWi+TyLx6Nsc7TKi4xyB1NecMZFr3P2OlyYi8Uj302kxIepPrlKdc2uCZQZgC84ROgS7xBFjbn8AOPQ6UisbqrVghrX3Knu5zDQYXD5WjSe7Op2OwWVqw9ngdTG4b3y4O9j85altC4P2i0BykQRZiOyw/eJS6mHZ/+P60qMMpvU0gP/yMLP9xoIfWJGnuPhsK0QCLVhA7VSXSVSsoJ5yr5Z/JbXHad69b/ANllpRB8Y0qNQUyN33IbvecmVour+HEqCJp9zwNPUoAeCbCagUIy22gKHrsQjyWG6nLaKMwyvuEhjpZYmzIpp7Q1J2i6DFP/RRIurcy+xfjI4g53Q0W5hoTVbjjgV2YoJOjmOCTD/jRutouDGvw9VNYoCGl29adCvMb0D8rI9NagP3fdgb9UW6hSw/VjtDWVNX3bPsHt4K86W+Q/P/Xkj4670M1zgsSqdS9QXFVywGBO0exEiNwHExErrQdz0CWyCvW7Rcyc+EQihxCp6zffE9BnBOCl/nSME7zeiKKYGB5f1eU+QUug/KbrHVScATxpOv8V/UnRj36id1wcHThFzpWjOt3LR0Q890kA6bS4DgHhR/GBLtUHJWIsCoxykNouFDAhmakteqdQCYtOsgM7SDeLXkIxxU7E+ESfWUAJkDPi23YPTSe9MNJTNAKfIFv 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)(39860400002)(136003)(346002)(376002)(366004)(396003)(66446008)(4326008)(66556008)(64756008)(2906002)(8936002)(66946007)(55016002)(966005)(66476007)(478600001)(186003)(5660300002)(9686003)(76116006)(71200400001)(110136005)(53546011)(921005)(52536014)(83380400001)(316002)(26005)(86362001)(122000001)(7416002)(6506007)(54906003)(33656002)(8676002)(30864003)(38100700002)(7696005)(38070700004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rZmELvRGVCyc4i7h/KlxBGi3LzB+cdic67A6wwnVmKdVnApVhYiNdiEW5bW7?= =?us-ascii?Q?fiG9NqcC0TUqi2LjznDzVajcrMK4ns2CGuKMk+fyVkOXXE4NJqTrwzcF0ksj?= =?us-ascii?Q?JIJtRKbsmVA3g1bjVv+IMyUOkRjCTOk78MXB5FB8Mfshc+0I9WMwsnmQZ/V7?= =?us-ascii?Q?Lb67kXMuUz1HjrxzV43orDfLO/rEeCmXxUQAbq7tVekXiZ+ijiBmU/qQPu2M?= =?us-ascii?Q?7Oe7vgtyKphcZiQIVFu+jmmNqLwjgqcywY/i3hgIs0jsjpfvfGPO5VKPgucI?= =?us-ascii?Q?pFGYD5wCqM1EQAnzxcB4a+opqGToyYKRRdSGbaAfuWljVRgCqbpjhiH3On+4?= =?us-ascii?Q?aQaJD2y9VhxFCXs3+MKXEche1eyIOeSxq880anshkRHVL/N9AHy0OjSaaiTT?= =?us-ascii?Q?TggRq8bKPezzHUUexiMT//DElMB6JXJdyrbkYobatVEU1kbPX9vgOTk0rTPR?= =?us-ascii?Q?uGcN82ZeGEFVV+qiUbeWt3S+O8btGRNTfumxxi83jvlHYcGhGvIP36ymkG4V?= =?us-ascii?Q?Bj7P9e5S3f0EO1JWZQ5MDaLHTFiGVSegpfG1gw+mfJISJdQJBFxdPLViXyie?= =?us-ascii?Q?CxOgC2JOJrEgfrlesblSq6nlC27py3G4FVvQmh4MeyiYXgm29nD9W554Nr3D?= =?us-ascii?Q?c/f7IgI8KBDr0+yDOulKN56Qt2cTY5fqwcik3Z62ZFY8uDBgjCO/vutwJ14b?= =?us-ascii?Q?EcWon4Vcw5mOpx8C1Rv+1Tote4vEVTibhUljZxKA4rXHvutUF2DEIpbzMtF1?= =?us-ascii?Q?9ayqeFVCy/ZtCuihJCSX7oGazJyvxwYsAS/DRObiglnvgElpii0R/zeFqOIh?= =?us-ascii?Q?cb/Xpbc8ToYrki/Bb1o9h/j2a5oz2PmJ/fKUDDVs3g4HB+3TL7DGKycQjgEf?= =?us-ascii?Q?R2QJ164rXUjogoPtB+3afzAMk6OnD2enrniCsklOeRQNo5ggD03Mu5UkVPwg?= =?us-ascii?Q?T427jVzYUf3VomjQzUx9qjEEIeg3Y8obW2lfF+D/Jzz/iTkNFHVRi5foYuzF?= =?us-ascii?Q?gVy062KmU0AsHUhZ9xUb00bnHqhxiCw1RPcmRL9h5tG1YjRxkUND9D83AJJv?= =?us-ascii?Q?VD3RDF5qjHizDjZVoLgTybfjZAjs5st/mvnGjrH6n60cxWXsCtYjWgxyIV8A?= =?us-ascii?Q?jqhI2NY8CdFj8tWDpdvmaXWlXDYOPYxJW7T9lF7vZvqEVGVyndFcUtbmDlFC?= =?us-ascii?Q?6njbi9h7gvVudaf7tIZ6l/Ge22QonGYEHI44IGIO19kmf7F3uoBWcfA2PbWo?= =?us-ascii?Q?Dw89jZGI05xwZc3QJlxoPLy9r2gPhJq7eajbbcK7atz3vW5WHGQ9CSZZnAHO?= =?us-ascii?Q?eyzyxI95dz/y3GH3Vlf7J6qm?= 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: 430f922a-b03e-4600-1fdb-08d94a82a8d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2021 06:58:48.7619 (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: Upw8sGGpwxi+Sj02BpM7YwTHwHz22tiQbVIYXfraSWfvFsvELWBY6tOHY5ESk5yKyw3sqGGjrZ8Cbp2wRVr1uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5040 Subject: Re: [dpdk-dev] [PATCH] 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: Tuesday, July 13, 2021 12:18 AM > 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 ; Xu= eming(Steven) Li > Cc: dev@dpdk.org; Viacheslav Galaktionov ; stable@dpdk.org > Subject: [PATCH] ethdev: fix representor port ID search by name >=20 > From: Viacheslav Galaktionov >=20 > Fix representor port ID search by name if the representor itself does not= provide representors info. Getting a list of representors from > a representor does not make sense. Instead, a parent device should be use= d. >=20 > To this end, extend the rte_eth_dev_data structure to include the port ID= of the parent device for representors. >=20 > Fixes: df7547a6a2cc ("ethdev: add helper function to get representor ID") > Cc: stable@dpdk.org >=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 | 11 +++++++++++ > drivers/net/mlx5/windows/mlx5_os.c | 11 +++++++++++ > lib/ethdev/ethdev_driver.h | 6 +++--- > lib/ethdev/rte_class_eth.c | 2 +- > lib/ethdev/rte_ethdev.c | 8 ++++---- > lib/ethdev/rte_ethdev_core.h | 4 ++++ > 11 files changed, 39 insertions(+), 8 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 be22d9cbd2..5550d30628 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -1511,6 +1511,17 @@ 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) { > + const struct mlx5_priv *opriv =3D > + rte_eth_devices[port_id].data->dev_private; > + > + if (!opriv || > + opriv->sh !=3D priv->sh || > + opriv->representor) > + continue; > + eth_dev->data->parent_port_id =3D port_id; > + break; > + } > } > 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 e30b682822..037c928dc1 100644 > --- a/drivers/net/mlx5/windows/mlx5_os.c > +++ b/drivers/net/mlx5/windows/mlx5_os.c > @@ -506,6 +506,17 @@ 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) { > + const struct mlx5_priv *opriv =3D > + rte_eth_devices[port_id].data->dev_private; > + > + if (!opriv || > + opriv->sh !=3D priv->sh || > + opriv->representor) > + continue; > + eth_dev->data->parent_port_id =3D port_id; > + break; > + } > } > /* > * Store associated network device interface index. This index diff --g= it a/lib/ethdev/ethdev_driver.h > b/lib/ethdev/ethdev_driver.h index 40e474aa7e..07f6d1f9a4 100644 > --- a/lib/ethdev/ethdev_driver.h > +++ b/lib/ethdev/ethdev_driver.h > @@ -1248,8 +1248,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 parent_port_id > + * Port ID of the backing device. > * @param type > * Representor type. > * @param controller > @@ -1266,7 +1266,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 parent_port_id, It make more sense to get representor info from parent port. Representor is= a member of switch domain, PMD owns=20 the information of the representor owner port and info of representors. Th= is change looks better, but not sure whether it valuable to introduce a new member to the EAL data structure. > 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..e3b7ab9728 100644 > --- a/lib/ethdev/rte_class_eth.c > +++ b/lib/ethdev/rte_class_eth.c > @@ -95,7 +95,7 @@ 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, > + if (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], > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 6ebf= 52b641..acda1d43fb 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 parent_port_id, > enum rte_eth_representor_type type, > int controller, int pf, int representor_port, > uint16_t *repr_id) > @@ -6012,7 +6012,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(parent_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. */ @@ -6026,7 +6026,7 @@ = rte_eth_representor_id_get(const struct > rte_eth_dev *ethdev, > info =3D calloc(1, size); > if (info =3D=3D NULL) > return -ENOMEM; > - ret =3D rte_eth_representor_info_get(ethdev->data->port_id, info); > + ret =3D rte_eth_representor_info_get(parent_port_id, info); > if (ret < 0) > goto out; >=20 > @@ -6045,7 +6045,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, > + parent_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