interface: remove the pending interrupt from deleting interface

Type: fix

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I3138f97519d216b89a9c46865271db1f9ddd53cd
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 010bc1c..f5493dd 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -785,6 +785,10 @@
 
   /* 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 @@
 
   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);
 
diff --git a/src/vnet/interface/rx_queue.c b/src/vnet/interface/rx_queue.c
index cec0296..736d14d 100644
--- a/src/vnet/interface/rx_queue.c
+++ b/src/vnet/interface/rx_queue.c
@@ -124,7 +124,10 @@
   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 @@
     {
       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]);