INT transit for tofino (only with spgw enabled)
Because of recent update in p4c that uses different names for
P4 entities, requires manual search/replace in p4info/context.json
Change-Id: If7d6ea738710ef0c8786d9ff07f21f240fb6cedc
diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4
index 6cff586..6a48452 100644
--- a/pipelines/fabric/src/main/resources/include/header.p4
+++ b/pipelines/fabric/src/main/resources/include/header.p4
@@ -55,7 +55,8 @@
header ipv4_t {
bit<4> version;
bit<4> ihl;
- bit<8> diffserv;
+ bit<6> dscp;
+ bit<2> ecn;
bit<16> total_len;
bit<16> identification;
bit<3> flags;
@@ -131,7 +132,7 @@
}
struct spgw_meta_t {
- bool do_spgw;
+ bit<1> do_spgw;
direction_t direction;
bit<16> ipv4_len;
bit<32> teid;
@@ -147,6 +148,78 @@
}
#endif // WITH_SPGW
+#ifdef WITH_INT_TRANSIT
+
+header intl4_shim_t {
+ bit<8> int_type;
+ bit<8> rsvd1;
+ bit<8> len;
+ bit<8> rsvd2;
+}
+
+// INT headers
+header int_header_t {
+ bit<4> ver;
+ bit<2> rep;
+ bit<1> c;
+ bit<1> e;
+ bit<3> rsvd1;
+ bit<5> ins_cnt;
+ bit<8> max_hop_cnt;
+ bit<8> total_hop_cnt;
+ bit<4> instruction_mask_0003; // split the bits for lookup
+ bit<4> instruction_mask_0407;
+ bit<4> instruction_mask_0811;
+ bit<4> instruction_mask_1215;
+ bit<16> rsvd2;
+}
+
+// INT meta-value headers - different header for each value type
+header int_switch_id_t {
+ bit<32> switch_id;
+}
+
+header int_port_ids_t {
+ bit<16> ingress_port_id;
+ bit<16> egress_port_id;
+}
+
+header int_hop_latency_t {
+ bit<32> hop_latency;
+}
+
+header int_q_occupancy_t {
+ bit<8> q_id;
+ bit<24> q_occupancy;
+}
+
+header int_ingress_tstamp_t {
+ bit<32> ingress_tstamp;
+}
+
+header int_egress_tstamp_t {
+ bit<32> egress_tstamp;
+}
+
+header int_q_congestion_t {
+ bit<8> q_id;
+ bit<24> q_congestion;
+}
+
+header int_egress_port_tx_util_t {
+ bit<32> egress_port_tx_util;
+}
+
+// switch internal variables for INT logic implementation
+struct int_metadata_t {
+ bit<16> insert_byte_cnt;
+ bit<8> int_hdr_word_len;
+ bit<32> switch_id;
+ bit<5> ins_cnt_tmp;
+}
+
+#endif // WITH_INT_TRANSIT
+
//Custom metadata definition
struct fabric_metadata_t {
fwd_type_t fwd_type;
@@ -159,6 +232,9 @@
#ifdef WITH_SPGW
spgw_meta_t spgw;
#endif // WITH_SPGW
+#ifdef WITH_INT_TRANSIT
+ int_metadata_t int_metadata;
+#endif // WITH_INT_TRANSIT
}
struct parsed_headers_t {
@@ -180,6 +256,18 @@
icmp_t icmp;
packet_out_header_t packet_out;
packet_in_header_t packet_in;
+#ifdef WITH_INT_TRANSIT
+ intl4_shim_t intl4_shim;
+ int_header_t int_header;
+ int_switch_id_t int_switch_id;
+ int_port_ids_t int_port_ids;
+ int_hop_latency_t int_hop_latency;
+ int_q_occupancy_t int_q_occupancy;
+ int_ingress_tstamp_t int_ingress_tstamp;
+ int_egress_tstamp_t int_egress_tstamp;
+ int_q_congestion_t int_q_congestion;
+ int_egress_port_tx_util_t int_egress_port_tx_util;
+#endif // WITH_INT_TRANSIT
}
#endif