Minor refactoring for fabric.p4

Change-Id: I8c5bac678ead88bda42a0b49ea19d7c968bcc305
diff --git a/pipelines/fabric/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/src/main/resources/include/control/filtering.p4
index 5a93e5b..58bf147 100644
--- a/pipelines/fabric/src/main/resources/include/control/filtering.p4
+++ b/pipelines/fabric/src/main/resources/include/control/filtering.p4
@@ -24,6 +24,8 @@
     inout parsed_headers_t hdr,
     inout fabric_metadata_t fabric_metadata,
     inout standard_metadata_t standard_metadata) {
+    direct_counter(CounterType.packets_and_bytes) ingress_port_vlan_counter;
+    direct_counter(CounterType.packets_and_bytes) fwd_classifier_counter;
 
     action drop() {
         mark_to_drop();
@@ -65,7 +67,9 @@
             nop;
             drop;
         }
-        const default_action = drop();
+
+        const default_action = nop();
+        counters = ingress_port_vlan_counter;
     }
 
     // Originally TMAC table in OF-DPA pipeline
@@ -81,6 +85,7 @@
         }
 
         const default_action = set_forwarding_type(FWD_BRIDGING);
+        counters = fwd_classifier_counter;
     }
 
     apply {
diff --git a/pipelines/fabric/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
index 4e9ada1..fc5f5b3 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -27,6 +27,14 @@
     inout fabric_metadata_t fabric_metadata,
     inout standard_metadata_t standard_metadata) {
 
+    direct_counter(CounterType.packets_and_bytes) bridging_counter;
+    direct_counter(CounterType.packets_and_bytes) mpls_counter;
+    direct_counter(CounterType.packets_and_bytes) unicast_v4_counter;
+    direct_counter(CounterType.packets_and_bytes) multicast_v4_counter;
+    direct_counter(CounterType.packets_and_bytes) unicast_v6_counter;
+    direct_counter(CounterType.packets_and_bytes) multicast_v6_counter;
+    direct_counter(CounterType.packets_and_bytes) acl_counter;
+
     action drop() {
         mark_to_drop();
     }
@@ -53,6 +61,7 @@
         actions = {
             set_next_id;
         }
+        counters = bridging_counter;
     }
 
     table mpls {
@@ -63,6 +72,7 @@
         actions = {
             pop_mpls_and_next;
         }
+        counters = mpls_counter;
     }
 
     table unicast_v4 {
@@ -73,6 +83,7 @@
         actions = {
             set_next_id;
         }
+        counters = unicast_v4_counter;
     }
 
     table multicast_v4 {
@@ -84,6 +95,7 @@
         actions = {
             set_next_id;
         }
+        counters = multicast_v4_counter;
     }
 
     table unicast_v6 {
@@ -94,6 +106,7 @@
         actions = {
             set_next_id;
         }
+        counters = unicast_v6_counter;
     }
 
     table multicast_v6 {
@@ -105,6 +118,7 @@
         actions = {
             set_next_id;
         }
+        counters = multicast_v6_counter;
     }
 
     table acl {
@@ -133,6 +147,7 @@
 
         const default_action = nop();
         size = 256;
+        counters = acl_counter;
     }
 
     apply {
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index a58e88e..79ac55b 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -25,6 +25,9 @@
     inout fabric_metadata_t fabric_metadata,
     inout standard_metadata_t standard_metadata) {
     action_selector(HashAlgorithm.crc16, 32w64, 32w16) ecmp_selector;
+    direct_counter(CounterType.packets_and_bytes) simple_counter;
+    direct_counter(CounterType.packets_and_bytes) hashed_counter;
+    direct_counter(CounterType.packets_and_bytes) broadcast_counter;
 
     action output(port_num_t port_num) {
         standard_metadata.egress_spec = port_num;
@@ -92,7 +95,9 @@
             output;
             set_vlan_output;
             l3_routing;
+            mpls_routing_v4;
         }
+        counters = simple_counter;
     }
 
     table hashed {
@@ -112,6 +117,7 @@
         }
 
         implementation = ecmp_selector;
+        counters = hashed_counter;
     }
 
     /*
@@ -124,6 +130,7 @@
         actions = {
             set_mcast_group;
         }
+        counters = broadcast_counter;
     }
 
     apply {