vdpa/mlx5: support Sub-Function
authorThomas Monjalon <thomas@monjalon.net>
Wed, 21 Jul 2021 14:37:40 +0000 (22:37 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 21 Jul 2021 22:11:14 +0000 (00:11 +0200)
RoCE disabling requirement is based on PCI address.
In order to support Sub-Function, a conversion is needed
in the case of an auxiliary device.

SF device can be probed with such devargs string:
  auxiliary:mlx5_core.sf.<id>,class=vdpa

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
doc/guides/vdpadevs/mlx5.rst
drivers/vdpa/mlx5/mlx5_vdpa.c

index 9b2f9f1..30f0b62 100644 (file)
@@ -163,6 +163,18 @@ Driver options
   - 0, HW default.
 
 
+Devargs example
+^^^^^^^^^^^^^^^
+
+- PCI devargs::
+
+  -a 0000:03:00.2,class=vdpa
+
+- Auxiliary devargs::
+
+  -a auxiliary:mlx5_core.sf.2,class=vdpa
+
+
 Error handling
 ^^^^^^^^^^^^^^
 
index 9c9a552..6d17d7a 100644 (file)
@@ -553,9 +553,13 @@ close:
 static int
 mlx5_vdpa_roce_disable(struct rte_device *dev)
 {
+       char pci_addr[PCI_PRI_STR_SIZE] = { 0 };
+
+       if (mlx5_dev_to_pci_str(dev, pci_addr, sizeof(pci_addr)) < 0)
+               return -rte_errno;
        /* Firstly try to disable ROCE by Netlink and fallback to sysfs. */
-       if (mlx5_vdpa_nl_roce_disable(dev->name) != 0 &&
-           mlx5_vdpa_sys_roce_disable(dev->name) != 0)
+       if (mlx5_vdpa_nl_roce_disable(pci_addr) != 0 &&
+           mlx5_vdpa_sys_roce_disable(pci_addr) != 0)
                return -rte_errno;
        return 0;
 }