Fix DPDK init crash if bonded interface is created by startup conf

Change-Id: I4d7d4a56aba010aa868b1f4c2c4e8db0b4c21fd7
Signed-off-by: John Lo <loj@cisco.com>
This commit is contained in:
John Lo
2016-06-08 23:21:35 -04:00
committed by Damjan Marion
parent 7becd08c4b
commit 55ef1b1f80

View File

@ -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);