dpdk: do not crash when failing to bring interface up
If dpdk device starts failed for some reason, we should not try to get
stats and the interface must remain down.
Type: fix
Change-Id: I0079f89d3b43a9b47553991347da8ed4ce6ede8d
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 1fdee48..6d130a9 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -470,11 +470,15 @@
if (is_up)
{
if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) == 0)
- dpdk_device_start (xd);
- xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
- f64 now = vlib_time_now (dm->vlib_main);
- dpdk_update_counters (xd, now);
- dpdk_update_link_state (xd, now);
+ {
+ dpdk_device_start (xd);
+ if (vec_len (xd->errors))
+ return clib_error_create ("Interface start failed");
+ xd->flags |= DPDK_DEVICE_FLAG_ADMIN_UP;
+ f64 now = vlib_time_now (dm->vlib_main);
+ dpdk_update_counters (xd, now);
+ dpdk_update_link_state (xd, now);
+ }
}
else
{