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 C0711A0547; Wed, 29 Sep 2021 13:13:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1C70410DB; Wed, 29 Sep 2021 13:13:38 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 74013410D7 for ; Wed, 29 Sep 2021 13:13:36 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10121"; a="212171530" X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="212171530" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2021 04:13:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,332,1624345200"; d="scan'208";a="479226068" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2021 04:13:35 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 29 Sep 2021 04:13:34 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 29 Sep 2021 04:13:34 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 29 Sep 2021 04:13:34 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.40) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 29 Sep 2021 04:13:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJAM6RgcvKjQlocXg5Ow3kYbGS9SuEDdS3osC5lnFsrt7xhsJT/u6Bt8Y1Yj1vPvsQSTT+jcT45NFzVxMUUwQd5Ew6REBS0iKmCP7B4oOEmfoqH3qLZn16CfdJT/XtrWgCzfOiNB+l0n5CWhinenjZmTwwVI7n7r3VwseEIDUKayVHB7r372uINRw3gzUSlsJssacP3geptggdcU8YfgmvLXW22ogPC/yYifFaTIflIHihtEJ79o4Z4tRc67AWcpqIaFbRbk75K9FnQkmMfsdur4SZI0kdLHJaaIpbun+AvYp+iG8bFkNeQRtx2y4OC0u5yi5TOZUFRqIvBQQvUWbg== 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; bh=owaJnmCAMVGZqpVmLENavOhd5dbjBZJSmDpInQ/q4qA=; b=QE23m7AN6Rl8z7ib2afPaMP/ABE7x8IGU5h6g9K4GifFUutm9TyHgb3BeM6TVFEGgFrSyPTXFezRPbMVW7n9okuRPNKzzg/qyt5nM9yvoKzEeFNUboudntqVzpDdkr4/boJPuwjmlTCinVYyoThDNglW84/ya0HgooeiLotehLTqM4kL9KFxj79lboKA5JBHfFtf2hqCdayNh0see7bvO9QHeEjbZ3QkZ3QVqTT915+WBq0AJMwvYpPRVEf9Exmio2/QtuQYfN4s+hSH/NDLXzHpFVzDR/KYBky0XRFG+AQUDBF/zeR9fwnEWrLvhhYbznLk8EJX562WTspOV9i66g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=owaJnmCAMVGZqpVmLENavOhd5dbjBZJSmDpInQ/q4qA=; b=UyN8Z4d2sVHoo3rfMktBTw0LDr1GipHXa1LuSoMItXPlZgG79K/UyMxtpm94Y6wLnN8Y1E2NMeo3rIDWIU0hqFc2JnygNLe+XkiawQoPeybZ6RkLr7NDyA2mORyKt46vcIkw30kCsztpE1s5NzsyMBxxiCzlllibeYM7rpkoMqQ= Authentication-Results: oktetlabs.ru; dkim=none (message not signed) header.d=none;oktetlabs.ru; dmarc=none action=none header.from=intel.com; Received: from CY4PR11MB1367.namprd11.prod.outlook.com (2603:10b6:903:2d::16) by CY4PR1101MB2293.namprd11.prod.outlook.com (2603:10b6:910:22::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Wed, 29 Sep 2021 11:13:31 +0000 Received: from CY4PR11MB1367.namprd11.prod.outlook.com ([fe80::a00b:3347:5cd4:d190]) by CY4PR11MB1367.namprd11.prod.outlook.com ([fe80::a00b:3347:5cd4:d190%2]) with mapi id 15.20.4544.022; Wed, 29 Sep 2021 11:13:31 +0000 To: Andrew Rybchenko , Ajit Khaparde , Somnath Kotur , John Daley , Hyong Youb Kim , "Beilei Xing" , Qiming Yang , Qi Zhang , Haiyue Wang , Matan Azrad , Viacheslav Ovsiienko , "Thomas Monjalon" , Ferruh Yigit CC: , Viacheslav Galaktionov References: <20210712161747.958019-1-andrew.rybchenko@oktetlabs.ru> <20210913112633.2836730-1-andrew.rybchenko@oktetlabs.ru> From: "Singh, Aman Deep" Message-ID: <2ddbed3f-6a65-6a6f-462a-4753860c9b2f@intel.com> Date: Wed, 29 Sep 2021 16:43:18 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 In-Reply-To: <20210913112633.2836730-1-andrew.rybchenko@oktetlabs.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: PN1PR0101CA0042.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::28) To CY4PR11MB1367.namprd11.prod.outlook.com (2603:10b6:903:2d::16) MIME-Version: 1.0 Received: from [192.168.1.18] (223.178.208.11) by PN1PR0101CA0042.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Wed, 29 Sep 2021 11:13:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73ef3d7c-8fff-4d1b-64a6-08d9833a2b6f X-MS-TrafficTypeDiagnostic: CY4PR1101MB2293: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vc08uRpZfacBukHvNyTPvxjufl7okN27DbWi6uUDebLLI0zoukiXtt4uikOg6l9kTx5ElQi9pxEyEiQzWPpOf6G7HSR38mqB42e826vSyzRcuvEMgShjwn0viyoxsTi47a6+xziPFW8NQm0wqSoCL1vurY4xC5jFIzX8k8k6oIpn8jz9Nz57kMN6loU9QPw0FVnxE3C4Ia255SIEdBoAmlZARFv+cZiLOaIIaVy/+5GneOzO89vWCVaq3JN2QTypD9iDtX5Zpvq+qWw5JwykhtIuG9Y51IlryqkBsZGMxNkVNY/rsyxHqXqulVh5vLesMem3Ss8c+9OSlQN/Uj+TAU81ut/t2wrLenGXzAVc8aAp5JUoA+9iM0uphuMyghwjuSLR1QnfIu0kXUtfa2sSI+mTSvg3/swuH+TUQSCPnbbIbzFstJXOeY3KWnBSHzAxq9RSEx/CQxsS90CK6JApNrQ4hmA/BwEb6HWQhBKjC9iHEWsomz1uS+0aVCsb5FBhKqVloSXM7csvSVfWZl+BaN6F30GxY4WrzT6Ur38RWpdDmV25ZFPMn3kOehBIN/wceDGaiOPG/BnCoEQGPBJka+YgENCy3k56HVKr/3xvFVXMU/gj9MErT9WdlOVOt6UgwHh7QDJjEKiyiwqyXnNvqPBvM38fk6j4J7jqGcyIGvSlOQwFr+gDhiZwrNhdRbcp6dZILN62kOorSDxH5GiWsp39gutGkxV+DwneZVYRbwSt5esPwAU/owjIO8zx8ZRou/RFbq5CM1+4Q+iVLruWoBCOeLehDiA/6xlX1kqPgBc6vKgt+h6/wthaoOmKnegy4BgTsqWpiDhFWzCo4OhDrw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB1367.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(7416002)(66556008)(2906002)(83380400001)(66476007)(53546011)(2616005)(6636002)(31686004)(956004)(30864003)(38100700002)(4326008)(6486002)(86362001)(186003)(66946007)(16576012)(966005)(26005)(921005)(36756003)(6666004)(508600001)(8936002)(31696002)(5660300002)(110136005)(8676002)(316002)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TU9DZnBIVDV4TnY0WXVHakVLK2xPb2JhSHlSYnFmSURCcFNvenFjNFRtZEp1?= =?utf-8?B?L2hEYURYbzB6Z2wrWmw2RmowT0tqTU10NEdUUnM3QTA2aTZIa3FSb1I3ZlF1?= =?utf-8?B?NDNEek5PbTFhS0dFM3BTQW9FQjhySzB3aTdaUzZQRXdhV09abjBvTFBKYVQ3?= =?utf-8?B?NTUrb1ZZL1lIdWxQZUhoVkdaTE5MalY3MVQvRS9ydWJLb1FtNXkzU2wvVVFx?= =?utf-8?B?WHl6bmxRRERXSUdaZzhodlBiVVhNYW9ubmpzUW02VVFxWTNPZngyUkJadkpt?= =?utf-8?B?MGR2ZlJLQXFwZVV3UlA5akpaWlN0QWpZZTA0Rys0WDBEc2hyL2tOOWJlOExF?= =?utf-8?B?R01za3BnUHppSUlZd0dqbzBYdmx6WEJ0UkhPdU9VQXNQQmNwYkJqU0pYbDBM?= =?utf-8?B?VFJIREE4SyttNVhQMThCMnF1bVk0dTZVZCszMksxVHd3MG8xSWg2a090RXQw?= =?utf-8?B?L3NtZ3YrTXB4dGIxcjlUMjFRR3FQSE5QL1loeW9RSGhzUHRDdEdVLy9zZzRO?= =?utf-8?B?dmhvS2o5aHBaOFJBcjhKd0F6SStEL3Y5cUlYOXhhbERiRmlxUUx1RFdkUFRt?= =?utf-8?B?ajFGMFNNOXlaU2xrMDJwU3dQa1ArVVlmZVV1WjBOc1VzWTJxZkFKWS81OGlZ?= =?utf-8?B?VUNiTGdGR3VISjVmdWVzLzNKRGQzNjN2bGhVSU9kRUgrSm81UWJYaXEva25J?= =?utf-8?B?R3lXTURqaFhWMy9tL1A2RDkzL2hGN0FSVFU1b24yV3NrRVdQa0pRNWQzKzl6?= =?utf-8?B?TzYxejh4WnhlQWNOZWxGNFNlMWx5amgyTmtxRVBpdFlIYk5HbmZocGlWeVNl?= =?utf-8?B?bVR4NFRsL0pwVkI3aHFyc2ZQL3BZRjU4N2pXUkJ1OGdnTmFiMEgyYlNBT0l4?= =?utf-8?B?K1dhMDRYZVRHeGVESEkyK1ozOGpPN25zQ2hBTVd5d21VZ3ZBS2E5dDk4dFow?= =?utf-8?B?T3dtQ3FwWFZkUlp1THJ4cFlxN0NUQlg2dDB5NE1aRUxyZTlucGQ5Z2Mwekkw?= =?utf-8?B?TkR4anRqTWNXUDVVREFJVUhyRVJIeVFmakRrTWk1cWtpMTRDd2tIbHV4c09W?= =?utf-8?B?UkIxajdhRHpVdERGVFBLWUhtTDg5enorQlZaTWU3c0h6c0R5cGUvQ1luOVRn?= =?utf-8?B?YWt3REZkTmcrbHVCWGNpTWxUd0hyTW5jekI2Q1MrSUdoTVBSOU4wTm9ObXht?= =?utf-8?B?WnVUTEZJUkpJN1R1OGdJMDh4L29DZUlnaUxpQndJVTVNeGllZU8xM0twek4z?= =?utf-8?B?K1RKdjE0cjJVTkpRTnpKcnQyWkJMcVc1dFVjQW5YMGZEWW1qL1hQYWNRQzVI?= =?utf-8?B?aGYvZmh2aUh6VEpnRTB2STlETUR6ckhXekNyQ25XOUFnWFk2dG9hZ2RhZWJT?= =?utf-8?B?TFJ1NHl5a2dIYlpmMFAyZ0NyWldRZUxuZXBRS2trcTRCdUNxcmFQbk5pS1RC?= =?utf-8?B?cnhMQVhFM1lHWlZZdW9wTytFM1QyQXhwUWE2WUp5V1hGdWkwcStRWTlpbncv?= =?utf-8?B?NG45Q1Y2UnZKL1Era2ZRazk4YnlJTU42TmgxREJDY1hqY3NjMUg0dkliRDlZ?= =?utf-8?B?RlhvL0wyN3dEWFVlM0F0eTdENWFHZjVJMFplc2NvR0k2T1crVm1NakwrNlpm?= =?utf-8?B?dmtsL1NCUEx0WTZyVXdkaDdBU2o3S2RqUHNrWnRzcElBM1VXc081dDFNU3E1?= =?utf-8?B?OUZ1Nk1BZUswTmQzUmVDZ0l4ZTMwZG9wTXUxemJsQnFMaU41TE1zdmVtc3Bv?= =?utf-8?Q?GYTH7GDp69RX4mBPsEbQeXw4gBxnJwyAgj0+D8m?= X-MS-Exchange-CrossTenant-Network-Message-Id: 73ef3d7c-8fff-4d1b-64a6-08d9833a2b6f X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1367.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2021 11:13:31.2047 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XDS5BEGcib0uEqo00fGPdv62Ddu6rEh+OOTZ3LN3a6YoMLh3vyaIaiudPvrm3hxzJ1X6+bGhBpSv9P7vxIPridklo4EHCrOO2qhPXZ8F2H0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2293 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5] 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" On 9/13/2021 4:56 PM, Andrew Rybchenko wrote: > From: Viacheslav Galaktionov > > Getting a list of representors from a representor does not make sense. > Instead, a parent device should be used. > > To this end, extend the rte_eth_dev_data structure to include the port ID > of the backing device for representors. > > Signed-off-by: Viacheslav Galaktionov > Signed-off-by: Andrew Rybchenko > Acked-by: Haiyue Wang > Acked-by: Beilei Xing > --- > 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]. > It should not be a problem anyway since 21.11 is a ABI breaking release. > > Potentially it is bad for out-of-tree drivers which implement > representors but do not fill in a new parert_port_id field in > rte_eth_dev_data structure. Get ID by name will not work. Did we change name of new field from parert_port_id to backer_port_id. > > mlx5 changes should be reviwed by maintainers very carefully, since > we are not sure if we patch it correctly. > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=28060 > > v5: > - try to improve name: backer_port_id instead of parent_port_id > - init new field to RTE_MAX_ETHPORTS on allocation to avoid > zero port usage by default > > v4: > - apply mlx5 review notes: remove fallback from generic ethdev > code and add fallback to mlx5 code to handle legacy usecase > > v3: > - fix mlx5 build breakage > > v2: > - fix mlx5 review notes > - try device port ID first before parent in order to address > backward compatibility issue > > 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 | 13 +++++++++++++ > drivers/net/mlx5/windows/mlx5_os.c | 13 +++++++++++++ > lib/ethdev/ethdev_driver.h | 6 +++--- > lib/ethdev/rte_class_eth.c | 2 +- > lib/ethdev/rte_ethdev.c | 9 +++++---- > lib/ethdev/rte_ethdev_core.h | 6 ++++++ > 11 files changed, 46 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c > index bdbad53b7d..0d50c0f1da 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 |= RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > eth_dev->data->representor_id = rep_params->vf_id; > + eth_dev->data->backer_port_id = rep_params->parent_dev->data->port_id; > > 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/drivers/net/enic/enic_vf_representor.c b/drivers/net/enic/enic_vf_representor.c > index 79dd6e5640..fedb09ecd6 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 |= RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > eth_dev->data->representor_id = vf->vf_id; > + eth_dev->data->backer_port_id = pf->port_id; > eth_dev->data->mac_addrs = 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/i40e_vf_representor.c > index 0481b55381..d65b821a01 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 |= RTE_ETH_DEV_REPRESENTOR | > RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; > ethdev->data->representor_id = representor->vf_id; > + ethdev->data->backer_port_id = pf->dev_data->port_id; > > /* Setting the number queues allocated to the VF */ > ethdev->data->nb_rx_queues = vf->vsi->nb_qps; > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c > index 970461f3e9..e51d0aa6b9 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_dev, void *init_param) > > vf_rep_eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; > vf_rep_eth_dev->data->representor_id = repr->vf_id; > + vf_rep_eth_dev->data->backer_port_id = repr->dcf_eth_dev->data->port_id; > > vf_rep_eth_dev->data->mac_addrs = &repr->mac_addr; > > diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c > index d5b636a194..9fa75984fb 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) > > ethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; > ethdev->data->representor_id = representor->vf_id; > + ethdev->data->backer_port_id = representor->pf_ethdev->data->port_id; > > /* Set representor device ops */ > ethdev->dev_ops = &ixgbe_vf_representor_dev_ops; > diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c > index 470b16cb9a..1cddaaba1a 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -1677,6 +1677,19 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > if (priv->representor) { > eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; > eth_dev->data->representor_id = priv->representor_id; > + MLX5_ETH_FOREACH_DEV(port_id, &priv->pci_dev->device) { > + struct mlx5_priv *opriv = > + rte_eth_devices[port_id].data->dev_private; > + if (opriv && > + opriv->master && > + opriv->domain_id == priv->domain_id && > + opriv->sh == priv->sh) { > + eth_dev->data->backer_port_id = port_id; > + break; > + } > + } > + if (port_id >= RTE_MAX_ETHPORTS) > + eth_dev->data->backer_port_id = eth_dev->data->port_id; > } > priv->mp_id.port_id = eth_dev->data->port_id; > strlcpy(priv->mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN); > diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c > index 26fa927039..a9c244c7dc 100644 > --- a/drivers/net/mlx5/windows/mlx5_os.c > +++ b/drivers/net/mlx5/windows/mlx5_os.c > @@ -543,6 +543,19 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > if (priv->representor) { > eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR; > eth_dev->data->representor_id = priv->representor_id; > + MLX5_ETH_FOREACH_DEV(port_id, &priv->pci_dev->device) { > + struct mlx5_priv *opriv = > + rte_eth_devices[port_id].data->dev_private; > + if (opriv && > + opriv->master && > + opriv->domain_id == priv->domain_id && > + opriv->sh == priv->sh) { > + eth_dev->data->backer_port_id = port_id; > + break; > + } > + } > + if (port_id >= RTE_MAX_ETHPORTS) > + eth_dev->data->backer_port_id = eth_dev->data->port_id; > } > /* > * Store associated network device interface index. This index > diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h > index 40e474aa7e..b940e6cb38 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 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 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 > index 1fe5fa1f36..eda216ced5 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 = i / (np * nf); > p = (i / nf) % np; > f = i % nf; > - if (rte_eth_representor_id_get(edev, > + if (rte_eth_representor_id_get(edev->data->backer_port_id, > eth_da.type, > eth_da.nb_mh_controllers == 0 ? -1 : > eth_da.mh_controllers[c], > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index daf5ca9242..7c9b0d6b3b 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -524,6 +524,7 @@ rte_eth_dev_allocate(const char *name) > eth_dev = eth_dev_get(port_id); > strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); > eth_dev->data->port_id = port_id; > + eth_dev->data->backer_port_id = RTE_MAX_ETHPORTS; > eth_dev->data->mtu = RTE_ETHER_MTU; > pthread_mutex_init(ð_dev->data->flow_ops_mutex, NULL); > > @@ -5996,7 +5997,7 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) > } > > 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) > @@ -6012,7 +6013,7 @@ rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, > return -EINVAL; > > /* Get PMD representor range info. */ > - ret = rte_eth_representor_info_get(ethdev->data->port_id, NULL); > + ret = rte_eth_representor_info_get(port_id, NULL); > if (ret == -ENOTSUP && type == RTE_ETH_REPRESENTOR_VF && > controller == -1 && pf == -1) { > /* Direct mapping for legacy VF representor. */ > @@ -6027,7 +6028,7 @@ rte_eth_representor_id_get(const struct rte_eth_dev *ethdev, > if (info == NULL) > return -ENOMEM; > info->nb_ranges_alloc = n; > - ret = rte_eth_representor_info_get(ethdev->data->port_id, info); > + ret = rte_eth_representor_info_get(port_id, info); > if (ret < 0) > goto out; > > @@ -6046,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; > > diff --git a/lib/ethdev/rte_ethdev_core.h b/lib/ethdev/rte_ethdev_core.h > index edf96de2dc..48b814e8a1 100644 > --- a/lib/ethdev/rte_ethdev_core.h > +++ b/lib/ethdev/rte_ethdev_core.h > @@ -185,6 +185,12 @@ struct rte_eth_dev_data { > /**< Switch-specific identifier. > * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > */ > + uint16_t backer_port_id; > + /**< Port ID of the backing device. > + * This device will be used to query representor > + * info and calculate representor IDs. > + * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. > + */ > > pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex. */ > uint64_t reserved_64s[4]; /**< Reserved for future fields */