eth_type moved outside ethernet header in fabric.p4
Change-Id: I3ae0813c5e8aba48767d5bb235fbbcfb75954010
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/acl.p4 b/pipelines/fabric/impl/src/main/resources/include/control/acl.p4
index 4c2df67..26267e9 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/acl.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/acl.p4
@@ -66,7 +66,7 @@
hdr.ethernet.dst_addr: ternary @name("eth_src"); // 48
hdr.ethernet.src_addr: ternary @name("eth_dst"); // 48
hdr.vlan_tag.vlan_id: ternary @name("vlan_id"); // 12
- fabric_metadata.last_eth_type: ternary @name("eth_type"); //16
+ hdr.eth_type.value: ternary @name("eth_type"); //16
hdr.ipv4.src_addr: ternary @name("ipv4_src"); // 32
hdr.ipv4.dst_addr: ternary @name("ipv4_dst"); // 32
hdr.icmp.icmp_type: ternary @name("icmp_type"); // 8
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4 b/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
index a3213e9..17dba78 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/filtering.p4
@@ -91,9 +91,8 @@
key = {
standard_metadata.ingress_port : exact @name("ig_port");
hdr.ethernet.dst_addr : ternary @name("eth_dst");
- fabric_metadata.is_ipv4 : exact @name("is_ipv4");
- fabric_metadata.is_ipv6 : exact @name("is_ipv6");
- fabric_metadata.is_mpls : exact @name("is_mpls");
+ hdr.eth_type.value : ternary @name("eth_type");
+ fabric_metadata.ip_eth_type : exact @name("ip_eth_type");
}
actions = {
set_forwarding_type;
@@ -126,22 +125,6 @@
fabric_metadata.mpls_ttl = DEFAULT_MPLS_TTL + 1;
}
- // Set last_eth_type checking the validity of the L2.5 headers
- if (hdr.mpls.isValid()) {
- fabric_metadata.last_eth_type = ETHERTYPE_MPLS;
- } else {
- if (hdr.vlan_tag.isValid()) {
-#if defined(WITH_XCONNECT) || defined(WITH_BNG) || defined(WITH_DOUBLE_VLAN_TERMINATION)
- if(hdr.inner_vlan_tag.isValid()) {
- fabric_metadata.last_eth_type = hdr.inner_vlan_tag.eth_type;
- } else
-#endif // WITH_XCONNECT || WITH_BNG || WITH_DOUBLE_VLAN_TERMINATION
- fabric_metadata.last_eth_type = hdr.vlan_tag.eth_type;
- } else {
- fabric_metadata.last_eth_type = hdr.ethernet.eth_type;
- }
- }
-
ingress_port_vlan.apply();
fwd_classifier.apply();
}
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/forwarding.p4 b/pipelines/fabric/impl/src/main/resources/include/control/forwarding.p4
index 89544ea..7348c59 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/forwarding.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/forwarding.p4
@@ -84,15 +84,22 @@
/*
* IPv4 Routing Table.
*/
+#ifdef WTIH_DEBUG
direct_counter(CounterType.packets_and_bytes) routing_v4_counter;
+#endif // WITH_DEBUG
action set_next_id_routing_v4(next_id_t next_id) {
set_next_id(next_id);
+#ifdef WTIH_DEBUG
routing_v4_counter.count();
+#endif // WITH_DEBUG
}
action nop_routing_v4() {
+ // no-op
+#ifdef WTIH_DEBUG
routing_v4_counter.count();
+#endif // WITH_DEBUG
}
#ifdef _ROUTING_V4_TABLE_ANNOT
@@ -108,7 +115,9 @@
@defaultonly nop;
}
const default_action = nop();
+#ifdef WTIH_DEBUG
counters = routing_v4_counter;
+#endif // WITH_DEBUG
size = ROUTING_V4_TABLE_SIZE;
}
diff --git a/pipelines/fabric/impl/src/main/resources/include/control/next.p4 b/pipelines/fabric/impl/src/main/resources/include/control/next.p4
index e7f6e44..2ea719a 100644
--- a/pipelines/fabric/impl/src/main/resources/include/control/next.p4
+++ b/pipelines/fabric/impl/src/main/resources/include/control/next.p4
@@ -104,7 +104,6 @@
action output_xconnect(port_num_t port_num) {
output(port_num);
- fabric_metadata.last_eth_type = ETHERTYPE_VLAN;
xconnect_counter.count();
}
@@ -174,6 +173,9 @@
* Execute an action profile selector based on next id.
*/
@max_group_size(HASHED_SELECTOR_MAX_GROUP_SIZE)
+ #ifdef _CUSTOM_HASHED_SELECTOR_ANNOTATION
+ _CUSTOM_HASHED_SELECTOR_ANNOTATION
+ #endif
action_selector(HashAlgorithm.crc16, HASHED_ACT_PROFILE_SIZE, 32w16) hashed_selector;
direct_counter(CounterType.packets_and_bytes) hashed_counter;
@@ -263,7 +265,7 @@
action pop_mpls_if_present() {
hdr.mpls.setInvalid();
// Assuming there's an IP header after the MPLS one.
- fabric_metadata.last_eth_type = fabric_metadata.ip_eth_type;
+ hdr.eth_type.value = fabric_metadata.ip_eth_type;
}
@hidden
@@ -273,7 +275,7 @@
hdr.mpls.tc = 3w0;
hdr.mpls.bos = 1w1; // BOS = TRUE
hdr.mpls.ttl = fabric_metadata.mpls_ttl; // Decrement after push.
- fabric_metadata.last_eth_type = ETHERTYPE_MPLS;
+ hdr.eth_type.value = ETHERTYPE_MPLS;
}
@hidden
@@ -283,23 +285,20 @@
hdr.vlan_tag.setValid();
hdr.vlan_tag.cfi = fabric_metadata.vlan_cfi;
hdr.vlan_tag.pri = fabric_metadata.vlan_pri;
- hdr.vlan_tag.eth_type = fabric_metadata.last_eth_type;
+ hdr.vlan_tag.eth_type = ETHERTYPE_VLAN;
hdr.vlan_tag.vlan_id = fabric_metadata.vlan_id;
- hdr.ethernet.eth_type = ETHERTYPE_VLAN;
}
#ifdef WITH_DOUBLE_VLAN_TERMINATION
@hidden
action push_inner_vlan() {
- // Then push inner VLAN TAG, rewriting correclty the outer vlan eth_type
- // and the ethernet eth_type
+ // Push inner VLAN TAG, rewriting correclty the outer vlan eth_type
hdr.inner_vlan_tag.setValid();
hdr.inner_vlan_tag.cfi = fabric_metadata.inner_vlan_cfi;
hdr.inner_vlan_tag.pri = fabric_metadata.inner_vlan_pri;
hdr.inner_vlan_tag.vlan_id = fabric_metadata.inner_vlan_id;
- hdr.inner_vlan_tag.eth_type = fabric_metadata.last_eth_type;
+ hdr.inner_vlan_tag.eth_type = ETHERTYPE_VLAN;
hdr.vlan_tag.eth_type = ETHERTYPE_VLAN;
- hdr.ethernet.eth_type = ETHERTYPE_QINQ;
}
#endif // WITH_DOUBLE_VLAN_TERMINATION
@@ -310,7 +309,6 @@
direct_counter(CounterType.packets_and_bytes) egress_vlan_counter;
action pop_vlan() {
- hdr.ethernet.eth_type = fabric_metadata.last_eth_type;
hdr.vlan_tag.setInvalid();
egress_vlan_counter.count();
}