Minor refactoring for fabric.p4

Change-Id: I736b20fc95b4a03afa1074eb777a23507530b44f
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
index dca2182..c37ffac 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricConstants.java
@@ -35,10 +35,8 @@
     public static final String DOT = ".";
     // Header IDs
     public static final String HDR = "hdr";
-    public static final String UDP = "udp";
     public static final String STANDARD_METADATA = "standard_metadata";
     public static final String MPLS = "mpls";
-    public static final String TCP = "tcp";
     public static final String FABRIC_METADATA = "fabric_metadata";
     public static final String IPV4 = "ipv4";
     public static final String IPV6 = "ipv6";
@@ -47,33 +45,30 @@
     public static final String ICMP = "icmp";
 
     // Header field IDs
+    public static final PiMatchFieldId HF_FABRIC_METADATA_L4_SRC_PORT_ID =
+            buildPiMatchField(FABRIC_METADATA, "l4_src_port", false);
+    public static final PiMatchFieldId HF_MPLS_BOS_ID = buildPiMatchField(MPLS, "bos", true);
+    public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID = buildPiMatchField(IPV4, "src_addr", true);
     public static final PiMatchFieldId HF_VLAN_TAG_VLAN_ID_ID = buildPiMatchField(VLAN_TAG, "vlan_id", true);
     public static final PiMatchFieldId HF_MPLS_LABEL_ID = buildPiMatchField(MPLS, "label", true);
-    public static final PiMatchFieldId HF_STANDARD_METADATA_INGRESS_PORT_ID =
-            buildPiMatchField(STANDARD_METADATA, "ingress_port", false);
-    public static final PiMatchFieldId HF_UDP_SRC_PORT_ID = buildPiMatchField(UDP, "src_port", true);
-    public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID = buildPiMatchField(VLAN_TAG, "is_valid", true);
-    public static final PiMatchFieldId HF_IPV6_NEXT_HDR_ID = buildPiMatchField(IPV6, "next_hdr", true);
+    public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID = buildPiMatchField(IPV6, "dst_addr", true);
     public static final PiMatchFieldId HF_ETHERNET_SRC_ADDR_ID = buildPiMatchField(ETHERNET, "src_addr", true);
     public static final PiMatchFieldId HF_ICMP_ICMP_TYPE_ID = buildPiMatchField(ICMP, "icmp_type", true);
-    public static final PiMatchFieldId HF_MPLS_TC_ID = buildPiMatchField(MPLS, "tc", true);
-    public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID = buildPiMatchField(IPV4, "dst_addr", true);
-    public static final PiMatchFieldId HF_VLAN_TAG_PRI_ID = buildPiMatchField(VLAN_TAG, "pri", true);
-    public static final PiMatchFieldId HF_TCP_SRC_PORT_ID = buildPiMatchField(TCP, "src_port", true);
-    public static final PiMatchFieldId HF_ETHERNET_ETHER_TYPE_ID = buildPiMatchField(ETHERNET, "ether_type", true);
-    public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID = buildPiMatchField(ICMP, "icmp_code", true);
-    public static final PiMatchFieldId HF_MPLS_BOS_ID = buildPiMatchField(MPLS, "bos", true);
-    public static final PiMatchFieldId HF_FABRIC_METADATA_IP_PROTO_ID =
-            buildPiMatchField(FABRIC_METADATA, "ip_proto", false);
+    public static final PiMatchFieldId HF_IPV6_SRC_ADDR_ID = buildPiMatchField(IPV6, "src_addr", true);
     public static final PiMatchFieldId HF_FABRIC_METADATA_NEXT_ID_ID =
             buildPiMatchField(FABRIC_METADATA, "next_id", false);
-    public static final PiMatchFieldId HF_UDP_DST_PORT_ID = buildPiMatchField(UDP, "dst_port", true);
-    public static final PiMatchFieldId HF_IPV4_PROTOCOL_ID = buildPiMatchField(IPV4, "protocol", true);
-    public static final PiMatchFieldId HF_IPV4_SRC_ADDR_ID = buildPiMatchField(IPV4, "src_addr", true);
-    public static final PiMatchFieldId HF_IPV6_SRC_ADDR_ID = buildPiMatchField(IPV6, "src_addr", true);
-    public static final PiMatchFieldId HF_IPV6_DST_ADDR_ID = buildPiMatchField(IPV6, "dst_addr", true);
-    public static final PiMatchFieldId HF_TCP_DST_PORT_ID = buildPiMatchField(TCP, "dst_port", true);
+    public static final PiMatchFieldId HF_FABRIC_METADATA_L4_DST_PORT_ID =
+            buildPiMatchField(FABRIC_METADATA, "l4_dst_port", false);
+    public static final PiMatchFieldId HF_STANDARD_METADATA_INGRESS_PORT_ID =
+            buildPiMatchField(STANDARD_METADATA, "ingress_port", false);
+    public static final PiMatchFieldId HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID =
+            buildPiMatchField(FABRIC_METADATA, "original_ether_type", false);
+    public static final PiMatchFieldId HF_IPV4_DST_ADDR_ID = buildPiMatchField(IPV4, "dst_addr", true);
+    public static final PiMatchFieldId HF_VLAN_TAG_IS_VALID_ID = buildPiMatchField(VLAN_TAG, "is_valid", true);
+    public static final PiMatchFieldId HF_FABRIC_METADATA_IP_PROTO_ID =
+            buildPiMatchField(FABRIC_METADATA, "ip_proto", false);
     public static final PiMatchFieldId HF_ETHERNET_DST_ADDR_ID = buildPiMatchField(ETHERNET, "dst_addr", true);
+    public static final PiMatchFieldId HF_ICMP_ICMP_CODE_ID = buildPiMatchField(ICMP, "icmp_code", true);
 
     private static PiMatchFieldId buildPiMatchField(String header, String field, boolean withHdrPrefix) {
         if (withHdrPrefix) {
@@ -104,36 +99,24 @@
             PiCounterId.of("port_counters_control.ingress_port_counter");
 
     // Direct Counter IDs
-    public static final PiCounterId CNT_MULTICAST_V6_COUNTER_ID = PiCounterId.of("forwarding.multicast_v6_counter");
-    public static final PiCounterId CNT_ACL_COUNTER_ID = PiCounterId.of("forwarding.acl_counter");
-    public static final PiCounterId CNT_UNICAST_V4_COUNTER_ID = PiCounterId.of("forwarding.unicast_v4_counter");
-    public static final PiCounterId CNT_INGRESS_PORT_VLAN_COUNTER_ID =
-            PiCounterId.of("filtering.ingress_port_vlan_counter");
-    public static final PiCounterId CNT_FWD_CLASSIFIER_COUNTER_ID = PiCounterId.of("filtering.fwd_classifier_counter");
-    public static final PiCounterId CNT_UNICAST_V6_COUNTER_ID = PiCounterId.of("forwarding.unicast_v6_counter");
-    public static final PiCounterId CNT_BRIDGING_COUNTER_ID = PiCounterId.of("forwarding.bridging_counter");
-    public static final PiCounterId CNT_SIMPLE_COUNTER_ID = PiCounterId.of("next.simple_counter");
-    public static final PiCounterId CNT_HASHED_COUNTER_ID = PiCounterId.of("next.hashed_counter");
-    public static final PiCounterId CNT_BROADCAST_COUNTER_ID = PiCounterId.of("next.broadcast_counter");
-    public static final PiCounterId CNT_MULTICAST_V4_COUNTER_ID = PiCounterId.of("forwarding.multicast_v4_counter");
-    public static final PiCounterId CNT_MPLS_COUNTER_ID = PiCounterId.of("forwarding.mpls_counter");
 
     // Action IDs
     public static final PiActionId ACT_SET_MCAST_GROUP_ID = PiActionId.of("next.set_mcast_group");
-    public static final PiActionId ACT_DROP_ID = PiActionId.of("drop");
+    public static final PiActionId ACT_DUPLICATE_TO_CONTROLLER_ID = PiActionId.of("forwarding.duplicate_to_controller");
+    public static final PiActionId ACT_MPLS_ROUTING_V4_ID = PiActionId.of("next.mpls_routing_v4");
     public static final PiActionId ACT_PUSH_INTERNAL_VLAN_ID = PiActionId.of("filtering.push_internal_vlan");
     public static final PiActionId ACT_SET_VLAN_OUTPUT_ID = PiActionId.of("next.set_vlan_output");
     public static final PiActionId ACT_NOACTION_ID = PiActionId.of("NoAction");
-    public static final PiActionId ACT_MPLS_ROUTING_V4_ID = PiActionId.of("next.mpls_routing_v4");
+    public static final PiActionId ACT_FILTERING_DROP_ID = PiActionId.of("filtering.drop");
     public static final PiActionId ACT_MPLS_ROUTING_V6_ID = PiActionId.of("next.mpls_routing_v6");
     public static final PiActionId ACT_SET_FORWARDING_TYPE_ID = PiActionId.of("filtering.set_forwarding_type");
-    public static final PiActionId ACT_POP_MPLS_AND_NEXT_ID = PiActionId.of("forwarding.pop_mpls_and_next");
+    public static final PiActionId ACT_FORWARDING_DROP_ID = PiActionId.of("forwarding.drop");
     public static final PiActionId ACT_L3_ROUTING_ID = PiActionId.of("next.l3_routing");
     public static final PiActionId ACT_OUTPUT_ID = PiActionId.of("next.output");
     public static final PiActionId ACT_NOP_ID = PiActionId.of("nop");
     public static final PiActionId ACT_SET_NEXT_ID_ID = PiActionId.of("forwarding.set_next_id");
     public static final PiActionId ACT_SET_VLAN_ID = PiActionId.of("filtering.set_vlan");
-    public static final PiActionId ACT_DUPLICATE_TO_CONTROLLER_ID = PiActionId.of("forwarding.duplicate_to_controller");
+    public static final PiActionId ACT_POP_MPLS_AND_NEXT_ID = PiActionId.of("forwarding.pop_mpls_and_next");
 
     // Action Param IDs
     public static final PiActionParamId ACT_PRM_DMAC_ID = PiActionParamId.of("dmac");
@@ -149,8 +132,8 @@
     public static final PiActionProfileId ACT_PRF_NEXT_ECMP_SELECTOR_ID = PiActionProfileId.of("next.ecmp_selector");
 
     // Packet Metadata IDs
-    public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port");
     public static final PiControlMetadataId CTRL_META_INGRESS_PORT_ID = PiControlMetadataId.of("ingress_port");
+    public static final PiControlMetadataId CTRL_META_EGRESS_PORT_ID = PiControlMetadataId.of("egress_port");
 
     public static final int PORT_BITWIDTH = 9;
 }
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
index 69a686e..aa3a99a 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/FabricInterpreter.java
@@ -18,6 +18,7 @@
 
 import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import org.onlab.packet.DeserializationException;
 import org.onlab.packet.Ethernet;
@@ -95,43 +96,52 @@
 
     private static final ImmutableBiMap<PiTableId, PiCounterId> TABLE_COUNTER_MAP =
             ImmutableBiMap.<PiTableId, PiCounterId>builder()
-                    .put(FabricConstants.TBL_MULTICAST_V4_ID, FabricConstants.CNT_MULTICAST_V4_COUNTER_ID)
-                    .put(FabricConstants.TBL_MULTICAST_V6_ID, FabricConstants.CNT_MULTICAST_V6_COUNTER_ID)
-                    .put(FabricConstants.TBL_FWD_CLASSIFIER_ID, FabricConstants.CNT_FWD_CLASSIFIER_COUNTER_ID)
-                    .put(FabricConstants.TBL_ACL_ID, FabricConstants.CNT_ACL_COUNTER_ID)
-                    .put(FabricConstants.TBL_BROADCAST_ID, FabricConstants.CNT_BROADCAST_COUNTER_ID)
-                    .put(FabricConstants.TBL_HASHED_ID, FabricConstants.CNT_HASHED_COUNTER_ID)
-                    .put(FabricConstants.TBL_INGRESS_PORT_VLAN_ID, FabricConstants.CNT_INGRESS_PORT_VLAN_COUNTER_ID)
-                    .put(FabricConstants.TBL_UNICAST_V6_ID, FabricConstants.CNT_UNICAST_V6_COUNTER_ID)
-                    .put(FabricConstants.TBL_SIMPLE_ID, FabricConstants.CNT_SIMPLE_COUNTER_ID)
-                    .put(FabricConstants.TBL_BRIDGING_ID, FabricConstants.CNT_BRIDGING_COUNTER_ID)
-                    .put(FabricConstants.TBL_UNICAST_V4_ID, FabricConstants.CNT_UNICAST_V4_COUNTER_ID)
-                    .put(FabricConstants.TBL_MPLS_ID, FabricConstants.CNT_MPLS_COUNTER_ID)
                     .build();
-    private static final ImmutableBiMap<Criterion.Type, PiMatchFieldId> CRITERION_MAP =
-            ImmutableBiMap.<Criterion.Type, PiMatchFieldId>builder()
+    private static final ImmutableMap<Criterion.Type, PiMatchFieldId> CRITERION_MAP =
+            ImmutableMap.<Criterion.Type, PiMatchFieldId>builder()
                     .put(Criterion.Type.IN_PORT, FabricConstants.HF_STANDARD_METADATA_INGRESS_PORT_ID)
                     .put(Criterion.Type.ETH_DST, FabricConstants.HF_ETHERNET_DST_ADDR_ID)
                     .put(Criterion.Type.ETH_SRC, FabricConstants.HF_ETHERNET_SRC_ADDR_ID)
-                    .put(Criterion.Type.ETH_TYPE, FabricConstants.HF_ETHERNET_ETHER_TYPE_ID)
+                    .put(Criterion.Type.ETH_TYPE, FabricConstants.HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID)
                     .put(Criterion.Type.MPLS_BOS, FabricConstants.HF_MPLS_BOS_ID)
                     .put(Criterion.Type.MPLS_LABEL, FabricConstants.HF_MPLS_LABEL_ID)
-                    .put(Criterion.Type.MPLS_TC, FabricConstants.HF_MPLS_TC_ID)
                     .put(Criterion.Type.VLAN_VID, FabricConstants.HF_VLAN_TAG_VLAN_ID_ID)
-                    .put(Criterion.Type.VLAN_PCP, FabricConstants.HF_VLAN_TAG_PRI_ID)
                     .put(Criterion.Type.IPV4_DST, FabricConstants.HF_IPV4_DST_ADDR_ID)
                     .put(Criterion.Type.IPV4_SRC, FabricConstants.HF_IPV4_SRC_ADDR_ID)
                     .put(Criterion.Type.IPV6_DST, FabricConstants.HF_IPV6_DST_ADDR_ID)
                     .put(Criterion.Type.IPV6_SRC, FabricConstants.HF_IPV6_SRC_ADDR_ID)
-                    .put(Criterion.Type.TCP_SRC, FabricConstants.HF_TCP_SRC_PORT_ID)
-                    .put(Criterion.Type.TCP_DST, FabricConstants.HF_TCP_DST_PORT_ID)
-                    .put(Criterion.Type.UDP_SRC, FabricConstants.HF_UDP_SRC_PORT_ID)
-                    .put(Criterion.Type.UDP_DST, FabricConstants.HF_UDP_DST_PORT_ID)
+                    .put(Criterion.Type.TCP_SRC, FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID)
+                    .put(Criterion.Type.TCP_DST, FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID)
+                    .put(Criterion.Type.UDP_SRC, FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID)
+                    .put(Criterion.Type.UDP_DST, FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID)
                     .put(Criterion.Type.IP_PROTO, FabricConstants.HF_FABRIC_METADATA_IP_PROTO_ID)
                     .put(Criterion.Type.ICMPV6_TYPE, FabricConstants.HF_ICMP_ICMP_TYPE_ID)
                     .put(Criterion.Type.ICMPV6_CODE, FabricConstants.HF_ICMP_ICMP_CODE_ID)
                     .build();
 
+    private static final ImmutableMap<PiMatchFieldId, Criterion.Type> INVERSE_CRITERION_MAP =
+            ImmutableMap.<PiMatchFieldId, Criterion.Type>builder()
+                    .put(FabricConstants.HF_STANDARD_METADATA_INGRESS_PORT_ID, Criterion.Type.IN_PORT)
+                    .put(FabricConstants.HF_ETHERNET_DST_ADDR_ID, Criterion.Type.ETH_DST)
+                    .put(FabricConstants.HF_ETHERNET_SRC_ADDR_ID, Criterion.Type.ETH_SRC)
+                    .put(FabricConstants.HF_FABRIC_METADATA_ORIGINAL_ETHER_TYPE_ID, Criterion.Type.ETH_TYPE)
+                    .put(FabricConstants.HF_MPLS_BOS_ID, Criterion.Type.MPLS_BOS)
+                    .put(FabricConstants.HF_MPLS_LABEL_ID, Criterion.Type.MPLS_LABEL)
+                    .put(FabricConstants.HF_VLAN_TAG_VLAN_ID_ID, Criterion.Type.VLAN_VID)
+                    .put(FabricConstants.HF_IPV4_DST_ADDR_ID, Criterion.Type.IPV4_DST)
+                    .put(FabricConstants.HF_IPV4_SRC_ADDR_ID, Criterion.Type.IPV4_SRC)
+                    .put(FabricConstants.HF_IPV6_DST_ADDR_ID, Criterion.Type.IPV6_DST)
+                    .put(FabricConstants.HF_IPV6_SRC_ADDR_ID, Criterion.Type.IPV6_SRC)
+                    // FIXME: might be incorrect if we inverse the map....
+                    .put(FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID, Criterion.Type.UDP_SRC)
+                    .put(FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID, Criterion.Type.UDP_DST)
+//                    .put(FabricConstants.HF_FABRIC_METADATA_L4_SRC_PORT_ID, Criterion.Type.TCP_SRC)
+//                    .put(FabricConstants.HF_FABRIC_METADATA_L4_DST_PORT_ID, Criterion.Type.TCP_DST)
+                    .put(FabricConstants.HF_FABRIC_METADATA_IP_PROTO_ID, Criterion.Type.IP_PROTO)
+                    .put(FabricConstants.HF_ICMP_ICMP_TYPE_ID, Criterion.Type.ICMPV6_TYPE)
+                    .put(FabricConstants.HF_ICMP_ICMP_CODE_ID, Criterion.Type.ICMPV6_CODE)
+                    .build();
+
     @Override
     public Optional<PiMatchFieldId> mapCriterionType(Criterion.Type type) {
         return Optional.ofNullable(CRITERION_MAP.get(type));
@@ -139,7 +149,7 @@
 
     @Override
     public Optional<Criterion.Type> mapPiMatchFieldId(PiMatchFieldId fieldId) {
-        return Optional.ofNullable(CRITERION_MAP.inverse().get(fieldId));
+        return Optional.ofNullable(INVERSE_CRITERION_MAP.get(fieldId));
     }
 
     @Override
diff --git a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
index 3fceb5d..eac586a 100644
--- a/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
+++ b/pipelines/fabric/src/main/java/org/onosproject/pipelines/fabric/pipeliner/FabricPipeliner.java
@@ -197,8 +197,8 @@
                 .thenApplyAsync(groupSuccess -> groupSuccess && installFlows(objective, flowRules))
                 .thenAcceptAsync(callback)
                 .exceptionally((ex) -> {
-                    log.warn("Got unexpected exception while applying translation result {}",
-                             result);
+                    log.warn("Got unexpected exception while applying translation result {}: {}",
+                             result, ex);
                     fail(objective, ObjectiveError.UNKNOWN);
                     return null;
                 });
diff --git a/pipelines/fabric/src/main/resources/Makefile b/pipelines/fabric/src/main/resources/Makefile
index 4ff94e0..f11de1b 100644
--- a/pipelines/fabric/src/main/resources/Makefile
+++ b/pipelines/fabric/src/main/resources/Makefile
@@ -1,10 +1,22 @@
-all: fabric.json
+BMV2_CPU_PORT=255
 
-fabric.json: fabric.p4
-	p4c-bm2-ss -o p4c-out/bmv2/fabric.json \
-	--p4runtime-file p4c-out/bmv2/fabric.p4info --p4runtime-format text \
-	fabric.p4
+BMV2_OPTIONS=-DTARGET_BMV2
+
+all: bmv2
+
+bmv2:
+	p4c -v -x p4-16 -b bmv2-ss-p4org \
+	$(BMV2_OPTIONS) -o p4c-out/bmv2 \
+	--p4runtime-file p4c-out/bmv2/fabric.p4info \
+	--p4runtime-format text fabric.p4
+	mv p4c-out/bmv2/fabric.p4rt p4c-out/bmv2/fabric.p4info
+	rm -f p4c-out/bmv2/fabric.p4i
+
+custom:
+	p4c -v -x p4-16 -b $(BACKEND) \
+		$(BACKEND_OPTIONS) -o p4c-out/$(BACKEND) \
+		--p4runtime-file p4c-out/$(BACKEND)/fabric.p4info \
+		--p4runtime-format text fabric.p4
 
 clean:
-	rm -rf p4c-out/bmv2/*.json
-	rm -rf p4c-out/bmv2/*.p4info
+	rm -rf p4c-out/*
diff --git a/pipelines/fabric/src/main/resources/fabric.p4 b/pipelines/fabric/src/main/resources/fabric.p4
index e417e4b..d27ed87 100644
--- a/pipelines/fabric/src/main/resources/fabric.p4
+++ b/pipelines/fabric/src/main/resources/fabric.p4
@@ -48,11 +48,11 @@
 control FabricEgress (inout parsed_headers_t hdr,
                       inout fabric_metadata_t fabric_metadata,
                       inout standard_metadata_t standard_metadata) {
-    PacketIoEgress() pktIoEgress;
+    PacketIoEgress() pkt_io_egress;
     EgressNextControl() egress_next;
     apply {
         egress_next.apply(hdr, fabric_metadata, standard_metadata);
-        pktIoEgress.apply(hdr, fabric_metadata, standard_metadata);
+        pkt_io_egress.apply(hdr, fabric_metadata, standard_metadata);
     }
 }
 
diff --git a/pipelines/fabric/src/main/resources/include/action.p4 b/pipelines/fabric/src/main/resources/include/action.p4
index c76334a..3ce1f0d 100644
--- a/pipelines/fabric/src/main/resources/include/action.p4
+++ b/pipelines/fabric/src/main/resources/include/action.p4
@@ -17,12 +17,6 @@
 #ifndef __ACTION__
 #define __ACTION__
 #include "header.p4"
-
 action nop() {
 }
-
-action drop() {
-    mark_to_drop();
-}
-
 #endif
diff --git a/pipelines/fabric/src/main/resources/include/checksum.p4 b/pipelines/fabric/src/main/resources/include/checksum.p4
index 00b4e70..dfcadb6 100644
--- a/pipelines/fabric/src/main/resources/include/checksum.p4
+++ b/pipelines/fabric/src/main/resources/include/checksum.p4
@@ -21,6 +21,7 @@
                               inout fabric_metadata_t meta)
 {
     apply {
+#ifdef TARGET_BMV2
         update_checksum(hdr.ipv4.isValid(),
             {
                 hdr.ipv4.version,
@@ -38,6 +39,7 @@
             hdr.ipv4.hdr_checksum,
             HashAlgorithm.csum16
         );
+#endif
     }
 }
 
@@ -45,6 +47,7 @@
                              inout fabric_metadata_t meta)
 {
     apply {
+#ifdef TARGET_BMV2
         verify_checksum(hdr.ipv4.isValid(),
             {
                 hdr.ipv4.version,
@@ -62,6 +65,7 @@
             hdr.ipv4.hdr_checksum,
             HashAlgorithm.csum16
         );
+#endif
     }
 }
 
diff --git a/pipelines/fabric/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/src/main/resources/include/control/filtering.p4
index a66657f..5a93e5b 100644
--- a/pipelines/fabric/src/main/resources/include/control/filtering.p4
+++ b/pipelines/fabric/src/main/resources/include/control/filtering.p4
@@ -25,8 +25,9 @@
     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();
+    }
 
     action set_vlan(vlan_id_t new_vlan_id) {
         hdr.vlan_tag.vlan_id = new_vlan_id;
@@ -38,7 +39,8 @@
         hdr.vlan_tag.setValid();
         hdr.vlan_tag.cfi = 0;
         hdr.vlan_tag.pri = 0;
-        hdr.vlan_tag.ether_type = ETHERTYPE_VLAN;
+        hdr.vlan_tag.ether_type = hdr.ethernet.ether_type;
+        hdr.ethernet.ether_type = ETHERTYPE_VLAN;
         set_vlan(new_vlan_id);
 
         // pop internal vlan before output
@@ -64,7 +66,6 @@
             drop;
         }
         const default_action = drop();
-        counters = ingress_port_vlan_counter;
     }
 
     // Originally TMAC table in OF-DPA pipeline
@@ -72,7 +73,7 @@
         key = {
             standard_metadata.ingress_port: exact;
             hdr.ethernet.dst_addr: exact;
-            hdr.ethernet.ether_type: exact;
+            fabric_metadata.original_ether_type: exact;
         }
 
         actions = {
@@ -80,7 +81,6 @@
         }
 
         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 5015e58..055f77b 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -27,13 +27,9 @@
     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();
+    }
 
     action set_next_id(next_id_t next_id) {
         fabric_metadata.next_id = next_id;
@@ -41,11 +37,6 @@
 
     action pop_mpls_and_next(next_id_t next_id) {
         hdr.mpls.setInvalid();
-        if (hdr.ipv4.isValid()) {
-            hdr.ethernet.ether_type = ETHERTYPE_IPV4;
-        } else {
-            hdr.ethernet.ether_type = ETHERTYPE_IPV6;
-        }
         fabric_metadata.next_id = next_id;
     }
 
@@ -62,7 +53,6 @@
         actions = {
             set_next_id;
         }
-        counters = bridging_counter;
     }
 
     table mpls {
@@ -73,7 +63,6 @@
         actions = {
             pop_mpls_and_next;
         }
-        counters = mpls_counter;
     }
 
     table unicast_v4 {
@@ -84,7 +73,6 @@
         actions = {
             set_next_id;
         }
-        counters = unicast_v4_counter;
     }
 
     table multicast_v4 {
@@ -96,7 +84,6 @@
         actions = {
             set_next_id;
         }
-        counters = multicast_v4_counter;
     }
 
     table unicast_v6 {
@@ -107,7 +94,6 @@
         actions = {
             set_next_id;
         }
-        counters = unicast_v6_counter;
     }
 
     table multicast_v6 {
@@ -119,33 +105,27 @@
         actions = {
             set_next_id;
         }
-        counters = multicast_v6_counter;
     }
 
     table acl {
         key = {
-            standard_metadata.ingress_port: ternary;
-            fabric_metadata.ip_proto: ternary;
-            hdr.ethernet.dst_addr: ternary;
-            hdr.ethernet.src_addr: ternary;
-            hdr.ethernet.ether_type: ternary;
-            hdr.vlan_tag.vlan_id: ternary;
-            hdr.vlan_tag.pri: ternary;
-            hdr.mpls.tc: ternary;
-            hdr.mpls.bos: ternary;
-            hdr.mpls.label: ternary;
-            hdr.ipv4.src_addr: ternary;
-            hdr.ipv4.dst_addr: ternary;
-            hdr.ipv4.protocol: ternary;
-            hdr.ipv6.src_addr: ternary;
-            hdr.ipv6.dst_addr: ternary;
-            hdr.ipv6.next_hdr: ternary;
-            hdr.tcp.src_port: ternary;
-            hdr.tcp.dst_port: ternary;
-            hdr.udp.src_port: ternary;
-            hdr.udp.dst_port: ternary;
-            hdr.icmp.icmp_type: ternary;
-            hdr.icmp.icmp_code: ternary;
+            standard_metadata.ingress_port: ternary; // 9
+            fabric_metadata.ip_proto: ternary; // 8
+            fabric_metadata.l4_src_port: ternary; // 16
+            fabric_metadata.l4_dst_port: ternary; // 16
+
+            hdr.ethernet.dst_addr: ternary; // 48
+            hdr.ethernet.src_addr: ternary; // 48
+            fabric_metadata.original_ether_type: ternary; //16
+            hdr.vlan_tag.vlan_id: ternary; // 12
+            hdr.mpls.bos: ternary; // 1
+            hdr.mpls.label: ternary; // 20
+            hdr.ipv4.src_addr: ternary; // 32
+            hdr.ipv4.dst_addr: ternary; // 32
+            hdr.ipv6.src_addr: ternary; // 128
+            hdr.ipv6.dst_addr: ternary; // 128
+            hdr.icmp.icmp_type: ternary; // 8
+            hdr.icmp.icmp_code: ternary; // 8
         }
 
         actions = {
@@ -156,12 +136,21 @@
         }
 
         const default_action = nop();
-        counters = acl_counter;
+        size = 256;
     }
 
     apply {
         if(fabric_metadata.fwd_type == FWD_BRIDGING) bridging.apply();
-        else if (fabric_metadata.fwd_type == FWD_MPLS) mpls.apply();
+        else if (fabric_metadata.fwd_type == FWD_MPLS) {
+            mpls.apply();
+            if (hdr.ipv4.isValid()) {
+                hdr.ethernet.ether_type = ETHERTYPE_IPV4;
+                fabric_metadata.original_ether_type = ETHERTYPE_IPV4;
+            } else {
+                hdr.ethernet.ether_type = ETHERTYPE_IPV6;
+                fabric_metadata.original_ether_type = ETHERTYPE_IPV6;
+            }
+        }
         else if (fabric_metadata.fwd_type == FWD_IPV4_UNICAST) unicast_v4.apply();
         else if (fabric_metadata.fwd_type == FWD_IPV4_MULTICAST) multicast_v4.apply();
         else if (fabric_metadata.fwd_type == FWD_IPV6_UNICAST) unicast_v6.apply();
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index 19d9308..a58e88e 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -24,21 +24,10 @@
     inout parsed_headers_t hdr,
     inout fabric_metadata_t fabric_metadata,
     inout standard_metadata_t standard_metadata) {
-    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_selector(HashAlgorithm.crc16, 32w64, 32w16) ecmp_selector;
 
     action output(port_num_t port_num) {
         standard_metadata.egress_spec = port_num;
-        if(!hdr.mpls.isValid()) {
-            if(hdr.ipv4.isValid()) {
-                hdr.ipv4.ttl = hdr.ipv4.ttl - 1;
-            }
-            else if (hdr.ipv6.isValid()) {
-                hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1;
-            }
-        }
     }
 
     action set_vlan_output(vlan_id_t new_vlan_id, port_num_t port_num){
@@ -69,25 +58,29 @@
     }
 
     action push_mpls (mpls_label_t label, bit<3> tc) {
-        //Suppose that the maximum number of label is one.
+        // Suppose that the maximum number of label is one.
         hdr.mpls.setValid();
         hdr.ethernet.ether_type = ETHERTYPE_MPLS;
         hdr.mpls.label = label;
         hdr.mpls.tc = tc;
-        hdr.mpls.bos = 1; // BOS = TRUE
+        hdr.mpls.bos = 1w1; // BOS = TRUE
         hdr.mpls.ttl = DEFAULT_MPLS_TTL;
     }
 
     action mpls_routing_v4 (port_num_t port_num, mac_addr_t smac, mac_addr_t dmac,
                             mpls_label_t label) {
         l3_routing(port_num, smac, dmac);
-        push_mpls(label, hdr.ipv4.diffserv[7:5]);
+
+        // TODO: set tc according to diffserv from ipv4
+        push_mpls(label, 3w0);
     }
 
     action mpls_routing_v6 (port_num_t port_num, mac_addr_t smac, mac_addr_t dmac,
                             mpls_label_t label) {
         l3_routing(port_num, smac, dmac);
-        push_mpls(label, hdr.ipv6.traffic_class[7:5]);
+
+        // TODO: set tc according to traffic_class from ipv4
+        push_mpls(label, 3w0);
     }
 
     table simple {
@@ -100,18 +93,14 @@
             set_vlan_output;
             l3_routing;
         }
-        counters = simple_counter;
     }
 
     table hashed {
         key = {
             fabric_metadata.next_id: exact;
-            hdr.ipv4.src_addr: selector;
-            hdr.ipv4.dst_addr: selector;
-            hdr.ipv4.protocol: selector;
-            hdr.ipv6.src_addr: selector;
-            hdr.ipv6.dst_addr: selector;
-            hdr.ipv6.next_hdr: selector;
+            hdr.ethernet.dst_addr: selector;
+            hdr.ethernet.src_addr: selector;
+            fabric_metadata.ip_proto: selector;
             fabric_metadata.l4_src_port: selector;
             fabric_metadata.l4_dst_port: selector;
         }
@@ -123,7 +112,6 @@
         }
 
         implementation = ecmp_selector;
-        counters = hashed_counter;
     }
 
     /*
@@ -136,11 +124,19 @@
         actions = {
             set_mcast_group;
         }
-        counters = broadcast_counter;
     }
 
     apply {
-        simple.apply();
+        if (simple.apply().hit) {
+            if (!hdr.mpls.isValid()) {
+                if(hdr.ipv4.isValid()) {
+                    hdr.ipv4.ttl = hdr.ipv4.ttl - 1;
+                }
+                else if (hdr.ipv6.isValid()) {
+                    hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1;
+                }
+            }
+        }
         hashed.apply();
         broadcast.apply();
     }
@@ -154,6 +150,11 @@
     apply {
         // pop internal vlan if the meta is set
         if (fabric_metadata.pop_vlan_at_egress) {
+            if (hdr.mpls.isValid()) {
+                hdr.ethernet.ether_type = ETHERTYPE_MPLS;
+            } else {
+                hdr.ethernet.ether_type = fabric_metadata.original_ether_type;
+            }
             hdr.vlan_tag.setInvalid();
         }
     }
diff --git a/pipelines/fabric/src/main/resources/include/control/packetio.p4 b/pipelines/fabric/src/main/resources/include/control/packetio.p4
index fb5d731..9e0771c 100644
--- a/pipelines/fabric/src/main/resources/include/control/packetio.p4
+++ b/pipelines/fabric/src/main/resources/include/control/packetio.p4
@@ -24,6 +24,7 @@
     apply {
         if (hdr.packet_out.isValid()) {
             standard_metadata.egress_spec = hdr.packet_out.egress_port;
+            hdr.packet_out.setInvalid();
             exit;
         }
     }
@@ -34,7 +35,6 @@
 inout fabric_metadata_t fabric_metadata,
 inout standard_metadata_t standard_metadata) {
     apply {
-        hdr.packet_out.setInvalid();
         if (standard_metadata.egress_port == CPU_PORT) {
             hdr.packet_in.setValid();
             hdr.packet_in.ingress_port = standard_metadata.ingress_port;
diff --git a/pipelines/fabric/src/main/resources/include/define.p4 b/pipelines/fabric/src/main/resources/include/define.p4
index 0ee3ff3..4765824 100644
--- a/pipelines/fabric/src/main/resources/include/define.p4
+++ b/pipelines/fabric/src/main/resources/include/define.p4
@@ -44,8 +44,9 @@
 const bit<8> PROTO_UDP = 17;
 const bit<8> PROTO_ICMPV6 = 58;
 
+#ifndef CPU_PORT
 const port_num_t CPU_PORT = 255;
-const port_num_t DROP_PORT = 511;
+#endif
 
 const fwd_type_t FWD_BRIDGING = 0;
 const fwd_type_t FWD_MPLS = 1;
diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4
index 3b153be..df9958b 100644
--- a/pipelines/fabric/src/main/resources/include/header.p4
+++ b/pipelines/fabric/src/main/resources/include/header.p4
@@ -22,11 +22,13 @@
 @controller_header("packet_in")
 header packet_in_header_t {
     port_num_t ingress_port;
+    bit<7> _pad;
 }
 
 @controller_header("packet_out")
 header packet_out_header_t {
     port_num_t egress_port;
+    bit<7> _pad;
 }
 
 header ethernet_t {
@@ -121,6 +123,7 @@
     bit<8> ip_proto;
     bit<16> l4_src_port;
     bit<16> l4_dst_port;
+    bit<16> original_ether_type;
 }
 
 struct parsed_headers_t {
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index d191ff9..c5653dc 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -24,6 +24,7 @@
 out parsed_headers_t hdr,
 inout fabric_metadata_t fabric_metadata,
 inout standard_metadata_t standard_metadata) {
+
     state start {
         transition select(standard_metadata.ingress_port) {
             CPU_PORT: parse_packet_out;
@@ -38,6 +39,7 @@
 
     state parse_ethernet {
         packet.extract(hdr.ethernet);
+        fabric_metadata.original_ether_type = hdr.ethernet.ether_type;
         transition select(hdr.ethernet.ether_type){
             ETHERTYPE_QINQ_NON_STD: parse_vlan_tag;
             ETHERTYPE_QINQ: parse_vlan_tag;
@@ -73,7 +75,6 @@
 
     state parse_mpls {
         packet.extract(hdr.mpls);
-
         //There is only one MPLS label for this fabric.
         transition select(packet.lookahead<ipv4_t>().version) {
             //The packet should be either IPv4 or IPv6.
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
index 46b63a4..51d5a08 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.json
@@ -1,5 +1,5 @@
 {
-  "program" : "fabric.p4",
+  "program" : "p4c-out/bmv2/fabric.p4i",
   "__meta__" : {
     "version" : [2, 7],
     "compiler" : "https://github.com/p4lang/p4c"
@@ -9,16 +9,18 @@
       "name" : "scalars_0",
       "id" : 0,
       "fields" : [
-        ["tmp", 161, false],
+        ["tmp_0", 161, false],
         ["tmp_1", 32, false],
         ["tmp_2", 32, false],
+        ["next_tmp_0", 1, false],
         ["fabric_metadata_t.fwd_type", 3, false],
         ["fabric_metadata_t.next_id", 32, false],
         ["fabric_metadata_t.pop_vlan_at_egress", 1, false],
         ["fabric_metadata_t.ip_proto", 8, false],
         ["fabric_metadata_t.l4_src_port", 16, false],
         ["fabric_metadata_t.l4_dst_port", 16, false],
-        ["_padding_2", 3, false]
+        ["fabric_metadata_t.original_ether_type", 16, false],
+        ["_padding_0", 2, false]
       ]
     },
     {
@@ -137,7 +139,7 @@
       "id" : 10,
       "fields" : [
         ["egress_port", 9, false],
-        ["_padding", 7, false]
+        ["_pad", 7, false]
       ]
     },
     {
@@ -145,7 +147,7 @@
       "id" : 11,
       "fields" : [
         ["ingress_port", 9, false],
-        ["_padding_0", 7, false]
+        ["_pad", 7, false]
       ]
     },
     {
@@ -170,13 +172,13 @@
         ["resubmit_flag", 1, false],
         ["egress_rid", 16, false],
         ["checksum_error", 1, false],
-        ["_padding_1", 4, false]
+        ["_padding", 4, false]
       ]
     }
   ],
   "headers" : [
     {
-      "name" : "tmp_0",
+      "name" : "tmp",
       "id" : 0,
       "header_type" : "ipv4_t",
       "metadata" : false,
@@ -359,6 +361,19 @@
                 }
               ],
               "op" : "extract"
+            },
+            {
+              "parameters" : [
+                {
+                  "type" : "field",
+                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
+                },
+                {
+                  "type" : "field",
+                  "value" : ["ethernet", "ether_type"]
+                }
+              ],
+              "op" : "set"
             }
           ],
           "transitions" : [
@@ -518,7 +533,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["scalars", "tmp"]
+                  "value" : ["scalars", "tmp_0"]
                 },
                 {
                   "type" : "lookahead",
@@ -533,7 +548,7 @@
                   "parameters" : [
                     {
                       "type" : "header",
-                      "value" : "tmp_0"
+                      "value" : "tmp"
                     }
                   ],
                   "op" : "add_header"
@@ -545,7 +560,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "version"]
+                  "value" : ["tmp", "version"]
                 },
                 {
                   "type" : "expression",
@@ -563,7 +578,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -591,7 +606,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "ihl"]
+                  "value" : ["tmp", "ihl"]
                 },
                 {
                   "type" : "expression",
@@ -609,7 +624,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -637,7 +652,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "diffserv"]
+                  "value" : ["tmp", "diffserv"]
                 },
                 {
                   "type" : "expression",
@@ -655,7 +670,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -683,7 +698,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "total_len"]
+                  "value" : ["tmp", "total_len"]
                 },
                 {
                   "type" : "expression",
@@ -701,7 +716,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -729,7 +744,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "identification"]
+                  "value" : ["tmp", "identification"]
                 },
                 {
                   "type" : "expression",
@@ -747,7 +762,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -775,7 +790,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "flags"]
+                  "value" : ["tmp", "flags"]
                 },
                 {
                   "type" : "expression",
@@ -793,7 +808,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -821,7 +836,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "frag_offset"]
+                  "value" : ["tmp", "frag_offset"]
                 },
                 {
                   "type" : "expression",
@@ -839,7 +854,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -867,7 +882,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "ttl"]
+                  "value" : ["tmp", "ttl"]
                 },
                 {
                   "type" : "expression",
@@ -885,7 +900,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -913,7 +928,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "protocol"]
+                  "value" : ["tmp", "protocol"]
                 },
                 {
                   "type" : "expression",
@@ -931,7 +946,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -959,7 +974,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "hdr_checksum"]
+                  "value" : ["tmp", "hdr_checksum"]
                 },
                 {
                   "type" : "expression",
@@ -977,7 +992,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -1005,7 +1020,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "src_addr"]
+                  "value" : ["tmp", "src_addr"]
                 },
                 {
                   "type" : "expression",
@@ -1023,7 +1038,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -1051,7 +1066,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "dst_addr"]
+                  "value" : ["tmp", "dst_addr"]
                 },
                 {
                   "type" : "expression",
@@ -1069,7 +1084,7 @@
                               "op" : ">>",
                               "left" : {
                                 "type" : "field",
-                                "value" : ["scalars", "tmp"]
+                                "value" : ["scalars", "tmp_0"]
                               },
                               "right" : {
                                 "type" : "hexstr",
@@ -1097,7 +1112,7 @@
               "parameters" : [
                 {
                   "type" : "field",
-                  "value" : ["tmp_0", "$valid$"]
+                  "value" : ["tmp", "$valid$"]
                 },
                 {
                   "type" : "expression",
@@ -1107,7 +1122,7 @@
                       "op" : "&",
                       "left" : {
                         "type" : "field",
-                        "value" : ["scalars", "tmp"]
+                        "value" : ["scalars", "tmp_0"]
                       },
                       "right" : {
                         "type" : "hexstr",
@@ -1140,7 +1155,7 @@
           "transition_key" : [
             {
               "type" : "field",
-              "value" : ["tmp_0", "version"]
+              "value" : ["tmp", "version"]
             }
           ]
         },
@@ -1409,7 +1424,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "./include/parser.p4",
-        "line" : 134,
+        "line" : 135,
         "column" : 8,
         "source_fragment" : "FabricDeparser"
       },
@@ -1419,80 +1434,8 @@
   "meter_arrays" : [],
   "counter_arrays" : [
     {
-      "name" : "filtering.ingress_port_vlan_counter",
-      "id" : 0,
-      "is_direct" : true,
-      "binding" : "filtering.ingress_port_vlan"
-    },
-    {
-      "name" : "filtering.fwd_classifier_counter",
-      "id" : 1,
-      "is_direct" : true,
-      "binding" : "filtering.fwd_classifier"
-    },
-    {
-      "name" : "forwarding.bridging_counter",
-      "id" : 2,
-      "is_direct" : true,
-      "binding" : "forwarding.bridging"
-    },
-    {
-      "name" : "forwarding.mpls_counter",
-      "id" : 3,
-      "is_direct" : true,
-      "binding" : "forwarding.mpls"
-    },
-    {
-      "name" : "forwarding.unicast_v4_counter",
-      "id" : 4,
-      "is_direct" : true,
-      "binding" : "forwarding.unicast_v4"
-    },
-    {
-      "name" : "forwarding.multicast_v4_counter",
-      "id" : 5,
-      "is_direct" : true,
-      "binding" : "forwarding.multicast_v4"
-    },
-    {
-      "name" : "forwarding.unicast_v6_counter",
-      "id" : 6,
-      "is_direct" : true,
-      "binding" : "forwarding.unicast_v6"
-    },
-    {
-      "name" : "forwarding.multicast_v6_counter",
-      "id" : 7,
-      "is_direct" : true,
-      "binding" : "forwarding.multicast_v6"
-    },
-    {
-      "name" : "forwarding.acl_counter",
-      "id" : 8,
-      "is_direct" : true,
-      "binding" : "forwarding.acl"
-    },
-    {
-      "name" : "next.simple_counter",
-      "id" : 9,
-      "is_direct" : true,
-      "binding" : "next.simple"
-    },
-    {
-      "name" : "next.hashed_counter",
-      "id" : 10,
-      "is_direct" : true,
-      "binding" : "next.hashed"
-    },
-    {
-      "name" : "next.broadcast_counter",
-      "id" : 11,
-      "is_direct" : true,
-      "binding" : "next.broadcast"
-    },
-    {
       "name" : "port_counters_control.egress_port_counter",
-      "id" : 12,
+      "id" : 0,
       "source_info" : {
         "filename" : "./include/control/port_counter.p4",
         "line" : 23,
@@ -1504,7 +1447,7 @@
     },
     {
       "name" : "port_counters_control.ingress_port_counter",
-      "id" : 13,
+      "id" : 1,
       "source_info" : {
         "filename" : "./include/control/port_counter.p4",
         "line" : 24,
@@ -1522,7 +1465,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "./include/checksum.p4",
-        "line" : 48,
+        "line" : 51,
         "column" : 8,
         "source_fragment" : "verify_checksum(hdr.ipv4.isValid(), ..."
       },
@@ -1579,7 +1522,7 @@
       "id" : 1,
       "source_info" : {
         "filename" : "./include/checksum.p4",
-        "line" : 24,
+        "line" : 25,
         "column" : 8,
         "source_fragment" : "update_checksum(hdr.ipv4.isValid(), ..."
       },
@@ -1647,38 +1590,16 @@
       "primitives" : []
     },
     {
-      "name" : "drop",
+      "name" : "NoAction",
       "id" : 2,
       "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "drop",
-          "parameters" : [],
-          "source_info" : {
-            "filename" : "./include/control/../action.p4",
-            "line" : 25,
-            "column" : 4,
-            "source_fragment" : "mark_to_drop()"
-          }
-        }
-      ]
+      "primitives" : []
     },
     {
-      "name" : "drop",
+      "name" : "NoAction",
       "id" : 3,
       "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "drop",
-          "parameters" : [],
-          "source_info" : {
-            "filename" : "./include/control/../action.p4",
-            "line" : 25,
-            "column" : 4,
-            "source_fragment" : "mark_to_drop()"
-          }
-        }
-      ]
+      "primitives" : []
     },
     {
       "name" : "NoAction",
@@ -1723,20 +1644,25 @@
       "primitives" : []
     },
     {
-      "name" : "NoAction",
+      "name" : "filtering.drop",
       "id" : 11,
       "runtime_data" : [],
-      "primitives" : []
-    },
-    {
-      "name" : "NoAction",
-      "id" : 12,
-      "runtime_data" : [],
-      "primitives" : []
+      "primitives" : [
+        {
+          "op" : "drop",
+          "parameters" : [],
+          "source_info" : {
+            "filename" : "./include/control/filtering.p4",
+            "line" : 29,
+            "column" : 8,
+            "source_fragment" : "mark_to_drop()"
+          }
+        }
+      ]
     },
     {
       "name" : "filtering.set_vlan",
-      "id" : 13,
+      "id" : 12,
       "runtime_data" : [
         {
           "name" : "new_vlan_id",
@@ -1758,7 +1684,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 32,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
           }
@@ -1767,7 +1693,7 @@
     },
     {
       "name" : "filtering.push_internal_vlan",
-      "id" : 14,
+      "id" : 13,
       "runtime_data" : [
         {
           "name" : "new_vlan_id",
@@ -1785,7 +1711,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 38,
+            "line" : 39,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.setValid()"
           }
@@ -1804,7 +1730,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 39,
+            "line" : 40,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.cfi = 0"
           }
@@ -1823,7 +1749,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 40,
+            "line" : 41,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.pri = 0"
           }
@@ -1836,6 +1762,25 @@
               "value" : ["vlan_tag", "ether_type"]
             },
             {
+              "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/filtering.p4",
+            "line" : 42,
+            "column" : 8,
+            "source_fragment" : "hdr.vlan_tag.ether_type = hdr.ethernet.ether_type"
+          }
+        },
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            },
+            {
               "type" : "hexstr",
               "value" : "0x8100"
             }
@@ -1861,7 +1806,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 32,
+            "line" : 33,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id; ..."
           }
@@ -1890,7 +1835,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 45,
+            "line" : 47,
             "column" : 8,
             "source_fragment" : "fabric_metadata.pop_vlan_at_egress = true"
           }
@@ -1899,7 +1844,7 @@
     },
     {
       "name" : "filtering.set_forwarding_type",
-      "id" : 15,
+      "id" : 14,
       "runtime_data" : [
         {
           "name" : "fwd_type",
@@ -1921,7 +1866,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 49,
+            "line" : 51,
             "column" : 8,
             "source_fragment" : "fabric_metadata.fwd_type = fwd_type"
           }
@@ -1929,6 +1874,23 @@
       ]
     },
     {
+      "name" : "forwarding.drop",
+      "id" : 15,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "drop",
+          "parameters" : [],
+          "source_info" : {
+            "filename" : "./include/control/forwarding.p4",
+            "line" : 31,
+            "column" : 8,
+            "source_fragment" : "mark_to_drop()"
+          }
+        }
+      ]
+    },
+    {
       "name" : "forwarding.set_next_id",
       "id" : 16,
       "runtime_data" : [
@@ -1952,7 +1914,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -1983,7 +1945,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2014,7 +1976,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2045,7 +2007,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2076,7 +2038,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2107,7 +2069,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 39,
+            "line" : 35,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2134,7 +2096,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 43,
+            "line" : 39,
             "column" : 8,
             "source_fragment" : "hdr.mpls.setInvalid()"
           }
@@ -2144,105 +2106,6 @@
           "parameters" : [
             {
               "type" : "field",
-              "value" : ["ethernet", "ether_type"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "hexstr",
-                    "value" : "0x0800"
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ethernet", "ether_type"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "==",
-                      "left" : {
-                        "type" : "field",
-                        "value" : ["ipv4", "$valid$"]
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0x01"
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/forwarding.p4",
-            "line" : 45,
-            "column" : 12,
-            "source_fragment" : "hdr.ethernet.ether_type ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ethernet", "ether_type"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "hexstr",
-                    "value" : "0x86dd"
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ethernet", "ether_type"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "not",
-                      "left" : null,
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/forwarding.p4",
-            "line" : 47,
-            "column" : 12,
-            "source_fragment" : "hdr.ethernet.ether_type ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
               "value" : ["scalars", "fabric_metadata_t.next_id"]
             },
             {
@@ -2252,7 +2115,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 49,
+            "line" : 40,
             "column" : 8,
             "source_fragment" : "fabric_metadata.next_id = next_id"
           }
@@ -2278,7 +2141,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/../define.p4",
-            "line" : 47,
+            "line" : 48,
             "column" : 28,
             "source_fragment" : "255; ..."
           }
@@ -2309,209 +2172,10 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num"
           }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
         }
       ]
     },
@@ -2543,7 +2207,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 45,
+            "line" : 34,
             "column" : 8,
             "source_fragment" : "hdr.vlan_tag.vlan_id = new_vlan_id"
           }
@@ -2572,7 +2236,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 48,
+            "line" : 37,
             "column" : 8,
             "source_fragment" : "fabric_metadata.pop_vlan_at_egress = false"
           }
@@ -2591,209 +2255,10 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
         }
       ]
     },
@@ -2829,7 +2294,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 42,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -2848,7 +2313,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 57,
+            "line" : 46,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -2867,209 +2332,10 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
         }
       ]
     },
@@ -3105,7 +2371,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 42,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3124,7 +2390,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 57,
+            "line" : 46,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3143,209 +2409,10 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
         }
       ]
     },
@@ -3377,7 +2444,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 67,
+            "line" : 56,
             "column" : 8,
             "source_fragment" : "standard_metadata.mcast_grp = gid"
           }
@@ -3396,7 +2463,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 42,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3439,7 +2506,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 42,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3458,7 +2525,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 57,
+            "line" : 46,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3477,211 +2544,12 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
         },
         {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
-        },
-        {
           "op" : "add_header",
           "parameters" : [
             {
@@ -3691,7 +2559,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 73,
+            "line" : 62,
             "column" : 8,
             "source_fragment" : "hdr.mpls.setValid()"
           }
@@ -3729,7 +2597,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 75,
+            "line" : 64,
             "column" : 8,
             "source_fragment" : "hdr.mpls.label = label; ..."
           }
@@ -3742,46 +2610,13 @@
               "value" : ["mpls", "tc"]
             },
             {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "&",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : ">>",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "diffserv"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x5"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "hexstr",
-                    "value" : "0x07"
-                  }
-                }
-              }
+              "type" : "hexstr",
+              "value" : "0x00"
             }
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 76,
+            "line" : 65,
             "column" : 8,
             "source_fragment" : "hdr.mpls.tc = tc; ..."
           }
@@ -3800,9 +2635,9 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 77,
+            "line" : 66,
             "column" : 8,
-            "source_fragment" : "hdr.mpls.bos = 1"
+            "source_fragment" : "hdr.mpls.bos = 1w1"
           }
         },
         {
@@ -3862,7 +2697,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 53,
+            "line" : 42,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.src_addr = smac; ..."
           }
@@ -3881,7 +2716,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 57,
+            "line" : 46,
             "column" : 8,
             "source_fragment" : "hdr.ethernet.dst_addr = dmac; ..."
           }
@@ -3900,211 +2735,12 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 33,
+            "line" : 30,
             "column" : 8,
             "source_fragment" : "standard_metadata.egress_spec = port_num; ..."
           }
         },
         {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv4", "ttl"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "ttl"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv4", "ttl"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "!=",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["mpls", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv4", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 36,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv4.ttl ="
-          }
-        },
-        {
-          "op" : "assign",
-          "parameters" : [
-            {
-              "type" : "field",
-              "value" : ["ipv6", "hop_limit"]
-            },
-            {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "?",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "+",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "hop_limit"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0xff"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "field",
-                    "value" : ["ipv6", "hop_limit"]
-                  },
-                  "cond" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "and",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "and",
-                          "left" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "!=",
-                              "left" : {
-                                "type" : "field",
-                                "value" : ["mpls", "$valid$"]
-                              },
-                              "right" : {
-                                "type" : "hexstr",
-                                "value" : "0x01"
-                              }
-                            }
-                          },
-                          "right" : {
-                            "type" : "expression",
-                            "value" : {
-                              "op" : "not",
-                              "left" : null,
-                              "right" : {
-                                "type" : "expression",
-                                "value" : {
-                                  "op" : "==",
-                                  "left" : {
-                                    "type" : "field",
-                                    "value" : ["ipv4", "$valid$"]
-                                  },
-                                  "right" : {
-                                    "type" : "hexstr",
-                                    "value" : "0x01"
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : "==",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "$valid$"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x01"
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/next.p4",
-            "line" : 39,
-            "column" : 16,
-            "source_fragment" : "hdr.ipv6.hop_limit ="
-          }
-        },
-        {
           "op" : "add_header",
           "parameters" : [
             {
@@ -4114,7 +2750,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 73,
+            "line" : 62,
             "column" : 8,
             "source_fragment" : "hdr.mpls.setValid()"
           }
@@ -4152,7 +2788,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 75,
+            "line" : 64,
             "column" : 8,
             "source_fragment" : "hdr.mpls.label = label; ..."
           }
@@ -4165,46 +2801,13 @@
               "value" : ["mpls", "tc"]
             },
             {
-              "type" : "expression",
-              "value" : {
-                "type" : "expression",
-                "value" : {
-                  "op" : "&",
-                  "left" : {
-                    "type" : "expression",
-                    "value" : {
-                      "op" : "&",
-                      "left" : {
-                        "type" : "expression",
-                        "value" : {
-                          "op" : ">>",
-                          "left" : {
-                            "type" : "field",
-                            "value" : ["ipv6", "traffic_class"]
-                          },
-                          "right" : {
-                            "type" : "hexstr",
-                            "value" : "0x5"
-                          }
-                        }
-                      },
-                      "right" : {
-                        "type" : "hexstr",
-                        "value" : "0xff"
-                      }
-                    }
-                  },
-                  "right" : {
-                    "type" : "hexstr",
-                    "value" : "0x07"
-                  }
-                }
-              }
+              "type" : "hexstr",
+              "value" : "0x00"
             }
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 76,
+            "line" : 65,
             "column" : 8,
             "source_fragment" : "hdr.mpls.tc = tc; ..."
           }
@@ -4223,9 +2826,9 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 77,
+            "line" : 66,
             "column" : 8,
-            "source_fragment" : "hdr.mpls.bos = 1"
+            "source_fragment" : "hdr.mpls.bos = 1w1"
           }
         },
         {
@@ -4272,6 +2875,21 @@
             "column" : 12,
             "source_fragment" : "standard_metadata.egress_spec = hdr.packet_out.egress_port"
           }
+        },
+        {
+          "op" : "remove_header",
+          "parameters" : [
+            {
+              "type" : "header",
+              "value" : "packet_out"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/packetio.p4",
+            "line" : 27,
+            "column" : 12,
+            "source_fragment" : "hdr.packet_out.setInvalid()"
+          }
         }
       ]
     },
@@ -4285,6 +2903,254 @@
           "parameters" : [
             {
               "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x0800"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/../define.p4",
+            "line" : 35,
+            "column" : 31,
+            "source_fragment" : "0x0800; ..."
+          }
+        },
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x0800"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/../define.p4",
+            "line" : 35,
+            "column" : 31,
+            "source_fragment" : "0x0800; ..."
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_1",
+      "id" : 33,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x86dd"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/../define.p4",
+            "line" : 36,
+            "column" : 31,
+            "source_fragment" : "0x86dd; ..."
+          }
+        },
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x86dd"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/../define.p4",
+            "line" : 36,
+            "column" : 31,
+            "source_fragment" : "0x86dd; ..."
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_2",
+      "id" : 34,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["scalars", "next_tmp_0"]
+            },
+            {
+              "type" : "expression",
+              "value" : {
+                "type" : "expression",
+                "value" : {
+                  "op" : "b2d",
+                  "left" : null,
+                  "right" : {
+                    "type" : "bool",
+                    "value" : true
+                  }
+                }
+              }
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "name" : "act_3",
+      "id" : 35,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["scalars", "next_tmp_0"]
+            },
+            {
+              "type" : "expression",
+              "value" : {
+                "type" : "expression",
+                "value" : {
+                  "op" : "b2d",
+                  "left" : null,
+                  "right" : {
+                    "type" : "bool",
+                    "value" : false
+                  }
+                }
+              }
+            }
+          ]
+        }
+      ]
+    },
+    {
+      "name" : "act_4",
+      "id" : 36,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ipv4", "ttl"]
+            },
+            {
+              "type" : "expression",
+              "value" : {
+                "type" : "expression",
+                "value" : {
+                  "op" : "&",
+                  "left" : {
+                    "type" : "expression",
+                    "value" : {
+                      "op" : "+",
+                      "left" : {
+                        "type" : "field",
+                        "value" : ["ipv4", "ttl"]
+                      },
+                      "right" : {
+                        "type" : "hexstr",
+                        "value" : "0xff"
+                      }
+                    }
+                  },
+                  "right" : {
+                    "type" : "hexstr",
+                    "value" : "0xff"
+                  }
+                }
+              }
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 133,
+            "column" : 20,
+            "source_fragment" : "hdr.ipv4.ttl = hdr.ipv4.ttl - 1"
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_5",
+      "id" : 37,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ipv6", "hop_limit"]
+            },
+            {
+              "type" : "expression",
+              "value" : {
+                "type" : "expression",
+                "value" : {
+                  "op" : "&",
+                  "left" : {
+                    "type" : "expression",
+                    "value" : {
+                      "op" : "+",
+                      "left" : {
+                        "type" : "field",
+                        "value" : ["ipv6", "hop_limit"]
+                      },
+                      "right" : {
+                        "type" : "hexstr",
+                        "value" : "0xff"
+                      }
+                    }
+                  },
+                  "right" : {
+                    "type" : "hexstr",
+                    "value" : "0xff"
+                  }
+                }
+              }
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 136,
+            "column" : 20,
+            "source_fragment" : "hdr.ipv6.hop_limit = hdr.ipv6.hop_limit - 1"
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_6",
+      "id" : 38,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
               "value" : ["scalars", "tmp_1"]
             },
             {
@@ -4328,8 +3194,8 @@
       ]
     },
     {
-      "name" : "act_1",
-      "id" : 33,
+      "name" : "act_7",
+      "id" : 39,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4380,8 +3246,60 @@
       ]
     },
     {
-      "name" : "act_2",
-      "id" : 34,
+      "name" : "act_8",
+      "id" : 40,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            },
+            {
+              "type" : "hexstr",
+              "value" : "0x8847"
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/../define.p4",
+            "line" : 33,
+            "column" : 31,
+            "source_fragment" : "0x8847; ..."
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_9",
+      "id" : 41,
+      "runtime_data" : [],
+      "primitives" : [
+        {
+          "op" : "assign",
+          "parameters" : [
+            {
+              "type" : "field",
+              "value" : ["ethernet", "ether_type"]
+            },
+            {
+              "type" : "field",
+              "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
+            }
+          ],
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 156,
+            "column" : 16,
+            "source_fragment" : "hdr.ethernet.ether_type = fabric_metadata.original_ether_type"
+          }
+        }
+      ]
+    },
+    {
+      "name" : "act_10",
+      "id" : 42,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4394,7 +3312,7 @@
           ],
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 157,
+            "line" : 158,
             "column" : 12,
             "source_fragment" : "hdr.vlan_tag.setInvalid()"
           }
@@ -4402,8 +3320,8 @@
       ]
     },
     {
-      "name" : "act_3",
-      "id" : 35,
+      "name" : "act_11",
+      "id" : 43,
       "runtime_data" : [],
       "primitives" : [
         {
@@ -4441,28 +3359,6 @@
           }
         }
       ]
-    },
-    {
-      "name" : "act_4",
-      "id" : 36,
-      "runtime_data" : [],
-      "primitives" : [
-        {
-          "op" : "remove_header",
-          "parameters" : [
-            {
-              "type" : "header",
-              "value" : "packet_out"
-            }
-          ],
-          "source_info" : {
-            "filename" : "./include/control/packetio.p4",
-            "line" : 37,
-            "column" : 8,
-            "source_fragment" : "hdr.packet_out.setInvalid()"
-          }
-        }
-      ]
     }
   ],
   "pipelines" : [
@@ -4505,7 +3401,7 @@
           "id" : 1,
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 53,
+            "line" : 55,
             "column" : 10,
             "source_fragment" : "ingress_port_vlan"
           },
@@ -4529,19 +3425,20 @@
           "match_type" : "ternary",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [14, 13, 0, 2],
-          "actions" : ["filtering.push_internal_vlan", "filtering.set_vlan", "nop", "drop"],
+          "action_ids" : [13, 12, 0, 11],
+          "actions" : ["filtering.push_internal_vlan", "filtering.set_vlan", "nop", "filtering.drop"],
           "base_default_next" : "filtering.fwd_classifier",
           "next_tables" : {
             "filtering.push_internal_vlan" : "filtering.fwd_classifier",
             "filtering.set_vlan" : "filtering.fwd_classifier",
             "nop" : "filtering.fwd_classifier",
-            "drop" : "filtering.fwd_classifier"
+            "filtering.drop" : "filtering.fwd_classifier"
           },
           "default_entry" : {
-            "action_id" : 2,
+            "action_id" : 11,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -4552,7 +3449,7 @@
           "id" : 2,
           "source_info" : {
             "filename" : "./include/control/filtering.p4",
-            "line" : 71,
+            "line" : 72,
             "column" : 10,
             "source_fragment" : "fwd_classifier"
           },
@@ -4569,23 +3466,24 @@
             },
             {
               "match_type" : "exact",
-              "target" : ["ethernet", "ether_type"],
+              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
               "mask" : null
             }
           ],
           "match_type" : "exact",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [15],
+          "action_ids" : [14],
           "actions" : ["filtering.set_forwarding_type"],
           "base_default_next" : "node_6",
           "next_tables" : {
             "filtering.set_forwarding_type" : "node_6"
           },
           "default_entry" : {
-            "action_id" : 15,
+            "action_id" : 14,
             "action_const" : true,
             "action_data" : ["0x0"],
             "action_entry_const" : true
@@ -4596,7 +3494,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 56,
+            "line" : 47,
             "column" : 10,
             "source_fragment" : "bridging"
           },
@@ -4615,9 +3513,128 @@
           "match_type" : "ternary",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [16, 4],
+          "action_ids" : [16, 2],
+          "actions" : ["forwarding.set_next_id", "NoAction"],
+          "base_default_next" : "forwarding.acl",
+          "next_tables" : {
+            "forwarding.set_next_id" : "forwarding.acl",
+            "NoAction" : "forwarding.acl"
+          },
+          "default_entry" : {
+            "action_id" : 2,
+            "action_const" : false,
+            "action_data" : [],
+            "action_entry_const" : false
+          }
+        },
+        {
+          "name" : "forwarding.mpls",
+          "id" : 4,
+          "source_info" : {
+            "filename" : "./include/control/forwarding.p4",
+            "line" : 58,
+            "column" : 10,
+            "source_fragment" : "mpls"
+          },
+          "key" : [
+            {
+              "match_type" : "exact",
+              "target" : ["mpls", "label"],
+              "mask" : null
+            }
+          ],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [22, 3],
+          "actions" : ["forwarding.pop_mpls_and_next", "NoAction"],
+          "base_default_next" : "node_10",
+          "next_tables" : {
+            "forwarding.pop_mpls_and_next" : "node_10",
+            "NoAction" : "node_10"
+          },
+          "default_entry" : {
+            "action_id" : 3,
+            "action_const" : false,
+            "action_data" : [],
+            "action_entry_const" : false
+          }
+        },
+        {
+          "name" : "tbl_act_0",
+          "id" : 5,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [32],
+          "actions" : ["act_0"],
+          "base_default_next" : "forwarding.acl",
+          "next_tables" : {
+            "act_0" : "forwarding.acl"
+          },
+          "default_entry" : {
+            "action_id" : 32,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_1",
+          "id" : 6,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [33],
+          "actions" : ["act_1"],
+          "base_default_next" : "forwarding.acl",
+          "next_tables" : {
+            "act_1" : "forwarding.acl"
+          },
+          "default_entry" : {
+            "action_id" : 33,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "forwarding.unicast_v4",
+          "id" : 7,
+          "source_info" : {
+            "filename" : "./include/control/forwarding.p4",
+            "line" : 68,
+            "column" : 10,
+            "source_fragment" : "unicast_v4"
+          },
+          "key" : [
+            {
+              "match_type" : "lpm",
+              "target" : ["ipv4", "dst_addr"],
+              "mask" : null
+            }
+          ],
+          "match_type" : "lpm",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [17, 4],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4632,81 +3649,11 @@
           }
         },
         {
-          "name" : "forwarding.mpls",
-          "id" : 4,
-          "source_info" : {
-            "filename" : "./include/control/forwarding.p4",
-            "line" : 68,
-            "column" : 10,
-            "source_fragment" : "mpls"
-          },
-          "key" : [
-            {
-              "match_type" : "exact",
-              "target" : ["mpls", "label"],
-              "mask" : null
-            }
-          ],
-          "match_type" : "exact",
-          "type" : "simple",
-          "max_size" : 1024,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [22, 5],
-          "actions" : ["forwarding.pop_mpls_and_next", "NoAction"],
-          "base_default_next" : "forwarding.acl",
-          "next_tables" : {
-            "forwarding.pop_mpls_and_next" : "forwarding.acl",
-            "NoAction" : "forwarding.acl"
-          },
-          "default_entry" : {
-            "action_id" : 5,
-            "action_const" : false,
-            "action_data" : [],
-            "action_entry_const" : false
-          }
-        },
-        {
-          "name" : "forwarding.unicast_v4",
-          "id" : 5,
-          "source_info" : {
-            "filename" : "./include/control/forwarding.p4",
-            "line" : 79,
-            "column" : 10,
-            "source_fragment" : "unicast_v4"
-          },
-          "key" : [
-            {
-              "match_type" : "lpm",
-              "target" : ["ipv4", "dst_addr"],
-              "mask" : null
-            }
-          ],
-          "match_type" : "lpm",
-          "type" : "simple",
-          "max_size" : 1024,
-          "support_timeout" : false,
-          "direct_meters" : null,
-          "action_ids" : [17, 6],
-          "actions" : ["forwarding.set_next_id", "NoAction"],
-          "base_default_next" : "forwarding.acl",
-          "next_tables" : {
-            "forwarding.set_next_id" : "forwarding.acl",
-            "NoAction" : "forwarding.acl"
-          },
-          "default_entry" : {
-            "action_id" : 6,
-            "action_const" : false,
-            "action_data" : [],
-            "action_entry_const" : false
-          }
-        },
-        {
           "name" : "forwarding.multicast_v4",
-          "id" : 6,
+          "id" : 8,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 90,
+            "line" : 78,
             "column" : 10,
             "source_fragment" : "multicast_v4"
           },
@@ -4725,9 +3672,10 @@
           "match_type" : "lpm",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [18, 7],
+          "action_ids" : [18, 5],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4735,7 +3683,7 @@
             "NoAction" : "forwarding.acl"
           },
           "default_entry" : {
-            "action_id" : 7,
+            "action_id" : 5,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
@@ -4743,10 +3691,10 @@
         },
         {
           "name" : "forwarding.unicast_v6",
-          "id" : 7,
+          "id" : 9,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 102,
+            "line" : 89,
             "column" : 10,
             "source_fragment" : "unicast_v6"
           },
@@ -4760,9 +3708,10 @@
           "match_type" : "lpm",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [19, 8],
+          "action_ids" : [19, 6],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4770,7 +3719,7 @@
             "NoAction" : "forwarding.acl"
           },
           "default_entry" : {
-            "action_id" : 8,
+            "action_id" : 6,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
@@ -4778,10 +3727,10 @@
         },
         {
           "name" : "forwarding.multicast_v6",
-          "id" : 8,
+          "id" : 10,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 113,
+            "line" : 99,
             "column" : 10,
             "source_fragment" : "multicast_v6"
           },
@@ -4800,9 +3749,10 @@
           "match_type" : "lpm",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [20, 9],
+          "action_ids" : [20, 7],
           "actions" : ["forwarding.set_next_id", "NoAction"],
           "base_default_next" : "forwarding.acl",
           "next_tables" : {
@@ -4810,7 +3760,7 @@
             "NoAction" : "forwarding.acl"
           },
           "default_entry" : {
-            "action_id" : 9,
+            "action_id" : 7,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
@@ -4818,10 +3768,10 @@
         },
         {
           "name" : "forwarding.acl",
-          "id" : 9,
+          "id" : 11,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 125,
+            "line" : 110,
             "column" : 10,
             "source_fragment" : "acl"
           },
@@ -4838,6 +3788,16 @@
             },
             {
               "match_type" : "ternary",
+              "target" : ["scalars", "fabric_metadata_t.l4_src_port"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
+              "target" : ["scalars", "fabric_metadata_t.l4_dst_port"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
             },
@@ -4848,7 +3808,7 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["ethernet", "ether_type"],
+              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
               "mask" : null
             },
             {
@@ -4858,16 +3818,6 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["vlan_tag", "pri"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["mpls", "tc"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["mpls", "bos"],
               "mask" : null
             },
@@ -4888,11 +3838,6 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["ipv4", "protocol"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["ipv6", "src_addr"],
               "mask" : null
             },
@@ -4903,31 +3848,6 @@
             },
             {
               "match_type" : "ternary",
-              "target" : ["ipv6", "next_hdr"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["tcp", "src_port"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["tcp", "dst_port"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["udp", "src_port"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
-              "target" : ["udp", "dst_port"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "target" : ["icmp", "icmp_type"],
               "mask" : null
             },
@@ -4939,16 +3859,17 @@
           ],
           "match_type" : "ternary",
           "type" : "simple",
-          "max_size" : 1024,
+          "max_size" : 256,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [21, 23, 3, 1],
-          "actions" : ["forwarding.set_next_id", "forwarding.duplicate_to_controller", "drop", "nop"],
+          "action_ids" : [21, 23, 15, 1],
+          "actions" : ["forwarding.set_next_id", "forwarding.duplicate_to_controller", "forwarding.drop", "nop"],
           "base_default_next" : "next.simple",
           "next_tables" : {
             "forwarding.set_next_id" : "next.simple",
             "forwarding.duplicate_to_controller" : "next.simple",
-            "drop" : "next.simple",
+            "forwarding.drop" : "next.simple",
             "nop" : "next.simple"
           },
           "default_entry" : {
@@ -4960,10 +3881,10 @@
         },
         {
           "name" : "next.simple",
-          "id" : 10,
+          "id" : 12,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 93,
+            "line" : 86,
             "column" : 10,
             "source_fragment" : "simple"
           },
@@ -4977,30 +3898,121 @@
           "match_type" : "exact",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [24, 25, 26, 10],
+          "action_ids" : [24, 25, 26, 8],
           "actions" : ["next.output", "next.set_vlan_output", "next.l3_routing", "NoAction"],
-          "base_default_next" : "next.hashed",
+          "base_default_next" : null,
           "next_tables" : {
-            "next.output" : "next.hashed",
-            "next.set_vlan_output" : "next.hashed",
-            "next.l3_routing" : "next.hashed",
-            "NoAction" : "next.hashed"
+            "__HIT__" : "tbl_act_2",
+            "__MISS__" : "tbl_act_3"
           },
           "default_entry" : {
-            "action_id" : 10,
+            "action_id" : 8,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
           }
         },
         {
+          "name" : "tbl_act_2",
+          "id" : 13,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [34],
+          "actions" : ["act_2"],
+          "base_default_next" : "node_25",
+          "next_tables" : {
+            "act_2" : "node_25"
+          },
+          "default_entry" : {
+            "action_id" : 34,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_3",
+          "id" : 14,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [35],
+          "actions" : ["act_3"],
+          "base_default_next" : "node_25",
+          "next_tables" : {
+            "act_3" : "node_25"
+          },
+          "default_entry" : {
+            "action_id" : 35,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_4",
+          "id" : 15,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [36],
+          "actions" : ["act_4"],
+          "base_default_next" : "next.hashed",
+          "next_tables" : {
+            "act_4" : "next.hashed"
+          },
+          "default_entry" : {
+            "action_id" : 36,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_5",
+          "id" : 16,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [37],
+          "actions" : ["act_5"],
+          "base_default_next" : "next.hashed",
+          "next_tables" : {
+            "act_5" : "next.hashed"
+          },
+          "default_entry" : {
+            "action_id" : 37,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
           "name" : "next.hashed",
-          "id" : 11,
+          "id" : 17,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 106,
+            "line" : 98,
             "column" : 10,
             "source_fragment" : "hashed"
           },
@@ -5015,9 +4027,10 @@
           "type" : "indirect_ws",
           "action_profile" : "next.ecmp_selector",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [27, 29, 30, 11],
+          "action_ids" : [27, 29, 30, 9],
           "actions" : ["next.l3_routing", "next.mpls_routing_v4", "next.mpls_routing_v6", "NoAction"],
           "base_default_next" : "next.broadcast",
           "next_tables" : {
@@ -5029,10 +4042,10 @@
         },
         {
           "name" : "next.broadcast",
-          "id" : 12,
+          "id" : 18,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 132,
+            "line" : 120,
             "column" : 10,
             "source_fragment" : "broadcast"
           },
@@ -5046,25 +4059,26 @@
           "match_type" : "exact",
           "type" : "simple",
           "max_size" : 1024,
+          "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [28, 12],
+          "action_ids" : [28, 10],
           "actions" : ["next.set_mcast_group", "NoAction"],
-          "base_default_next" : "node_22",
+          "base_default_next" : "node_33",
           "next_tables" : {
-            "next.set_mcast_group" : "node_22",
-            "NoAction" : "node_22"
+            "next.set_mcast_group" : "node_33",
+            "NoAction" : "node_33"
           },
           "default_entry" : {
-            "action_id" : 12,
+            "action_id" : 10,
             "action_const" : false,
             "action_data" : [],
             "action_entry_const" : false
           }
         },
         {
-          "name" : "tbl_act_0",
-          "id" : 13,
+          "name" : "tbl_act_6",
+          "id" : 19,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -5072,22 +4086,22 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [32],
-          "actions" : ["act_0"],
-          "base_default_next" : "node_24",
+          "action_ids" : [38],
+          "actions" : ["act_6"],
+          "base_default_next" : "node_35",
           "next_tables" : {
-            "act_0" : "node_24"
+            "act_6" : "node_35"
           },
           "default_entry" : {
-            "action_id" : 32,
+            "action_id" : 38,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
           }
         },
         {
-          "name" : "tbl_act_1",
-          "id" : 14,
+          "name" : "tbl_act_7",
+          "id" : 20,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -5095,14 +4109,14 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [33],
-          "actions" : ["act_1"],
+          "action_ids" : [39],
+          "actions" : ["act_7"],
           "base_default_next" : null,
           "next_tables" : {
-            "act_1" : null
+            "act_7" : null
           },
           "default_entry" : {
-            "action_id" : 33,
+            "action_id" : 39,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -5119,27 +4133,15 @@
             "input" : [
               {
                 "type" : "field",
-                "value" : ["ipv4", "src_addr"]
+                "value" : ["ethernet", "dst_addr"]
               },
               {
                 "type" : "field",
-                "value" : ["ipv4", "dst_addr"]
+                "value" : ["ethernet", "src_addr"]
               },
               {
                 "type" : "field",
-                "value" : ["ipv4", "protocol"]
-              },
-              {
-                "type" : "field",
-                "value" : ["ipv6", "src_addr"]
-              },
-              {
-                "type" : "field",
-                "value" : ["ipv6", "dst_addr"]
-              },
-              {
-                "type" : "field",
-                "value" : ["ipv6", "next_hdr"]
+                "value" : ["scalars", "fabric_metadata_t.ip_proto"]
               },
               {
                 "type" : "field",
@@ -5185,7 +4187,7 @@
           "id" : 1,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 163,
+            "line" : 143,
             "column" : 11,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_BRIDGING"
           },
@@ -5211,7 +4213,7 @@
           "id" : 2,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 164,
+            "line" : 144,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_MPLS"
           },
@@ -5230,14 +4232,40 @@
             }
           },
           "true_next" : "forwarding.mpls",
-          "false_next" : "node_10"
+          "false_next" : "node_13"
         },
         {
           "name" : "node_10",
           "id" : 3,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 165,
+            "line" : 146,
+            "column" : 16,
+            "source_fragment" : "hdr.ipv4.isValid()"
+          },
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "==",
+              "left" : {
+                "type" : "field",
+                "value" : ["ipv4", "$valid$"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x01"
+              }
+            }
+          },
+          "true_next" : "tbl_act_0",
+          "false_next" : "tbl_act_1"
+        },
+        {
+          "name" : "node_13",
+          "id" : 4,
+          "source_info" : {
+            "filename" : "./include/control/forwarding.p4",
+            "line" : 154,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
@@ -5256,14 +4284,14 @@
             }
           },
           "true_next" : "forwarding.unicast_v4",
-          "false_next" : "node_12"
+          "false_next" : "node_15"
         },
         {
-          "name" : "node_12",
-          "id" : 4,
+          "name" : "node_15",
+          "id" : 5,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 166,
+            "line" : 155,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
           },
@@ -5282,14 +4310,14 @@
             }
           },
           "true_next" : "forwarding.multicast_v4",
-          "false_next" : "node_14"
+          "false_next" : "node_17"
         },
         {
-          "name" : "node_14",
-          "id" : 5,
+          "name" : "node_17",
+          "id" : 6,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 167,
+            "line" : 156,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_UNICAST"
           },
@@ -5308,14 +4336,14 @@
             }
           },
           "true_next" : "forwarding.unicast_v6",
-          "false_next" : "node_16"
+          "false_next" : "node_19"
         },
         {
-          "name" : "node_16",
-          "id" : 6,
+          "name" : "node_19",
+          "id" : 7,
           "source_info" : {
             "filename" : "./include/control/forwarding.p4",
-            "line" : 168,
+            "line" : 157,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_MULTICAST"
           },
@@ -5337,8 +4365,103 @@
           "false_next" : "forwarding.acl"
         },
         {
-          "name" : "node_22",
-          "id" : 7,
+          "name" : "node_25",
+          "id" : 8,
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "d2b",
+              "left" : null,
+              "right" : {
+                "type" : "field",
+                "value" : ["scalars", "next_tmp_0"]
+              }
+            }
+          },
+          "true_next" : "node_26",
+          "false_next" : "next.hashed"
+        },
+        {
+          "name" : "node_26",
+          "id" : 9,
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 131,
+            "column" : 17,
+            "source_fragment" : "hdr.mpls.isValid()"
+          },
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "!=",
+              "left" : {
+                "type" : "field",
+                "value" : ["mpls", "$valid$"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x01"
+              }
+            }
+          },
+          "true_next" : "node_27",
+          "false_next" : "next.hashed"
+        },
+        {
+          "name" : "node_27",
+          "id" : 10,
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 132,
+            "column" : 19,
+            "source_fragment" : "hdr.ipv4.isValid()"
+          },
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "==",
+              "left" : {
+                "type" : "field",
+                "value" : ["ipv4", "$valid$"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x01"
+              }
+            }
+          },
+          "true_next" : "tbl_act_4",
+          "false_next" : "node_29"
+        },
+        {
+          "name" : "node_29",
+          "id" : 11,
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 135,
+            "column" : 25,
+            "source_fragment" : "hdr.ipv6.isValid()"
+          },
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "==",
+              "left" : {
+                "type" : "field",
+                "value" : ["ipv6", "$valid$"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x01"
+              }
+            }
+          },
+          "true_next" : "tbl_act_5",
+          "false_next" : "next.hashed"
+        },
+        {
+          "name" : "node_33",
+          "id" : 12,
           "source_info" : {
             "filename" : "./include/control/port_counter.p4",
             "line" : 27,
@@ -5359,12 +4482,12 @@
               }
             }
           },
-          "true_next" : "tbl_act_0",
-          "false_next" : "node_24"
+          "true_next" : "tbl_act_6",
+          "false_next" : "node_35"
         },
         {
-          "name" : "node_24",
-          "id" : 8,
+          "name" : "node_35",
+          "id" : 13,
           "source_info" : {
             "filename" : "./include/control/port_counter.p4",
             "line" : 30,
@@ -5386,7 +4509,7 @@
             }
           },
           "false_next" : null,
-          "true_next" : "tbl_act_1"
+          "true_next" : "tbl_act_7"
         }
       ]
     },
@@ -5399,11 +4522,11 @@
         "column" : 8,
         "source_fragment" : "FabricEgress"
       },
-      "init_table" : "node_28",
+      "init_table" : "node_39",
       "tables" : [
         {
-          "name" : "tbl_act_2",
-          "id" : 15,
+          "name" : "tbl_act_8",
+          "id" : 21,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -5411,22 +4534,22 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [34],
-          "actions" : ["act_2"],
-          "base_default_next" : "tbl_act_3",
+          "action_ids" : [40],
+          "actions" : ["act_8"],
+          "base_default_next" : "tbl_act_10",
           "next_tables" : {
-            "act_2" : "tbl_act_3"
+            "act_8" : "tbl_act_10"
           },
           "default_entry" : {
-            "action_id" : 34,
+            "action_id" : 40,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
           }
         },
         {
-          "name" : "tbl_act_3",
-          "id" : 16,
+          "name" : "tbl_act_9",
+          "id" : 22,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -5434,22 +4557,22 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [36],
-          "actions" : ["act_4"],
-          "base_default_next" : "node_31",
+          "action_ids" : [41],
+          "actions" : ["act_9"],
+          "base_default_next" : "tbl_act_10",
           "next_tables" : {
-            "act_4" : "node_31"
+            "act_9" : "tbl_act_10"
           },
           "default_entry" : {
-            "action_id" : 36,
+            "action_id" : 41,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
           }
         },
         {
-          "name" : "tbl_act_4",
-          "id" : 17,
+          "name" : "tbl_act_10",
+          "id" : 23,
           "key" : [],
           "match_type" : "exact",
           "type" : "simple",
@@ -5457,14 +4580,37 @@
           "with_counters" : false,
           "support_timeout" : false,
           "direct_meters" : null,
-          "action_ids" : [35],
-          "actions" : ["act_3"],
+          "action_ids" : [42],
+          "actions" : ["act_10"],
+          "base_default_next" : "node_44",
+          "next_tables" : {
+            "act_10" : "node_44"
+          },
+          "default_entry" : {
+            "action_id" : 42,
+            "action_const" : true,
+            "action_data" : [],
+            "action_entry_const" : true
+          }
+        },
+        {
+          "name" : "tbl_act_11",
+          "id" : 24,
+          "key" : [],
+          "match_type" : "exact",
+          "type" : "simple",
+          "max_size" : 1024,
+          "with_counters" : false,
+          "support_timeout" : false,
+          "direct_meters" : null,
+          "action_ids" : [43],
+          "actions" : ["act_11"],
           "base_default_next" : null,
           "next_tables" : {
-            "act_3" : null
+            "act_11" : null
           },
           "default_entry" : {
-            "action_id" : 35,
+            "action_id" : 43,
             "action_const" : true,
             "action_data" : [],
             "action_entry_const" : true
@@ -5474,11 +4620,11 @@
       "action_profiles" : [],
       "conditionals" : [
         {
-          "name" : "node_28",
-          "id" : 9,
+          "name" : "node_39",
+          "id" : 14,
           "source_info" : {
             "filename" : "./include/control/next.p4",
-            "line" : 156,
+            "line" : 152,
             "column" : 12,
             "source_fragment" : "fabric_metadata.pop_vlan_at_egress"
           },
@@ -5493,12 +4639,38 @@
               }
             }
           },
-          "true_next" : "tbl_act_2",
-          "false_next" : "tbl_act_3"
+          "true_next" : "node_40",
+          "false_next" : "node_44"
         },
         {
-          "name" : "node_31",
-          "id" : 10,
+          "name" : "node_40",
+          "id" : 15,
+          "source_info" : {
+            "filename" : "./include/control/next.p4",
+            "line" : 153,
+            "column" : 16,
+            "source_fragment" : "hdr.mpls.isValid()"
+          },
+          "expression" : {
+            "type" : "expression",
+            "value" : {
+              "op" : "==",
+              "left" : {
+                "type" : "field",
+                "value" : ["mpls", "$valid$"]
+              },
+              "right" : {
+                "type" : "hexstr",
+                "value" : "0x01"
+              }
+            }
+          },
+          "true_next" : "tbl_act_8",
+          "false_next" : "tbl_act_9"
+        },
+        {
+          "name" : "node_44",
+          "id" : 16,
           "source_info" : {
             "filename" : "./include/control/packetio.p4",
             "line" : 38,
@@ -5520,7 +4692,7 @@
             }
           },
           "false_next" : null,
-          "true_next" : "tbl_act_4"
+          "true_next" : "tbl_act_11"
         }
       ]
     }
diff --git a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
index 45cfb71..d3d1dbf 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
+++ b/pipelines/fabric/src/main/resources/p4c-out/bmv2/fabric.p4info
@@ -32,10 +32,9 @@
     id: 16819938
   }
   action_refs {
-    id: 16793508
+    id: 16826365
   }
-  const_default_action_id: 16793508
-  direct_resource_ids: 302015144
+  const_default_action_id: 16826365
   size: 1024
 }
 tables {
@@ -58,7 +57,7 @@
   }
   match_fields {
     id: 3
-    name: "hdr.ethernet.ether_type"
+    name: "fabric_metadata.original_ether_type"
     bitwidth: 16
     match_type: EXACT
   }
@@ -66,7 +65,6 @@
     id: 16838162
   }
   const_default_action_id: 16838162
-  direct_resource_ids: 302033694
   size: 1024
 }
 tables {
@@ -94,7 +92,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 302047449
   size: 1024
 }
 tables {
@@ -116,7 +113,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 302001577
   size: 1024
 }
 tables {
@@ -138,7 +134,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 302038636
   size: 1024
 }
 tables {
@@ -166,7 +161,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 302009236
   size: 1024
 }
 tables {
@@ -188,7 +182,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 301998193
   size: 1024
 }
 tables {
@@ -216,7 +209,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 302003792
   size: 1024
 }
 tables {
@@ -239,41 +231,41 @@
   }
   match_fields {
     id: 3
+    name: "fabric_metadata.l4_src_port"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 4
+    name: "fabric_metadata.l4_dst_port"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
+    id: 5
     name: "hdr.ethernet.dst_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 4
+    id: 6
     name: "hdr.ethernet.src_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 5
-    name: "hdr.ethernet.ether_type"
+    id: 7
+    name: "fabric_metadata.original_ether_type"
     bitwidth: 16
     match_type: TERNARY
   }
   match_fields {
-    id: 6
+    id: 8
     name: "hdr.vlan_tag.vlan_id"
     bitwidth: 12
     match_type: TERNARY
   }
   match_fields {
-    id: 7
-    name: "hdr.vlan_tag.pri"
-    bitwidth: 3
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 8
-    name: "hdr.mpls.tc"
-    bitwidth: 3
-    match_type: TERNARY
-  }
-  match_fields {
     id: 9
     name: "hdr.mpls.bos"
     bitwidth: 1
@@ -299,60 +291,24 @@
   }
   match_fields {
     id: 13
-    name: "hdr.ipv4.protocol"
-    bitwidth: 8
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 14
     name: "hdr.ipv6.src_addr"
     bitwidth: 128
     match_type: TERNARY
   }
   match_fields {
-    id: 15
+    id: 14
     name: "hdr.ipv6.dst_addr"
     bitwidth: 128
     match_type: TERNARY
   }
   match_fields {
-    id: 16
-    name: "hdr.ipv6.next_hdr"
-    bitwidth: 8
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 17
-    name: "hdr.tcp.src_port"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 18
-    name: "hdr.tcp.dst_port"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 19
-    name: "hdr.udp.src_port"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 20
-    name: "hdr.udp.dst_port"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 21
+    id: 15
     name: "hdr.icmp.icmp_type"
     bitwidth: 8
     match_type: TERNARY
   }
   match_fields {
-    id: 22
+    id: 16
     name: "hdr.icmp.icmp_code"
     bitwidth: 8
     match_type: TERNARY
@@ -364,14 +320,13 @@
     id: 16805452
   }
   action_refs {
-    id: 16793508
+    id: 16815978
   }
   action_refs {
     id: 16819938
   }
   const_default_action_id: 16819938
-  direct_resource_ids: 302000008
-  size: 1024
+  size: 256
 }
 tables {
   preamble {
@@ -398,7 +353,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 301991179
   size: 1024
 }
 tables {
@@ -427,7 +381,6 @@
     annotations: "@defaultonly()"
   }
   implementation_id: 285225078
-  direct_resource_ids: 301993193
   size: 1024
 }
 tables {
@@ -449,7 +402,6 @@
     id: 16800567
     annotations: "@defaultonly()"
   }
-  direct_resource_ids: 301995093
   size: 1024
 }
 actions {
@@ -461,16 +413,16 @@
 }
 actions {
   preamble {
-    id: 16793508
-    name: "drop"
-    alias: "drop"
+    id: 16800567
+    name: "NoAction"
+    alias: "NoAction"
   }
 }
 actions {
   preamble {
-    id: 16800567
-    name: "NoAction"
-    alias: "NoAction"
+    id: 16826365
+    name: "filtering.drop"
+    alias: "filtering.drop"
   }
 }
 actions {
@@ -511,6 +463,13 @@
 }
 actions {
   preamble {
+    id: 16815978
+    name: "forwarding.drop"
+    alias: "forwarding.drop"
+  }
+}
+actions {
+  preamble {
     id: 16829931
     name: "forwarding.set_next_id"
     alias: "set_next_id"
@@ -694,138 +653,6 @@
   }
   size: 511
 }
-direct_counters {
-  preamble {
-    id: 302015144
-    name: "filtering.ingress_port_vlan_counter"
-    alias: "ingress_port_vlan_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33578399
-}
-direct_counters {
-  preamble {
-    id: 302033694
-    name: "filtering.fwd_classifier_counter"
-    alias: "fwd_classifier_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33619540
-}
-direct_counters {
-  preamble {
-    id: 302047449
-    name: "forwarding.bridging_counter"
-    alias: "bridging_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33569146
-}
-direct_counters {
-  preamble {
-    id: 302001577
-    name: "forwarding.mpls_counter"
-    alias: "mpls_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33565386
-}
-direct_counters {
-  preamble {
-    id: 302038636
-    name: "forwarding.unicast_v4_counter"
-    alias: "unicast_v4_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33589684
-}
-direct_counters {
-  preamble {
-    id: 302009236
-    name: "forwarding.multicast_v4_counter"
-    alias: "multicast_v4_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33615204
-}
-direct_counters {
-  preamble {
-    id: 301998193
-    name: "forwarding.unicast_v6_counter"
-    alias: "unicast_v6_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33608345
-}
-direct_counters {
-  preamble {
-    id: 302003792
-    name: "forwarding.multicast_v6_counter"
-    alias: "multicast_v6_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33592333
-}
-direct_counters {
-  preamble {
-    id: 302000008
-    name: "forwarding.acl_counter"
-    alias: "acl_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33587782
-}
-direct_counters {
-  preamble {
-    id: 301991179
-    name: "next.simple_counter"
-    alias: "simple_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33615740
-}
-direct_counters {
-  preamble {
-    id: 301993193
-    name: "next.hashed_counter"
-    alias: "hashed_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33569488
-}
-direct_counters {
-  preamble {
-    id: 301995093
-    name: "next.broadcast_counter"
-    alias: "broadcast_counter"
-  }
-  spec {
-    unit: BOTH
-  }
-  direct_table_id: 33608545
-}
 controller_packet_metadata {
   preamble {
     id: 2868941301
@@ -837,6 +664,11 @@
     name: "ingress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_pad"
+    bitwidth: 7
+  }
 }
 controller_packet_metadata {
   preamble {
@@ -849,4 +681,9 @@
     name: "egress_port"
     bitwidth: 9
   }
+  metadata {
+    id: 2
+    name: "_pad"
+    bitwidth: 7
+  }
 }