[dpdk-dev] [PATCH v6] ethdev: fix representor port ID search by name

Slava Ovsiienko viacheslavo at nvidia.com
Mon Oct 11 09:56:08 CEST 2021


Hi,

> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Sent: Friday, October 8, 2021 12:27
> To: Ajit Khaparde <ajit.khaparde at broadcom.com>; Somnath Kotur
> <somnath.kotur at broadcom.com>; John Daley <johndale at cisco.com>; Hyong
> Youb Kim <hyonkim at cisco.com>; Beilei Xing <beilei.xing at intel.com>; Qiming
> Yang <qiming.yang at intel.com>; Qi Zhang <qi.z.zhang at intel.com>; Haiyue
> Wang <haiyue.wang at intel.com>; Matan Azrad <matan at nvidia.com>; Slava
> Ovsiienko <viacheslavo at nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas at monjalon.net>; Ferruh Yigit <ferruh.yigit at intel.com>
> Cc: dev at dpdk.org; Viacheslav Galaktionov
> <viacheslav.galaktionov at oktetlabs.ru>; Xueming(Steven) Li
> <xuemingl at nvidia.com>
> Subject: [PATCH v6] ethdev: fix representor port ID search by name
> 
> From: Viacheslav Galaktionov <viacheslav.galaktionov at oktetlabs.ru>
> 
> The patch is required for all PMDs which do not provide representors info on
> the representor itself.
> 
> The function, rte_eth_representor_id_get(), is used in
> eth_representor_cmp() which is required in ethdev class iterator to search
> ethdev port ID by name (representor case). Before the patch the function is
> called on the representor itself and tries to get representors info to match.
> 
> Search of port ID by name is used after hotplug to find out port ID of the just
> plugged device.
> 
> Getting a list of representors from a representor does not make sense.
> Instead, a backer 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 <viacheslav.galaktionov at oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
> Acked-by: Haiyue Wang <haiyue.wang at intel.com>
> Acked-by: Beilei Xing <beilei.xing at intel.com>
> Reviewed-by: Xueming Li <xuemingl at nvidia.com>

...snip ..
 
> a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
> index 3746057673..612340b3b6 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) {

I would use dpdk_dev here instead of PCI.
mlx5 supports SF representors, Aux bus based, so PCI device might be irrelevant.

..snip ..
> 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) {
                                                                        
The same comment about &priv->pci_dev->device

Beside this:
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>





More information about the dev mailing list