Make the Basic pipeline more portable
This change makes the Basic pipeline compile better with different
compilers. One change is this: the type parameter for a v1model meter
instance cannot be a programmer-defined enum. This is because in P4_16,
enums don't necessarily have underlying bitstring types and the
language doesn't specify that enum members should be assigned a
numerical value in any given way.
Change-Id: Id2b758eb2b6e76aa708c2e03e7a001667efddb3d
diff --git a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
index 650ea3a..9a67fcb 100644
--- a/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
+++ b/pipelines/basic/src/main/resources/p4c-out/bmv2/int.json
@@ -18,7 +18,7 @@
["local_metadata_t.l4_dst_port", 16, false],
["local_metadata_t.next_hop_id", 16, false],
["local_metadata_t.selector", 16, false],
- ["_padding_3", 6, false]
+ ["_padding_2", 6, false]
]
},
{
@@ -34,7 +34,7 @@
"id" : 2,
"fields" : [
["ingress_port", 9, false],
- ["_padding_0", 7, false]
+ ["_padding", 7, false]
]
},
{
@@ -208,7 +208,7 @@
["mirror_id", 8, false],
["flow_id", 16, false],
["metadata_len", 8, false],
- ["_padding_1", 6, false]
+ ["_padding_0", 6, false]
]
},
{
@@ -235,7 +235,7 @@
["egress_rid", 16, false],
["checksum_error", 1, false],
["recirculate_flag", 32, false],
- ["_padding_2", 5, false]
+ ["_padding_1", 5, false]
]
}
],
@@ -1038,65 +1038,8 @@
"learn_lists" : [],
"actions" : [
{
- "name" : "set_egress_port",
- "id" : 0,
- "runtime_data" : [
- {
- "name" : "port",
- "bitwidth" : 9
- }
- ],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- {
- "type" : "runtime_data",
- "value" : 0
- }
- ],
- "source_info" : {
- "filename" : "include/actions.p4",
- "line" : 28,
- "column" : 36,
- "source_fragment" : "port; ..."
- }
- }
- ]
- },
- {
- "name" : "send_to_cpu",
- "id" : 1,
- "runtime_data" : [],
- "primitives" : [
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["standard_metadata", "egress_spec"]
- },
- {
- "type" : "hexstr",
- "value" : "0x00ff"
- }
- ],
- "source_info" : {
- "filename" : "include/defines.p4",
- "line" : 28,
- "column" : 24,
- "source_fragment" : "255; ..."
- }
- }
- ]
- },
- {
"name" : "_drop",
- "id" : 2,
+ "id" : 0,
"runtime_data" : [],
"primitives" : [
{
@@ -1104,7 +1047,7 @@
"parameters" : [],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 32,
+ "line" : 24,
"column" : 4,
"source_fragment" : "mark_to_drop()"
}
@@ -1113,7 +1056,7 @@
},
{
"name" : "ingress.table0_control.set_next_hop_id",
- "id" : 3,
+ "id" : 1,
"runtime_data" : [
{
"name" : "next_hop_id",
@@ -1143,6 +1086,63 @@
]
},
{
+ "name" : "ingress.table0_control.send_to_cpu",
+ "id" : 2,
+ "runtime_data" : [],
+ "primitives" : [
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "egress_spec"]
+ },
+ {
+ "type" : "hexstr",
+ "value" : "0x00ff"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/defines.p4",
+ "line" : 28,
+ "column" : 24,
+ "source_fragment" : "255; ..."
+ }
+ }
+ ]
+ },
+ {
+ "name" : "ingress.table0_control.set_egress_port",
+ "id" : 3,
+ "runtime_data" : [
+ {
+ "name" : "port",
+ "bitwidth" : 9
+ }
+ ],
+ "primitives" : [
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "egress_spec"]
+ },
+ {
+ "type" : "runtime_data",
+ "value" : 0
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/table0.p4",
+ "line" : 38,
+ "column" : 8,
+ "source_fragment" : "standard_metadata.egress_spec = port"
+ }
+ }
+ ]
+ },
+ {
"name" : "act",
"id" : 4,
"runtime_data" : [],
@@ -6076,7 +6076,7 @@
"id" : 2,
"source_info" : {
"filename" : "include/table0.p4",
- "line" : 33,
+ "line" : 41,
"column" : 10,
"source_fragment" : "table0"
},
@@ -6142,17 +6142,17 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [0, 1, 3, 2],
- "actions" : ["set_egress_port", "send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
+ "action_ids" : [3, 2, 1, 0],
+ "actions" : ["ingress.table0_control.set_egress_port", "ingress.table0_control.send_to_cpu", "ingress.table0_control.set_next_hop_id", "_drop"],
"base_default_next" : null,
"next_tables" : {
- "set_egress_port" : null,
- "send_to_cpu" : null,
+ "ingress.table0_control.set_egress_port" : null,
+ "ingress.table0_control.send_to_cpu" : null,
"ingress.table0_control.set_next_hop_id" : null,
"_drop" : null
},
"default_entry" : {
- "action_id" : 2,
+ "action_id" : 0,
"action_const" : true,
"action_data" : [],
"action_entry_const" : true
@@ -6613,9 +6613,9 @@
"direct_meters" : null,
"action_ids" : [55],
"actions" : ["act_2"],
- "base_default_next" : "node_29",
+ "base_default_next" : "node_28",
"next_tables" : {
- "act_2" : "node_29"
+ "act_2" : "node_28"
},
"default_entry" : {
"action_id" : 55,
@@ -6871,38 +6871,12 @@
}
}
},
- "true_next" : "node_25",
- "false_next" : "tbl_act_1"
- },
- {
- "name" : "node_25",
- "id" : 8,
- "source_info" : {
- "filename" : "include/int_sink.p4",
- "line" : 51,
- "column" : 12,
- "source_fragment" : "local_metadata.int_meta.sink == 1"
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "==",
- "left" : {
- "type" : "field",
- "value" : ["userMetadata.int_meta", "sink"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x01"
- }
- }
- },
"true_next" : "tbl_process_int_sink_restore_header",
"false_next" : "tbl_act_1"
},
{
- "name" : "node_29",
- "id" : 9,
+ "name" : "node_28",
+ "id" : 8,
"source_info" : {
"filename" : "include/packet_io.p4",
"line" : 37,