summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2016-06-08 23:21:35 -0400
committerDamjan Marion <damarion@cisco.com>2016-06-09 13:41:28 +0000
commit55ef1b1f8035b4ade23e5a0c4923ca491a26bdc2 (patch)
treed78430a3f431fc2eb21be4f4c9b6eaa7952fa469 /vnet
parent7becd08c4b641886ad08dedb90be156f305140ee (diff)
Fix DPDK init crash if bonded interface is created by startup conf
Change-Id: I4d7d4a56aba010aa868b1f4c2c4e8db0b4c21fd7 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/init.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 63af5b345a3..6b6f63a7ea8 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -313,14 +313,17 @@ dpdk_lib_init (dpdk_main_t * dm)
struct rte_eth_link l;
dpdk_device_config_t * devconf = 0;
vlib_pci_addr_t pci_addr;
- uword * p;
+ uword * p = 0;
rte_eth_dev_info_get(i, &dev_info);
- pci_addr.domain = dev_info.pci_dev->addr.domain;
- pci_addr.bus = dev_info.pci_dev->addr.bus;
- pci_addr.slot = dev_info.pci_dev->addr.devid;
- pci_addr.function = dev_info.pci_dev->addr.function;
- p = hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
+ if (dev_info.pci_dev) /* bonded interface has no pci info */
+ {
+ pci_addr.domain = dev_info.pci_dev->addr.domain;
+ pci_addr.bus = dev_info.pci_dev->addr.bus;
+ pci_addr.slot = dev_info.pci_dev->addr.devid;
+ pci_addr.function = dev_info.pci_dev->addr.function;
+ p = hash_get (dm->conf->device_config_index_by_pci_addr, pci_addr.as_u32);
+ }
if (p)
devconf = pool_elt_at_index (dm->conf->dev_confs, p[0]);
@@ -371,7 +374,7 @@ dpdk_lib_init (dpdk_main_t * dm)
xd->dev_type = VNET_DPDK_DEV_ETH;
/* workaround for drivers not setting driver_name */
- if (!dev_info.driver_name)
+ if ((!dev_info.driver_name) && (dev_info.pci_dev))
dev_info.driver_name = dev_info.pci_dev->driver->name;
ASSERT(dev_info.driver_name);