Fix VLAN and MPLS problem for fabric.p4
MPLS and VLAN won't work if we port fabric.p4 to PSA like architecture
Change-Id: Ife2ed4a09816981c712f4a3b78408536a21defee
diff --git a/pipelines/fabric/src/main/resources/include/control/next.p4 b/pipelines/fabric/src/main/resources/include/control/next.p4
index 79ac55b..2fbb866 100644
--- a/pipelines/fabric/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/src/main/resources/include/control/next.p4
@@ -63,7 +63,7 @@
action push_mpls (mpls_label_t label, bit<3> tc) {
// Suppose that the maximum number of label is one.
hdr.mpls.setValid();
- hdr.ethernet.ether_type = ETHERTYPE_MPLS;
+ hdr.vlan_tag.ether_type = ETHERTYPE_MPLS;
hdr.mpls.label = label;
hdr.mpls.tc = tc;
hdr.mpls.bos = 1w1; // BOS = TRUE
@@ -157,11 +157,7 @@
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.ethernet.ether_type = hdr.vlan_tag.ether_type;
hdr.vlan_tag.setInvalid();
}
}