interface: refactor interface output node in different processing levels

Type: refactor

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: I4f29e6118630146876b7f58f1afe6b6733401047
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index c4a4b0f..723a322 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -175,8 +175,7 @@
 vnet_interface_output_node_inline (vlib_main_t *vm, u32 sw_if_index,
 				   vlib_combined_counter_main_t *ccm,
 				   vlib_buffer_t **b, u32 config_index, u8 arc,
-				   u32 n_left, int do_tx_offloads,
-				   int arc_or_subif)
+				   u32 n_left, int processing_level)
 {
   u32 n_bytes = 0;
   u32 n_bytes0, n_bytes1, n_bytes2, n_bytes3;
@@ -192,7 +191,7 @@
       vlib_prefetch_buffer_header (b[6], LOAD);
       vlib_prefetch_buffer_header (b[7], LOAD);
 
-      if (do_tx_offloads)
+      if (processing_level >= 1)
 	or_flags = b[0]->flags | b[1]->flags | b[2]->flags | b[3]->flags;
 
       /* Be grumpy about zero length buffers for benefit of
@@ -207,7 +206,7 @@
       n_bytes += n_bytes2 = vlib_buffer_length_in_chain (vm, b[2]);
       n_bytes += n_bytes3 = vlib_buffer_length_in_chain (vm, b[3]);
 
-      if (arc_or_subif)
+      if (processing_level >= 2)
 	{
 	  u32 tx_swif0, tx_swif1, tx_swif2, tx_swif3;
 	  tx_swif0 = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
@@ -241,7 +240,7 @@
 	    }
 	}
 
-      if (do_tx_offloads && (or_flags & VNET_BUFFER_F_OFFLOAD))
+      if (processing_level >= 1 && (or_flags & VNET_BUFFER_F_OFFLOAD))
 	{
 	  vnet_interface_output_handle_offload (vm, b[0]);
 	  vnet_interface_output_handle_offload (vm, b[1]);
@@ -261,7 +260,7 @@
 
       n_bytes += n_bytes0 = vlib_buffer_length_in_chain (vm, b[0]);
 
-      if (arc_or_subif)
+      if (processing_level >= 2)
 	{
 	  u32 tx_swif0 = vnet_buffer (b[0])->sw_if_index[VLIB_TX];
 
@@ -275,7 +274,7 @@
 	    vlib_increment_combined_counter (ccm, ti, tx_swif0, 1, n_bytes0);
 	}
 
-      if (do_tx_offloads)
+      if (processing_level >= 1)
 	vnet_interface_output_handle_offload (vm, b[0]);
 
       n_left -= 1;
@@ -483,16 +482,13 @@
 
   if (do_tx_offloads == 0 && arc_or_subif == 0)
     n_bytes = vnet_interface_output_node_inline (
-      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 0, 0);
-  else if (do_tx_offloads == 0 && arc_or_subif == 1)
-    n_bytes = vnet_interface_output_node_inline (
-      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 0, 1);
+      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 0);
   else if (do_tx_offloads == 1 && arc_or_subif == 0)
     n_bytes = vnet_interface_output_node_inline (
-      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 1, 0);
+      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 1);
   else
     n_bytes = vnet_interface_output_node_inline (
-      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 1, 1);
+      vm, sw_if_index, ccm, bufs, config_index, arc, n_buffers, 2);
 
   from = vlib_frame_vector_args (frame);
   if (PREDICT_TRUE (next_index == VNET_INTERFACE_OUTPUT_NEXT_TX))