devices: add support for polling mode

Type: improvement

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I8d84dc8b7f5c5e863c32838cfafc3d366e2a7e00
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 1fc0619..0e522c9 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -504,12 +504,15 @@
 
 done:
 
-  if ((((block_desc_t *) (block_start = rx_queue->rx_ring[block]))
-	 ->hdr.bh1.block_status &
-       TP_STATUS_USER) != 0)
-    vlib_node_set_state (vm, node->node_index, VLIB_NODE_STATE_POLLING);
-  else
-    vlib_node_set_state (vm, node->node_index, VLIB_NODE_STATE_INTERRUPT);
+  if (apm->polling_count == 0)
+    {
+      if ((((block_desc_t *) (block_start = rx_queue->rx_ring[block]))
+	     ->hdr.bh1.block_status &
+	   TP_STATUS_USER) != 0)
+	vlib_node_set_state (vm, node->node_index, VLIB_NODE_STATE_POLLING);
+      else
+	vlib_node_set_state (vm, node->node_index, VLIB_NODE_STATE_INTERRUPT);
+    }
 
   vlib_error_count (vm, node->node_index, AF_PACKET_INPUT_ERROR_TOTAL_RECV_BLK,
 		    total);