Minor refactor fabric.p4

Remove origin_ether_type from fabric.p4
We can use ether_type from VLAN header since ingress_port_vlan table
always push a VLAN header to the packet if there is no VLAN header.

For configured interface, there exists flow rules to push VLAN.
For ports which not configured (infrastructure ports), the segment routing
application installs a rule which pushed internal VLAN to the packet (4094)

Change-Id: Ifae0b79a9d92b73a2a22cb33864e5bd5b6c95bfb
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 fed205c..258e414 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
@@ -33,8 +33,6 @@
     }
 
     // Header field IDs
-    public static final PiMatchFieldId STANDARD_METADATA_EGRESS_PORT =
-            PiMatchFieldId.of("standard_metadata.egress_port");
     public static final PiMatchFieldId FABRIC_METADATA_L4_SRC_PORT =
             PiMatchFieldId.of("fabric_metadata.l4_src_port");
     public static final PiMatchFieldId SPGW_META_S1U_SGW_ADDR =
@@ -51,16 +49,18 @@
             PiMatchFieldId.of("hdr.ethernet.src_addr");
     public static final PiMatchFieldId HDR_ICMP_ICMP_TYPE =
             PiMatchFieldId.of("hdr.icmp.icmp_type");
+    public static final PiMatchFieldId STANDARD_METADATA_EGRESS_PORT =
+            PiMatchFieldId.of("standard_metadata.egress_port");
     public static final PiMatchFieldId FABRIC_METADATA_NEXT_ID =
             PiMatchFieldId.of("fabric_metadata.next_id");
-    public static final PiMatchFieldId HDR_IPV4_DST_ADDR =
-            PiMatchFieldId.of("hdr.ipv4.dst_addr");
     public static final PiMatchFieldId FABRIC_METADATA_L4_DST_PORT =
             PiMatchFieldId.of("fabric_metadata.l4_dst_port");
+    public static final PiMatchFieldId HDR_VLAN_TAG_ETHER_TYPE =
+            PiMatchFieldId.of("hdr.vlan_tag.ether_type");
     public static final PiMatchFieldId STANDARD_METADATA_INGRESS_PORT =
             PiMatchFieldId.of("standard_metadata.ingress_port");
-    public static final PiMatchFieldId FABRIC_METADATA_ORIGINAL_ETHER_TYPE =
-            PiMatchFieldId.of("fabric_metadata.original_ether_type");
+    public static final PiMatchFieldId HDR_IPV4_DST_ADDR =
+            PiMatchFieldId.of("hdr.ipv4.dst_addr");
     public static final PiMatchFieldId IPV4_DST_ADDR =
             PiMatchFieldId.of("ipv4.dst_addr");
     public static final PiMatchFieldId HDR_VLAN_TAG_IS_VALID =
@@ -235,4 +235,4 @@
             PiControlMetadataId.of("ingress_port");
     public static final PiControlMetadataId EGRESS_PORT =
             PiControlMetadataId.of("egress_port");
-}
+}
\ No newline at end of file
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 5381e36..6031afd 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
@@ -108,16 +108,12 @@
                     .put(Criterion.Type.IN_PORT, FabricConstants.STANDARD_METADATA_INGRESS_PORT)
                     .put(Criterion.Type.ETH_DST, FabricConstants.HDR_ETHERNET_DST_ADDR)
                     .put(Criterion.Type.ETH_SRC, FabricConstants.HDR_ETHERNET_SRC_ADDR)
-                    .put(Criterion.Type.ETH_TYPE, FabricConstants.FABRIC_METADATA_ORIGINAL_ETHER_TYPE)
+                    .put(Criterion.Type.ETH_TYPE, FabricConstants.HDR_VLAN_TAG_ETHER_TYPE)
                     .put(Criterion.Type.MPLS_LABEL, FabricConstants.HDR_MPLS_LABEL)
                     .put(Criterion.Type.VLAN_VID, FabricConstants.HDR_VLAN_TAG_VLAN_ID)
                     .put(Criterion.Type.IPV4_DST, FabricConstants.HDR_IPV4_DST_ADDR)
                     .put(Criterion.Type.IPV4_SRC, FabricConstants.HDR_IPV4_SRC_ADDR)
                     .put(Criterion.Type.IPV6_DST, FabricConstants.HDR_IPV6_DST_ADDR)
-                    .put(Criterion.Type.TCP_SRC, FabricConstants.FABRIC_METADATA_L4_SRC_PORT)
-                    .put(Criterion.Type.TCP_DST, FabricConstants.FABRIC_METADATA_L4_DST_PORT)
-                    .put(Criterion.Type.UDP_SRC, FabricConstants.FABRIC_METADATA_L4_SRC_PORT)
-                    .put(Criterion.Type.UDP_DST, FabricConstants.FABRIC_METADATA_L4_DST_PORT)
                     .put(Criterion.Type.IP_PROTO, FabricConstants.FABRIC_METADATA_IP_PROTO)
                     .put(Criterion.Type.ICMPV6_TYPE, FabricConstants.HDR_ICMP_ICMP_TYPE)
                     .put(Criterion.Type.ICMPV6_CODE, FabricConstants.HDR_ICMP_ICMP_CODE)
@@ -128,7 +124,7 @@
                     .put(FabricConstants.STANDARD_METADATA_INGRESS_PORT, Criterion.Type.IN_PORT)
                     .put(FabricConstants.HDR_ETHERNET_DST_ADDR, Criterion.Type.ETH_DST)
                     .put(FabricConstants.HDR_ETHERNET_SRC_ADDR, Criterion.Type.ETH_SRC)
-                    .put(FabricConstants.FABRIC_METADATA_ORIGINAL_ETHER_TYPE, Criterion.Type.ETH_TYPE)
+                    .put(FabricConstants.HDR_VLAN_TAG_ETHER_TYPE, Criterion.Type.ETH_TYPE)
                     .put(FabricConstants.HDR_MPLS_LABEL, Criterion.Type.MPLS_LABEL)
                     .put(FabricConstants.HDR_VLAN_TAG_VLAN_ID, Criterion.Type.VLAN_VID)
                     .put(FabricConstants.HDR_IPV4_DST_ADDR, Criterion.Type.IPV4_DST)
diff --git a/pipelines/fabric/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/src/main/resources/include/control/filtering.p4
index 050ee8d..c5030d7 100644
--- a/pipelines/fabric/src/main/resources/include/control/filtering.p4
+++ b/pipelines/fabric/src/main/resources/include/control/filtering.p4
@@ -99,7 +99,7 @@
         key = {
             standard_metadata.ingress_port: exact;
             hdr.ethernet.dst_addr: exact;
-            fabric_metadata.original_ether_type: exact;
+            hdr.vlan_tag.ether_type: exact;
         }
 
         actions = {
diff --git a/pipelines/fabric/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
index 9d6deaa..6098ed3 100644
--- a/pipelines/fabric/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/src/main/resources/include/control/forwarding.p4
@@ -130,11 +130,11 @@
             fabric_metadata.ip_proto: ternary; // 8
             fabric_metadata.l4_src_port: ternary; // 16
             fabric_metadata.l4_dst_port: ternary; // 16
-            fabric_metadata.original_ether_type: ternary; //16
 
             hdr.ethernet.dst_addr: ternary; // 48
             hdr.ethernet.src_addr: ternary; // 48
             hdr.vlan_tag.vlan_id: ternary; // 12
+            hdr.vlan_tag.ether_type: ternary; //16
             hdr.ipv4.src_addr: ternary; // 32
             hdr.ipv4.dst_addr: ternary; // 32
             hdr.icmp.icmp_type: ternary; // 8
@@ -150,7 +150,7 @@
         }
 
         const default_action = nop();
-        size = 256;
+        size = 128;
         counters = acl_counter;
     }
 
@@ -234,7 +234,6 @@
 
             // TODO: IPv6
             hdr.vlan_tag.ether_type = ETHERTYPE_IPV4;
-            fabric_metadata.original_ether_type = ETHERTYPE_IPV4;
         }
         else if (fabric_metadata.fwd_type == FWD_IPV4_UNICAST) unicast_v4.apply();
 #ifdef WITH_MULTICAST
diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4
index 1bff3da..bc0b18f 100644
--- a/pipelines/fabric/src/main/resources/include/header.p4
+++ b/pipelines/fabric/src/main/resources/include/header.p4
@@ -157,7 +157,6 @@
     bit<8> ip_proto;
     bit<16> l4_src_port;
     bit<16> l4_dst_port;
-    bit<16> original_ether_type;
 #ifdef WITH_SPGW
     spgw_meta_t spgw;
 #endif // WITH_SPGW
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index 5c99838..3f70f3e 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -39,7 +39,6 @@
 
     state parse_ethernet {
         packet.extract(hdr.ethernet);
-        fabric_metadata.original_ether_type = hdr.ethernet.ether_type;
         transition select(hdr.ethernet.ether_type){
             ETHERTYPE_VLAN: parse_vlan_tag;
             ETHERTYPE_MPLS: parse_mpls;
@@ -54,7 +53,6 @@
 
     state parse_vlan_tag {
         packet.extract(hdr.vlan_tag);
-        fabric_metadata.original_ether_type = hdr.vlan_tag.ether_type;
         transition select(hdr.vlan_tag.ether_type){
             ETHERTYPE_ARP: parse_arp;
             ETHERTYPE_IPV4: parse_ipv4;
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/bmv2.json b/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/bmv2.json
index 62d1361..9d4a06b 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/bmv2.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/bmv2.json
@@ -23,7 +23,6 @@
         ["fabric_metadata_t.ip_proto", 8, false],
         ["fabric_metadata_t.l4_src_port", 16, false],
         ["fabric_metadata_t.l4_dst_port", 16, false],
-        ["fabric_metadata_t.original_ether_type", 16, false],
         ["_padding_1", 6, false]
       ]
     },
@@ -403,19 +402,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["ethernet", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -474,19 +460,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["vlan_tag", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -967,7 +940,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "include/parser.p4",
-        "line" : 165,
+        "line" : 163,
         "column" : 8,
         "source_fragment" : "FabricDeparser"
       },
@@ -3828,25 +3801,6 @@
             "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" : 69,
-            "column" : 31,
-            "source_fragment" : "0x0800; ..."
-          }
         }
       ]
     },
@@ -5699,8 +5653,8 @@
             },
             {
               "match_type" : "exact",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
               "mask" : null
             }
           ],
@@ -6022,12 +5976,6 @@
             },
             {
               "match_type" : "ternary",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "name" : "hdr.ethernet.dst_addr",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
@@ -6046,6 +5994,12 @@
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
               "name" : "hdr.ipv4.src_addr",
               "target" : ["ipv4", "src_addr"],
               "mask" : null
@@ -6071,7 +6025,7 @@
           ],
           "match_type" : "ternary",
           "type" : "simple",
-          "max_size" : 256,
+          "max_size" : 128,
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
@@ -6821,7 +6775,7 @@
           "id" : 11,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 239,
+            "line" : 238,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
@@ -6847,7 +6801,7 @@
           "id" : 12,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 241,
+            "line" : 240,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_MULTICAST"
           },
@@ -6873,7 +6827,7 @@
           "id" : 13,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 244,
+            "line" : 243,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_UNICAST"
           },
@@ -6899,7 +6853,7 @@
           "id" : 14,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 246,
+            "line" : 245,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV6_MULTICAST"
           },
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/p4info.txt b/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/p4info.txt
index 4aaf7bb..42a17dc 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/p4info.txt
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-full/bmv2/default/p4info.txt
@@ -141,7 +141,7 @@
   }
   match_fields {
     id: 3
-    name: "fabric_metadata.original_ether_type"
+    name: "hdr.vlan_tag.ether_type"
     bitwidth: 16
     match_type: EXACT
   }
@@ -260,29 +260,29 @@
   }
   match_fields {
     id: 5
-    name: "fabric_metadata.original_ether_type"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 6
     name: "hdr.ethernet.dst_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 7
+    id: 6
     name: "hdr.ethernet.src_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 8
+    id: 7
     name: "hdr.vlan_tag.vlan_id"
     bitwidth: 12
     match_type: TERNARY
   }
   match_fields {
+    id: 8
+    name: "hdr.vlan_tag.ether_type"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
     id: 9
     name: "hdr.ipv4.src_addr"
     bitwidth: 32
@@ -324,7 +324,7 @@
   }
   const_default_action_id: 16819938
   direct_resource_ids: 318772272
-  size: 256
+  size: 128
   idle_timeout_behavior: NO_TIMEOUT
 }
 tables {
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/bmv2.json b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/bmv2.json
index 14fa6ca..f0f4ba3 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/bmv2.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/bmv2.json
@@ -23,7 +23,6 @@
         ["fabric_metadata_t.ip_proto", 8, false],
         ["fabric_metadata_t.l4_src_port", 16, false],
         ["fabric_metadata_t.l4_dst_port", 16, false],
-        ["fabric_metadata_t.original_ether_type", 16, false],
         ["_padding_1", 6, false]
       ]
     },
@@ -382,19 +381,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["ethernet", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -447,19 +433,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["vlan_tag", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -869,7 +842,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "include/parser.p4",
-        "line" : 165,
+        "line" : 163,
         "column" : 8,
         "source_fragment" : "FabricDeparser"
       },
@@ -3601,25 +3574,6 @@
             "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" : 69,
-            "column" : 31,
-            "source_fragment" : "0x0800; ..."
-          }
         }
       ]
     },
@@ -5423,8 +5377,8 @@
             },
             {
               "match_type" : "exact",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
               "mask" : null
             }
           ],
@@ -5623,12 +5577,6 @@
             },
             {
               "match_type" : "ternary",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "name" : "hdr.ethernet.dst_addr",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
@@ -5647,6 +5595,12 @@
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
               "name" : "hdr.ipv4.src_addr",
               "target" : ["ipv4", "src_addr"],
               "mask" : null
@@ -5672,7 +5626,7 @@
           ],
           "match_type" : "ternary",
           "type" : "simple",
-          "max_size" : 256,
+          "max_size" : 128,
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
@@ -6399,7 +6353,7 @@
           "id" : 11,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 247,
+            "line" : 246,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/p4info.txt b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/p4info.txt
index b82cd69..f480540 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/p4info.txt
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw/bmv2/default/p4info.txt
@@ -141,7 +141,7 @@
   }
   match_fields {
     id: 3
-    name: "fabric_metadata.original_ether_type"
+    name: "hdr.vlan_tag.ether_type"
     bitwidth: 16
     match_type: EXACT
   }
@@ -260,29 +260,29 @@
   }
   match_fields {
     id: 5
-    name: "fabric_metadata.original_ether_type"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 6
     name: "hdr.ethernet.dst_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 7
+    id: 6
     name: "hdr.ethernet.src_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 8
+    id: 7
     name: "hdr.vlan_tag.vlan_id"
     bitwidth: 12
     match_type: TERNARY
   }
   match_fields {
+    id: 8
+    name: "hdr.vlan_tag.ether_type"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
     id: 9
     name: "hdr.ipv4.src_addr"
     bitwidth: 32
@@ -324,7 +324,7 @@
   }
   const_default_action_id: 16819938
   direct_resource_ids: 318772272
-  size: 256
+  size: 128
   idle_timeout_behavior: NO_TIMEOUT
 }
 tables {
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/bmv2.json b/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/bmv2.json
index 5186f59..13e607d 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/bmv2.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/bmv2.json
@@ -19,7 +19,6 @@
         ["fabric_metadata_t.ip_proto", 8, false],
         ["fabric_metadata_t.l4_src_port", 16, false],
         ["fabric_metadata_t.l4_dst_port", 16, false],
-        ["fabric_metadata_t.original_ether_type", 16, false],
         ["_padding_0", 2, false]
       ]
     },
@@ -322,19 +321,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["ethernet", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -387,19 +373,6 @@
                 }
               ],
               "op" : "extract"
-            },
-            {
-              "parameters" : [
-                {
-                  "type" : "field",
-                  "value" : ["scalars", "fabric_metadata_t.original_ether_type"]
-                },
-                {
-                  "type" : "field",
-                  "value" : ["vlan_tag", "ether_type"]
-                }
-              ],
-              "op" : "set"
             }
           ],
           "transitions" : [
@@ -694,7 +667,7 @@
       "id" : 0,
       "source_info" : {
         "filename" : "include/parser.p4",
-        "line" : 165,
+        "line" : 163,
         "column" : 8,
         "source_fragment" : "FabricDeparser"
       },
@@ -2683,25 +2656,6 @@
             "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" : 69,
-            "column" : 31,
-            "source_fragment" : "0x0800; ..."
-          }
         }
       ]
     },
@@ -3410,8 +3364,8 @@
             },
             {
               "match_type" : "exact",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
               "mask" : null
             }
           ],
@@ -3610,12 +3564,6 @@
             },
             {
               "match_type" : "ternary",
-              "name" : "fabric_metadata.original_ether_type",
-              "target" : ["scalars", "fabric_metadata_t.original_ether_type"],
-              "mask" : null
-            },
-            {
-              "match_type" : "ternary",
               "name" : "hdr.ethernet.dst_addr",
               "target" : ["ethernet", "dst_addr"],
               "mask" : null
@@ -3634,6 +3582,12 @@
             },
             {
               "match_type" : "ternary",
+              "name" : "hdr.vlan_tag.ether_type",
+              "target" : ["vlan_tag", "ether_type"],
+              "mask" : null
+            },
+            {
+              "match_type" : "ternary",
               "name" : "hdr.ipv4.src_addr",
               "target" : ["ipv4", "src_addr"],
               "mask" : null
@@ -3659,7 +3613,7 @@
           ],
           "match_type" : "ternary",
           "type" : "simple",
-          "max_size" : 256,
+          "max_size" : 128,
           "with_counters" : true,
           "support_timeout" : false,
           "direct_meters" : null,
@@ -4190,7 +4144,7 @@
           "id" : 3,
           "source_info" : {
             "filename" : "include/control/forwarding.p4",
-            "line" : 247,
+            "line" : 246,
             "column" : 17,
             "source_fragment" : "fabric_metadata.fwd_type == FWD_IPV4_UNICAST"
           },
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/p4info.txt b/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/p4info.txt
index e936930..d018058 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/p4info.txt
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric/bmv2/default/p4info.txt
@@ -60,7 +60,7 @@
   }
   match_fields {
     id: 3
-    name: "fabric_metadata.original_ether_type"
+    name: "hdr.vlan_tag.ether_type"
     bitwidth: 16
     match_type: EXACT
   }
@@ -179,29 +179,29 @@
   }
   match_fields {
     id: 5
-    name: "fabric_metadata.original_ether_type"
-    bitwidth: 16
-    match_type: TERNARY
-  }
-  match_fields {
-    id: 6
     name: "hdr.ethernet.dst_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 7
+    id: 6
     name: "hdr.ethernet.src_addr"
     bitwidth: 48
     match_type: TERNARY
   }
   match_fields {
-    id: 8
+    id: 7
     name: "hdr.vlan_tag.vlan_id"
     bitwidth: 12
     match_type: TERNARY
   }
   match_fields {
+    id: 8
+    name: "hdr.vlan_tag.ether_type"
+    bitwidth: 16
+    match_type: TERNARY
+  }
+  match_fields {
     id: 9
     name: "hdr.ipv4.src_addr"
     bitwidth: 32
@@ -243,7 +243,7 @@
   }
   const_default_action_id: 16819938
   direct_resource_ids: 318772272
-  size: 256
+  size: 128
   idle_timeout_behavior: NO_TIMEOUT
 }
 tables {