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 A9E4AA0C41; Fri, 27 Aug 2021 11:48:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26F76410E0; Fri, 27 Aug 2021 11:48:24 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id B479A406B4 for ; Fri, 27 Aug 2021 11:48:22 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 47F827F6D3; Fri, 27 Aug 2021 12:48:22 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from oktetlabs.ru (calendar.oktetlabs.ru [192.168.34.50]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 9045D7F593; Fri, 27 Aug 2021 12:48:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 9045D7F593 Authentication-Results: shelob.oktetlabs.ru/9045D7F593; dkim=none; dkim-atps=neutral MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 27 Aug 2021 12:48:10 +0300 From: Viacheslav Galaktionov To: "Xueming(Steven) Li" Cc: 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 , dev@dpdk.org In-Reply-To: References: <20210712161747.958019-1-andrew.rybchenko@oktetlabs.ru> <20210818140004.2812575-1-andrew.rybchenko@oktetlabs.ru> Message-ID: <9f94fd99973050392ba5c37f9dbacec0@oktetlabs.ru> X-Sender: viacheslav.galaktionov@oktetlabs.ru User-Agent: Roundcube Webmail/1.3.16 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" On 2021-08-27 12:18, Xueming(Steven) Li wrote: >> -----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 ; 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 >> >> 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 parent device for representors. >> >> Signed-off-by: Viacheslav Galaktionov >> >> Signed-off-by: Andrew Rybchenko >> --- [snip] >> 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 |= RTE_ETH_DEV_REPRESENTOR; >> eth_dev->data->representor_id = priv->representor_id; >> + MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) { >> + 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->parent_port_id = >> + rte_eth_devices[port_id].data->port_id; > > Could this value different than port_id? Oh, yes, that's an oversight. Thank you! >> + break; >> + } >> + } >> + if (port_id >= RTE_MAX_ETHPORTS) { >> + DRV_LOG(ERR, "no master device for representor"); >> + err = ENODEV; >> + goto error; > > Here shouldn't be an error. What do you mean? Is it normal not to have a master device for a representor? > Parent port ID default to 0, it could be wrong if multiple PF probed, > let's default to current port ID. What is the "current" port ID here? Do you mean the representor's port ID? If you are talking about the value of the port_id variable, then I suppose it could be set to RTE_MAX_ETHPORTS explicitly if a master device isn't found. [snip]