Skip to content

Commit

Permalink
Merge "DPDK: fix crash at vifdump if there are no eth devices"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jan 27, 2016
2 parents 20b61c9 + 2358fb6 commit 477f4ac
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion dpdk/vr_dpdk_knidev.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,12 @@ dpdk_knidev_config_network_if(uint8_t port_id, uint8_t if_up)
return ret;
}

/* Init KNI */
/*
* vr_dpdk_knidev_init - initializes Kernel Network Interface device using
* specified Ethernet device port.
*
* Returns 0 on success, < 0 otherwise.
*/
int
vr_dpdk_knidev_init(uint8_t port_id, struct vr_interface *vif)
{
Expand All @@ -533,6 +538,13 @@ vr_dpdk_knidev_init(uint8_t port_id, struct vr_interface *vif)
vr_dpdk.kni_inited = true;
}

/* Check if port is valid. */
if (!rte_eth_dev_is_valid_port(port_id)) {
RTE_LOG(ERR, VROUTER, " error initializing KNI device %s: invalid eth device %"
PRIu8"\n", vif->vif_name, port_id);
return -EINVAL;
}

/* get eth device info */
memset(&dev_info, 0, sizeof(dev_info));
rte_eth_dev_info_get(port_id, &dev_info);
Expand Down

0 comments on commit 477f4ac

Please sign in to comment.