In fabric.p4 do not parse int_data if sink is not enabled
Change-Id: Ie4d5b9ccdf31ea1142945365fca7db7b8d4ae3f9
diff --git a/pipelines/fabric/src/main/resources/include/header.p4 b/pipelines/fabric/src/main/resources/include/header.p4
index 46fa022..df29408 100644
--- a/pipelines/fabric/src/main/resources/include/header.p4
+++ b/pipelines/fabric/src/main/resources/include/header.p4
@@ -209,7 +209,9 @@
int_egress_tstamp_t int_egress_tstamp;
int_q_congestion_t int_q_congestion;
int_egress_port_tx_util_t int_egress_tx_util;
+#ifdef WITH_INT_SINK
int_data_t int_data;
+#endif // WITH_INT_SINK
intl4_tail_t intl4_tail;
#endif //WITH_INT
}
diff --git a/pipelines/fabric/src/main/resources/include/int/int_header.p4 b/pipelines/fabric/src/main/resources/include/int/int_header.p4
index 4e352ee..9b1f0e4 100644
--- a/pipelines/fabric/src/main/resources/include/int/int_header.p4
+++ b/pipelines/fabric/src/main/resources/include/int/int_header.p4
@@ -62,11 +62,13 @@
bit<6> dscp;
}
+#ifdef WITH_INT_SINK
header int_data_t {
// Maximum int metadata stack size in bits:
// (0xFF -4) * 32 (excluding INT shim header, tail header and INT header)
varbit<8032> data;
}
+#endif // WITH_INT_SINK
#ifdef WITH_INT_TRANSIT
// INT meta-value headers - 4 bytes each
diff --git a/pipelines/fabric/src/main/resources/include/parser.p4 b/pipelines/fabric/src/main/resources/include/parser.p4
index 3f77df9..6aef63b 100644
--- a/pipelines/fabric/src/main/resources/include/parser.p4
+++ b/pipelines/fabric/src/main/resources/include/parser.p4
@@ -263,7 +263,9 @@
packet.emit(hdr.int_q_congestion);
packet.emit(hdr.int_egress_tx_util);
#endif // WITH_INT_TRANSIT
+#ifdef WITH_INT_SINK
packet.emit(hdr.int_data);
+#endif // WITH_INT_SINK
packet.emit(hdr.intl4_tail);
#endif // WITH_INT
}
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-int/bmv2/default/bmv2.json b/pipelines/fabric/src/main/resources/p4c-out/fabric-int/bmv2/default/bmv2.json
index 4f390ee..9f51572 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-int/bmv2/default/bmv2.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-int/bmv2/default/bmv2.json
@@ -257,16 +257,8 @@
]
},
{
- "name" : "int_data_t",
- "id" : 22,
- "fields" : [
- ["data", "*"]
- ],
- "max_length" : 1004
- },
- {
"name" : "intl4_tail_t",
- "id" : 23,
+ "id" : 22,
"fields" : [
["next_proto", 8, false],
["dest_port", 16, false],
@@ -276,7 +268,7 @@
},
{
"name" : "int_metadata_t",
- "id" : 24,
+ "id" : 23,
"fields" : [
["source", 1, 0],
["transit", 1, 0],
@@ -446,22 +438,15 @@
"pi_omit" : true
},
{
- "name" : "int_data",
- "id" : 22,
- "header_type" : "int_data_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
"name" : "intl4_tail",
- "id" : 23,
+ "id" : 22,
"header_type" : "intl4_tail_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "userMetadata.int_meta",
- "id" : 24,
+ "id" : 23,
"header_type" : "int_metadata_t",
"metadata" : true,
"pi_omit" : true
@@ -1017,7 +1002,7 @@
"column" : 8,
"source_fragment" : "FabricDeparser"
},
- "order" : ["packet_in", "ethernet", "vlan_tag", "mpls", "arp", "ipv4", "tcp", "udp", "icmp", "intl4_shim", "int_header", "int_switch_id", "int_port_ids", "int_hop_latency", "int_q_occupancy", "int_ingress_tstamp", "int_egress_tstamp", "int_q_congestion", "int_egress_tx_util", "int_data", "intl4_tail"]
+ "order" : ["packet_in", "ethernet", "vlan_tag", "mpls", "arp", "ipv4", "tcp", "udp", "icmp", "intl4_shim", "int_header", "int_switch_id", "int_port_ids", "int_hop_latency", "int_q_occupancy", "int_ingress_tstamp", "int_egress_tstamp", "int_q_congestion", "int_egress_tx_util", "intl4_tail"]
}
],
"meter_arrays" : [],
diff --git a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw-int/bmv2/default/bmv2.json b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw-int/bmv2/default/bmv2.json
index a4cce10..5672dc8 100644
--- a/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw-int/bmv2/default/bmv2.json
+++ b/pipelines/fabric/src/main/resources/p4c-out/fabric-spgw-int/bmv2/default/bmv2.json
@@ -277,16 +277,8 @@
]
},
{
- "name" : "int_data_t",
- "id" : 23,
- "fields" : [
- ["data", "*"]
- ],
- "max_length" : 1004
- },
- {
"name" : "intl4_tail_t",
- "id" : 24,
+ "id" : 23,
"fields" : [
["next_proto", 8, false],
["dest_port", 16, false],
@@ -296,7 +288,7 @@
},
{
"name" : "spgw_meta_t",
- "id" : 25,
+ "id" : 24,
"fields" : [
["direction", 2, false],
["ipv4_len", 16, false],
@@ -308,7 +300,7 @@
},
{
"name" : "int_metadata_t",
- "id" : 26,
+ "id" : 25,
"fields" : [
["source", 1, 0],
["transit", 1, 0],
@@ -513,29 +505,22 @@
"pi_omit" : true
},
{
- "name" : "int_data",
- "id" : 27,
- "header_type" : "int_data_t",
- "metadata" : false,
- "pi_omit" : true
- },
- {
"name" : "intl4_tail",
- "id" : 28,
+ "id" : 27,
"header_type" : "intl4_tail_t",
"metadata" : false,
"pi_omit" : true
},
{
"name" : "userMetadata.spgw",
- "id" : 29,
+ "id" : 28,
"header_type" : "spgw_meta_t",
"metadata" : true,
"pi_omit" : true
},
{
"name" : "userMetadata.int_meta",
- "id" : 30,
+ "id" : 29,
"header_type" : "int_metadata_t",
"metadata" : true,
"pi_omit" : true
@@ -1285,7 +1270,7 @@
"column" : 8,
"source_fragment" : "FabricDeparser"
},
- "order" : ["packet_in", "ethernet", "vlan_tag", "mpls", "arp", "gtpu_ipv4", "gtpu_udp", "gtpu", "ipv4", "tcp", "udp", "icmp", "intl4_shim", "int_header", "int_switch_id", "int_port_ids", "int_hop_latency", "int_q_occupancy", "int_ingress_tstamp", "int_egress_tstamp", "int_q_congestion", "int_egress_tx_util", "int_data", "intl4_tail"]
+ "order" : ["packet_in", "ethernet", "vlan_tag", "mpls", "arp", "gtpu_ipv4", "gtpu_udp", "gtpu", "ipv4", "tcp", "udp", "icmp", "intl4_shim", "int_header", "int_switch_id", "int_port_ids", "int_hop_latency", "int_q_occupancy", "int_ingress_tstamp", "int_egress_tstamp", "int_q_congestion", "int_egress_tx_util", "intl4_tail"]
}
],
"meter_arrays" : [],