interface: remove the pending interrupt from deleting interface 74/37674/3
authorMohsin Kazmi <sykazmi@cisco.com>
Thu, 17 Nov 2022 14:04:49 +0000 (14:04 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Fri, 25 Nov 2022 12:43:40 +0000 (12:43 +0000)
Type: fix

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I3138f97519d216b89a9c46865271db1f9ddd53cd

src/vnet/devices/af_packet/af_packet.c
src/vnet/interface/rx_queue.c

index 010bc1c..f5493dd 100644 (file)
@@ -785,6 +785,10 @@ af_packet_delete_if (u8 *host_if_name)
 
   /* bring down the interface */
   vnet_hw_interface_set_flags (vnm, apif->hw_if_index, 0);
+  if (apif->mode != AF_PACKET_IF_MODE_IP)
+    ethernet_delete_interface (vnm, apif->hw_if_index);
+  else
+    vnet_delete_hw_interface (vnm, apif->hw_if_index);
 
   /* clean up */
   vec_foreach (rx_queue, apif->rx_queues)
@@ -807,11 +811,6 @@ af_packet_delete_if (u8 *host_if_name)
 
   mhash_unset (&apm->if_index_by_host_if_name, host_if_name, p);
 
-  if (apif->mode != AF_PACKET_IF_MODE_IP)
-    ethernet_delete_interface (vnm, apif->hw_if_index);
-  else
-    vnet_delete_hw_interface (vnm, apif->hw_if_index);
-
   memset (apif, 0, sizeof (*apif));
   pool_put (apm->interfaces, apif);
 
index cec0296..736d14d 100644 (file)
@@ -124,7 +124,10 @@ vnet_hw_if_unregister_all_rx_queues (vnet_main_t *vnm, u32 hw_if_index)
   vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, hw_if_index);
   vnet_interface_main_t *im = &vnm->interface_main;
   vnet_hw_if_rx_queue_t *rxq;
+  vlib_main_t *vm;
+  vnet_hw_if_rx_node_runtime_t *rt;
   u64 key;
+  u32 queue_index;
 
   log_debug ("unregister_all: interface %v", hi->name);
 
@@ -132,6 +135,15 @@ vnet_hw_if_unregister_all_rx_queues (vnet_main_t *vnm, u32 hw_if_index)
     {
       rxq = vnet_hw_if_get_rx_queue (vnm, hi->rx_queue_indices[i]);
       key = rx_queue_key (rxq->hw_if_index, rxq->queue_id);
+      if (PREDICT_FALSE (rxq->mode == VNET_HW_IF_RX_MODE_INTERRUPT ||
+                        rxq->mode == VNET_HW_IF_RX_MODE_ADAPTIVE))
+       {
+         vm = vlib_get_main_by_index (rxq->thread_index);
+         queue_index = vnet_hw_if_get_rx_queue_index_by_id (vnm, hw_if_index,
+                                                            rxq->queue_id);
+         rt = vlib_node_get_runtime_data (vm, hi->input_node_index);
+         clib_interrupt_clear (rt->rxq_interrupts, queue_index);
+       }
       hash_unset_mem_free (&im->rxq_index_by_hw_if_index_and_queue_id, &key);
 
       pool_put_index (im->hw_if_rx_queues, hi->rx_queue_indices[i]);