Detailed stats collection feature

Use device-input and interface-output feautre arcs to collect unicast, multicast
and broadcast states for RX and TX resp. Since these feature arcs are present only
for 'physical' interfaces (i.e. not su-interfaces) counter collection is supported
only on parent interface types.

Change-Id: I915c235e336b0fc3a3c3de918f95dd674e4e0e4e
Signed-off-by: Neale Ranns <nranns@cisco.com>
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 62fdc60..00a7353 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -633,25 +633,25 @@
   VNET_N_SIMPLE_INTERFACE_COUNTER = 9,
   /* Combined counters. */
   VNET_INTERFACE_COUNTER_RX = 0,
-  VNET_INTERFACE_COUNTER_TX = 1,
-  VNET_INTERFACE_COUNTER_RX_UNICAST = 2,
-  VNET_INTERFACE_COUNTER_TX_UNICAST = 3,
-  VNET_INTERFACE_COUNTER_RX_MULTICAST = 4,
-  VNET_INTERFACE_COUNTER_TX_MULTICAST = 5,
-  VNET_INTERFACE_COUNTER_RX_BROADCAST = 6,
+  VNET_INTERFACE_COUNTER_RX_UNICAST = 1,
+  VNET_INTERFACE_COUNTER_RX_MULTICAST = 2,
+  VNET_INTERFACE_COUNTER_RX_BROADCAST = 3,
+  VNET_INTERFACE_COUNTER_TX = 4,
+  VNET_INTERFACE_COUNTER_TX_UNICAST = 5,
+  VNET_INTERFACE_COUNTER_TX_MULTICAST = 6,
   VNET_INTERFACE_COUNTER_TX_BROADCAST = 7,
   VNET_N_COMBINED_INTERFACE_COUNTER = 8,
 } vnet_interface_counter_type_t;
 
-#define foreach_combined_interface_counter(X)                  \
-  X(VNET_INTERFACE_COUNTER_RX, rx)                             \
-  X(VNET_INTERFACE_COUNTER_TX, tx)                             \
-  X(VNET_INTERFACE_COUNTER_RX_UNICAST, rx_unicast)             \
-  X(VNET_INTERFACE_COUNTER_TX_UNICAST, tx_unicast)             \
-  X(VNET_INTERFACE_COUNTER_RX_MULTICAST, rx_multicast)         \
-  X(VNET_INTERFACE_COUNTER_TX_MULTICAST, tx_multicast)         \
-  X(VNET_INTERFACE_COUNTER_RX_BROADCAST, rx_broadcast)         \
-  X(VNET_INTERFACE_COUNTER_TX_BROADCAST, tx_broadcast)
+#define foreach_rx_combined_interface_counter(_x)               \
+  for (_x = VNET_INTERFACE_COUNTER_RX;                          \
+       _x <= VNET_INTERFACE_COUNTER_RX_BROADCAST;               \
+       _x++)
+
+#define foreach_tx_combined_interface_counter(_x)               \
+  for (_x = VNET_INTERFACE_COUNTER_TX;                          \
+       _x <= VNET_INTERFACE_COUNTER_TX_BROADCAST;               \
+       _x++)
 
 typedef enum
 {