dpdk: fix device name suffix confusion with failsafe/netvsc 32/15732/2
authorStephen Hemminger <sthemmin@microsoft.com>
Mon, 5 Nov 2018 20:54:16 +0000 (12:54 -0800)
committerDamjan Marion <dmarion@me.com>
Tue, 6 Nov 2018 11:53:24 +0000 (11:53 +0000)
When netvsc or failsafe DPDK device is used, the DPDK port id does not
match the VPP device instance id.  The code that formats the device
name was incorrectly calling DPDK device info using the VPP device
instance id. This causes the VPP interface to be named
"FortyGigabit0/2/0" based on mistakenly finding the PCI device
information of the hidden DPDK port id for the VF device.

Change-Id: I9366232f4b2087076bdcc1a58bf228007c24c084
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
src/plugins/dpdk/device/format.c

index 579de9c..9124ec2 100644 (file)
@@ -152,6 +152,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
   char *devname_format;
   char *device_name;
   u32 i = va_arg (*args, u32);
+  dpdk_device_t *xd = vec_elt_at_index (dm->devices, i);
   struct rte_eth_dev_info dev_info;
   struct rte_pci_device *pci_dev;
   u8 *ret;
@@ -215,7 +216,6 @@ format_dpdk_device_name (u8 * s, va_list * args)
       break;
 
     case VNET_DPDK_PORT_TYPE_AF_PACKET:
-      rte_eth_dev_info_get (i, &dev_info);
       return format (s, "af_packet%d", dm->devices[i].af_packet_instance_num);
 
     case VNET_DPDK_PORT_TYPE_VIRTIO_USER:
@@ -236,7 +236,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
       break;
     }
 
-  rte_eth_dev_info_get (i, &dev_info);
+  rte_eth_dev_info_get (xd->port_id, &dev_info);
   pci_dev = dpdk_get_pci_device (&dev_info);
 
   if (pci_dev && dm->devices[i].port_type != VNET_DPDK_PORT_TYPE_FAILSAFE)