From: Benoît Ganne Date: Mon, 10 May 2021 12:10:19 +0000 (+0200) Subject: dpdk: do not crash when failing to bring interface up X-Git-Tag: v21.10-rc0~94 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=e2272ac27c31b8cf7ecf0ff8d4244f90034a09f4;p=vpp.git 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 --- 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 {