summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-05-10 14:10:19 +0200
committerDamjan Marion <dmarion@me.com>2021-05-10 16:49:11 +0000
commite2272ac27c31b8cf7ecf0ff8d4244f90034a09f4 (patch)
treebfaad175cf12991a67a6cab441d43d1c7742ae84
parent028c9fda3cab8460dfe62472e99f5b79ef4a6115 (diff)
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>
-rw-r--r--src/plugins/dpdk/device/device.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 1fdee48c1e8..6d130a95e9c 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -470,11 +470,15 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
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
{