dpdk: use port_id as interface name suffix for representors 91/24791/3
authorHaggai Eran <haggai.eran@gmail.com>
Tue, 4 Feb 2020 12:32:19 +0000 (14:32 +0200)
committerDamjan Marion <dmarion@me.com>
Wed, 5 Feb 2020 09:20:26 +0000 (09:20 +0000)
Type: feature

Representor devices include a port ID as part of their switch_info struct, and
it is helpful to use that in the interface name.

Signed-off-by: Haggai Eran <haggai.eran@gmail.com>
Change-Id: Id24627e7daf857f8b0e8ace2f592c098678081c7

src/plugins/dpdk/device/init.c

index 5d0e5a2..f668d98 100644 (file)
@@ -295,8 +295,14 @@ dpdk_lib_init (dpdk_main_t * dm)
       else
        devconf = &dm->conf->default_devconf;
 
+      /* Handle representor devices that share the same PCI ID */
+      if (dev_info.switch_info.domain_id != RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID)
+        {
+          if (dev_info.switch_info.port_id != (uint16_t)-1)
+            xd->interface_name_suffix = format (0, "%d", dev_info.switch_info.port_id);
+        }
       /* Handle interface naming for devices with multiple ports sharing same PCI ID */
-      if (pci_dev &&
+      else if (pci_dev &&
          ((next_port_id = rte_eth_find_next (i + 1)) != RTE_MAX_ETHPORTS))
        {
          struct rte_eth_dev_info di = { 0 };