vdpa/mlx5: support Sub-Function

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>
This commit is contained in:
Thomas Monjalon 2021-07-21 22:37:40 +08:00
parent d599bf8209
commit cf8a8a8f48
2 changed files with 18 additions and 2 deletions

View 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
^^^^^^^^^^^^^^

View 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;
}