dpdk: do not crash when failing to bring interface up 67/32267/2
authorBenoît Ganne <bganne@cisco.com>
Mon, 10 May 2021 12:10:19 +0000 (14:10 +0200)
committerDamjan Marion <dmarion@me.com>
Mon, 10 May 2021 16:49:11 +0000 (16:49 +0000)
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>
src/plugins/dpdk/device/device.c

index 1fdee48..6d130a9 100644 (file)
@@ -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
     {