Fixed packet I/O in p4-14 programs
Tested on BMv2 and working
Change-Id: I834d7b5a8627181c6888500545e1bdbfe9af8dc1
diff --git a/tools/test/p4src/p4-14/p4c-out/default.json b/tools/test/p4src/p4-14/p4c-out/default.json
index 347b3be..4e7c999 100644
--- a/tools/test/p4src/p4-14/p4c-out/default.json
+++ b/tools/test/p4src/p4-14/p4c-out/default.json
@@ -9,8 +9,8 @@
"name" : "scalars_0",
"id" : 0,
"fields" : [
- ["tmp_0", 104, false],
- ["tmp", 8, false],
+ ["tmp_0", 112, false],
+ ["tmp", 16, false],
["tmp_1", 32, false],
["tmp_2", 32, false]
]
@@ -390,7 +390,7 @@
},
{
"type" : "lookahead",
- "value" : [0, 104]
+ "value" : [0, 112]
}
],
"op" : "set"
@@ -413,7 +413,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0xff"
+ "value" : "0xffff"
}
}
}
@@ -424,7 +424,7 @@
],
"transitions" : [
{
- "value" : "0x00",
+ "value" : "0x0000",
"mask" : null,
"next_state" : "parse_pkt_in"
},
@@ -462,13 +462,13 @@
{
"name" : "egress_port_counter",
"id" : 1,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
},
{
"name" : "ingress_port_counter",
"id" : 2,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
}
],
@@ -477,55 +477,14 @@
"learn_lists" : [],
"actions" : [
{
- "name" : "add_packet_in_hdr",
- "id" : 0,
- "runtime_data" : [],
- "primitives" : [
- {
- "op" : "add_header",
- "parameters" : [
- {
- "type" : "header",
- "value" : "packet_in_hdr"
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 25,
- "column" : 4,
- "source_fragment" : "add_header(packet_in_hdr)"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["packet_in_hdr", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 26,
- "column" : 4,
- "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
- }
- }
- ]
- },
- {
"name" : "NoAction",
- "id" : 1,
+ "id" : 0,
"runtime_data" : [],
"primitives" : []
},
{
"name" : "set_egress_port",
- "id" : 2,
+ "id" : 1,
"runtime_data" : [
{
"name" : "port",
@@ -556,7 +515,7 @@
},
{
"name" : "send_to_cpu",
- "id" : 3,
+ "id" : 2,
"runtime_data" : [],
"primitives" : [
{
@@ -573,16 +532,50 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 21,
+ "line" : 18,
"column" : 4,
"source_fragment" : "modify_field(standard_metadata.egress_spec, 255)"
}
+ },
+ {
+ "op" : "add_header",
+ "parameters" : [
+ {
+ "type" : "header",
+ "value" : "packet_in_hdr"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 19,
+ "column" : 4,
+ "source_fragment" : "add_header(packet_in_hdr)"
+ }
+ },
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["packet_in_hdr", "ingress_port"]
+ },
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "ingress_port"]
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 20,
+ "column" : 4,
+ "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
+ }
}
]
},
{
"name" : "_drop",
- "id" : 4,
+ "id" : 3,
"runtime_data" : [],
"primitives" : [
{
@@ -607,8 +600,8 @@
]
},
{
- "name" : "_packet_out",
- "id" : 5,
+ "name" : "_process_packet_out",
+ "id" : 4,
"runtime_data" : [],
"primitives" : [
{
@@ -649,7 +642,7 @@
},
{
"name" : "count_egress",
- "id" : 6,
+ "id" : 5,
"runtime_data" : [],
"primitives" : [
{
@@ -701,7 +694,7 @@
},
{
"name" : "count_ingress",
- "id" : 7,
+ "id" : 6,
"runtime_data" : [],
"primitives" : [
{
@@ -759,37 +752,8 @@
"init_table" : "node_2",
"tables" : [
{
- "name" : "ingress_pkt",
- "id" : 0,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 11,
- "column" : 0,
- "source_fragment" : "table ingress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [5],
- "actions" : ["_packet_out"],
- "base_default_next" : "node_4",
- "next_tables" : {
- "_packet_out" : "node_4"
- },
- "default_entry" : {
- "action_id" : 5,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- },
- {
"name" : "table0",
- "id" : 1,
+ "id" : 0,
"source_info" : {
"filename" : "default.p4",
"line" : 8,
@@ -824,17 +788,46 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [2, 3, 4, 1],
+ "action_ids" : [1, 2, 3, 0],
"actions" : ["set_egress_port", "send_to_cpu", "_drop", "NoAction"],
- "base_default_next" : "node_6",
+ "base_default_next" : "node_4",
"next_tables" : {
- "set_egress_port" : "node_6",
- "send_to_cpu" : "node_6",
- "_drop" : "node_6",
- "NoAction" : "node_6"
+ "set_egress_port" : "node_4",
+ "send_to_cpu" : "node_4",
+ "_drop" : "node_4",
+ "NoAction" : "node_4"
},
"default_entry" : {
- "action_id" : 1,
+ "action_id" : 0,
+ "action_const" : false,
+ "action_data" : [],
+ "action_entry_const" : false
+ }
+ },
+ {
+ "name" : "process_packet_out_table",
+ "id" : 1,
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 11,
+ "column" : 0,
+ "source_fragment" : "table process_packet_out_table { ..."
+ },
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [4],
+ "actions" : ["_process_packet_out"],
+ "base_default_next" : "node_6",
+ "next_tables" : {
+ "_process_packet_out" : "node_6"
+ },
+ "default_entry" : {
+ "action_id" : 4,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -856,14 +849,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [7],
+ "action_ids" : [6],
"actions" : ["count_ingress"],
"base_default_next" : "egress_port_count_table",
"next_tables" : {
"count_ingress" : "egress_port_count_table"
},
"default_entry" : {
- "action_id" : 7,
+ "action_id" : 6,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -885,14 +878,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [6],
+ "action_ids" : [5],
"actions" : ["count_egress"],
"base_default_next" : null,
"next_tables" : {
"count_egress" : null
},
"default_entry" : {
- "action_id" : 6,
+ "action_id" : 5,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -905,6 +898,32 @@
"name" : "node_2",
"id" : 0,
"source_info" : {
+ "filename" : "default.p4",
+ "line" : 30,
+ "column" : 12,
+ "source_fragment" : "valid(packet_out_hdr)"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "!=",
+ "left" : {
+ "type" : "field",
+ "value" : ["packet_out_hdr", "$valid$"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x01"
+ }
+ }
+ },
+ "true_next" : "table0",
+ "false_next" : "node_4"
+ },
+ {
+ "name" : "node_4",
+ "id" : 1,
+ "source_info" : {
"filename" : "include/packet_io.p4",
"line" : 19,
"column" : 8,
@@ -924,33 +943,7 @@
}
}
},
- "true_next" : "ingress_pkt",
- "false_next" : "node_4"
- },
- {
- "name" : "node_4",
- "id" : 1,
- "source_info" : {
- "filename" : "default.p4",
- "line" : 31,
- "column" : 12,
- "source_fragment" : "valid(packet_out_hdr)"
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "!=",
- "left" : {
- "type" : "field",
- "value" : ["packet_out_hdr", "$valid$"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x01"
- }
- }
- },
- "true_next" : "table0",
+ "true_next" : "process_packet_out_table",
"false_next" : "node_6"
},
{
@@ -972,7 +965,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0x00fe"
+ "value" : "0x01ff"
}
}
},
@@ -984,67 +977,10 @@
{
"name" : "egress",
"id" : 1,
- "init_table" : "node_11",
- "tables" : [
- {
- "name" : "egress_pkt",
- "id" : 4,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 29,
- "column" : 0,
- "source_fragment" : "table egress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [0],
- "actions" : ["add_packet_in_hdr"],
- "base_default_next" : null,
- "next_tables" : {
- "add_packet_in_hdr" : null
- },
- "default_entry" : {
- "action_id" : 0,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- }
- ],
+ "init_table" : null,
+ "tables" : [],
"action_profiles" : [],
- "conditionals" : [
- {
- "name" : "node_11",
- "id" : 3,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 40,
- "column" : 39,
- "source_fragment" : "=="
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "==",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x00ff"
- }
- }
- },
- "false_next" : null,
- "true_next" : "egress_pkt"
- }
- ]
+ "conditionals" : []
}
],
"checksums" : [],
diff --git a/tools/test/p4src/p4-14/p4c-out/default.p4info b/tools/test/p4src/p4-14/p4c-out/default.p4info
index c076ebb..89acacf 100644
--- a/tools/test/p4src/p4-14/p4c-out/default.p4info
+++ b/tools/test/p4src/p4-14/p4c-out/default.p4info
@@ -47,12 +47,12 @@
}
tables {
preamble {
- id: 33560548
- name: "ingress_pkt"
- alias: "ingress_pkt"
+ id: 33607247
+ name: "process_packet_out_table"
+ alias: "process_packet_out_table"
}
action_refs {
- id: 16835928
+ id: 16798653
}
size: 1024
}
@@ -78,17 +78,6 @@
}
size: 1024
}
-tables {
- preamble {
- id: 33608529
- name: "egress_pkt"
- alias: "egress_pkt"
- }
- action_refs {
- id: 16835663
- }
- size: 1024
-}
actions {
preamble {
id: 16800567
@@ -124,9 +113,9 @@
}
actions {
preamble {
- id: 16835928
- name: "_packet_out"
- alias: "_packet_out"
+ id: 16798653
+ name: "_process_packet_out"
+ alias: "_process_packet_out"
}
}
actions {
@@ -143,13 +132,6 @@
alias: "count_ingress"
}
}
-actions {
- preamble {
- id: 16835663
- name: "add_packet_in_hdr"
- alias: "add_packet_in_hdr"
- }
-}
counters {
preamble {
id: 302008596
@@ -160,7 +142,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
counters {
preamble {
@@ -172,7 +154,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
direct_counters {
preamble {
diff --git a/tools/test/p4src/p4-14/p4c-out/ecmp.json b/tools/test/p4src/p4-14/p4c-out/ecmp.json
index b71b502..500bf47 100644
--- a/tools/test/p4src/p4-14/p4c-out/ecmp.json
+++ b/tools/test/p4src/p4-14/p4c-out/ecmp.json
@@ -9,8 +9,8 @@
"name" : "scalars_0",
"id" : 0,
"fields" : [
- ["tmp_0", 104, false],
- ["tmp", 8, false],
+ ["tmp_0", 112, false],
+ ["tmp", 16, false],
["tmp_1", 32, false],
["tmp_2", 32, false]
]
@@ -405,7 +405,7 @@
},
{
"type" : "lookahead",
- "value" : [0, 104]
+ "value" : [0, 112]
}
],
"op" : "set"
@@ -428,7 +428,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0xff"
+ "value" : "0xffff"
}
}
}
@@ -439,7 +439,7 @@
],
"transitions" : [
{
- "value" : "0x00",
+ "value" : "0x0000",
"mask" : null,
"next_state" : "parse_pkt_in"
},
@@ -483,13 +483,13 @@
{
"name" : "egress_port_counter",
"id" : 2,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
},
{
"name" : "ingress_port_counter",
"id" : 3,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
}
],
@@ -522,45 +522,10 @@
"learn_lists" : [],
"actions" : [
{
- "name" : "add_packet_in_hdr",
+ "name" : "NoAction",
"id" : 0,
"runtime_data" : [],
- "primitives" : [
- {
- "op" : "add_header",
- "parameters" : [
- {
- "type" : "header",
- "value" : "packet_in_hdr"
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 25,
- "column" : 4,
- "source_fragment" : "add_header(packet_in_hdr)"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["packet_in_hdr", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 26,
- "column" : 4,
- "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
- }
- }
- ]
+ "primitives" : []
},
{
"name" : "NoAction",
@@ -569,10 +534,35 @@
"primitives" : []
},
{
- "name" : "NoAction",
+ "name" : "set_egress_port",
"id" : 2,
- "runtime_data" : [],
- "primitives" : []
+ "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" : 5,
+ "column" : 23,
+ "source_fragment" : "port) { ..."
+ }
+ }
+ ]
},
{
"name" : "set_egress_port",
@@ -606,39 +596,8 @@
]
},
{
- "name" : "set_egress_port",
- "id" : 4,
- "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" : 5,
- "column" : 23,
- "source_fragment" : "port) { ..."
- }
- }
- ]
- },
- {
"name" : "ecmp_group",
- "id" : 5,
+ "id" : 4,
"runtime_data" : [
{
"name" : "groupId",
@@ -696,7 +655,7 @@
},
{
"name" : "send_to_cpu",
- "id" : 6,
+ "id" : 5,
"runtime_data" : [],
"primitives" : [
{
@@ -713,16 +672,50 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 21,
+ "line" : 18,
"column" : 4,
"source_fragment" : "modify_field(standard_metadata.egress_spec, 255)"
}
+ },
+ {
+ "op" : "add_header",
+ "parameters" : [
+ {
+ "type" : "header",
+ "value" : "packet_in_hdr"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 19,
+ "column" : 4,
+ "source_fragment" : "add_header(packet_in_hdr)"
+ }
+ },
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["packet_in_hdr", "ingress_port"]
+ },
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "ingress_port"]
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 20,
+ "column" : 4,
+ "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
+ }
}
]
},
{
"name" : "_drop",
- "id" : 7,
+ "id" : 6,
"runtime_data" : [],
"primitives" : [
{
@@ -747,8 +740,8 @@
]
},
{
- "name" : "_packet_out",
- "id" : 8,
+ "name" : "_process_packet_out",
+ "id" : 7,
"runtime_data" : [],
"primitives" : [
{
@@ -789,7 +782,7 @@
},
{
"name" : "count_egress",
- "id" : 9,
+ "id" : 8,
"runtime_data" : [],
"primitives" : [
{
@@ -841,7 +834,7 @@
},
{
"name" : "count_ingress",
- "id" : 10,
+ "id" : 9,
"runtime_data" : [],
"primitives" : [
{
@@ -899,37 +892,8 @@
"init_table" : "node_2",
"tables" : [
{
- "name" : "ingress_pkt",
- "id" : 0,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 11,
- "column" : 0,
- "source_fragment" : "table ingress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [8],
- "actions" : ["_packet_out"],
- "base_default_next" : "node_4",
- "next_tables" : {
- "_packet_out" : "node_4"
- },
- "default_entry" : {
- "action_id" : 8,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- },
- {
"name" : "table0",
- "id" : 1,
+ "id" : 0,
"source_info" : {
"filename" : "ecmp.p4",
"line" : 47,
@@ -964,18 +928,18 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [4, 5, 6, 7, 2],
+ "action_ids" : [3, 4, 5, 6, 1],
"actions" : ["set_egress_port", "ecmp_group", "send_to_cpu", "_drop", "NoAction"],
- "base_default_next" : "node_7",
+ "base_default_next" : "node_5",
"next_tables" : {
"ecmp_group" : "ecmp_group_table",
- "set_egress_port" : "node_7",
- "send_to_cpu" : "node_7",
- "_drop" : "node_7",
- "NoAction" : "node_7"
+ "set_egress_port" : "node_5",
+ "send_to_cpu" : "node_5",
+ "_drop" : "node_5",
+ "NoAction" : "node_5"
},
"default_entry" : {
- "action_id" : 2,
+ "action_id" : 1,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -983,7 +947,7 @@
},
{
"name" : "ecmp_group_table",
- "id" : 2,
+ "id" : 1,
"source_info" : {
"filename" : "ecmp.p4",
"line" : 63,
@@ -1008,15 +972,44 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [3, 1],
+ "action_ids" : [2, 0],
"actions" : ["set_egress_port", "NoAction"],
- "base_default_next" : "node_7",
+ "base_default_next" : "node_5",
"next_tables" : {
- "set_egress_port" : "node_7",
- "NoAction" : "node_7"
+ "set_egress_port" : "node_5",
+ "NoAction" : "node_5"
},
"default_entry" : {
- "action_id" : 1,
+ "action_id" : 0,
+ "action_const" : false,
+ "action_data" : [],
+ "action_entry_const" : false
+ }
+ },
+ {
+ "name" : "process_packet_out_table",
+ "id" : 2,
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 11,
+ "column" : 0,
+ "source_fragment" : "table process_packet_out_table { ..."
+ },
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [7],
+ "actions" : ["_process_packet_out"],
+ "base_default_next" : "node_7",
+ "next_tables" : {
+ "_process_packet_out" : "node_7"
+ },
+ "default_entry" : {
+ "action_id" : 7,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1038,14 +1031,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [10],
+ "action_ids" : [9],
"actions" : ["count_ingress"],
"base_default_next" : "egress_port_count_table",
"next_tables" : {
"count_ingress" : "egress_port_count_table"
},
"default_entry" : {
- "action_id" : 10,
+ "action_id" : 9,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1067,14 +1060,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [9],
+ "action_ids" : [8],
"actions" : ["count_egress"],
"base_default_next" : null,
"next_tables" : {
"count_egress" : null
},
"default_entry" : {
- "action_id" : 9,
+ "action_id" : 8,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1087,6 +1080,32 @@
"name" : "node_2",
"id" : 0,
"source_info" : {
+ "filename" : "ecmp.p4",
+ "line" : 86,
+ "column" : 12,
+ "source_fragment" : "valid(packet_out_hdr)"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "!=",
+ "left" : {
+ "type" : "field",
+ "value" : ["packet_out_hdr", "$valid$"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x01"
+ }
+ }
+ },
+ "true_next" : "table0",
+ "false_next" : "node_5"
+ },
+ {
+ "name" : "node_5",
+ "id" : 1,
+ "source_info" : {
"filename" : "include/packet_io.p4",
"line" : 19,
"column" : 8,
@@ -1106,33 +1125,7 @@
}
}
},
- "true_next" : "ingress_pkt",
- "false_next" : "node_4"
- },
- {
- "name" : "node_4",
- "id" : 1,
- "source_info" : {
- "filename" : "ecmp.p4",
- "line" : 87,
- "column" : 12,
- "source_fragment" : "valid(packet_out_hdr)"
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "!=",
- "left" : {
- "type" : "field",
- "value" : ["packet_out_hdr", "$valid$"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x01"
- }
- }
- },
- "true_next" : "table0",
+ "true_next" : "process_packet_out_table",
"false_next" : "node_7"
},
{
@@ -1154,7 +1147,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0x00fe"
+ "value" : "0x01ff"
}
}
},
@@ -1166,67 +1159,10 @@
{
"name" : "egress",
"id" : 1,
- "init_table" : "node_12",
- "tables" : [
- {
- "name" : "egress_pkt",
- "id" : 5,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 29,
- "column" : 0,
- "source_fragment" : "table egress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [0],
- "actions" : ["add_packet_in_hdr"],
- "base_default_next" : null,
- "next_tables" : {
- "add_packet_in_hdr" : null
- },
- "default_entry" : {
- "action_id" : 0,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- }
- ],
+ "init_table" : null,
+ "tables" : [],
"action_profiles" : [],
- "conditionals" : [
- {
- "name" : "node_12",
- "id" : 3,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 40,
- "column" : 39,
- "source_fragment" : "=="
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "==",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x00ff"
- }
- }
- },
- "false_next" : null,
- "true_next" : "egress_pkt"
- }
- ]
+ "conditionals" : []
}
],
"checksums" : [],
diff --git a/tools/test/p4src/p4-14/p4c-out/ecmp.p4info b/tools/test/p4src/p4-14/p4c-out/ecmp.p4info
index 0961378..f6753d0 100644
--- a/tools/test/p4src/p4-14/p4c-out/ecmp.p4info
+++ b/tools/test/p4src/p4-14/p4c-out/ecmp.p4info
@@ -78,12 +78,12 @@
}
tables {
preamble {
- id: 33560548
- name: "ingress_pkt"
- alias: "ingress_pkt"
+ id: 33607247
+ name: "process_packet_out_table"
+ alias: "process_packet_out_table"
}
action_refs {
- id: 16835928
+ id: 16798653
}
size: 1024
}
@@ -109,17 +109,6 @@
}
size: 1024
}
-tables {
- preamble {
- id: 33608529
- name: "egress_pkt"
- alias: "egress_pkt"
- }
- action_refs {
- id: 16835663
- }
- size: 1024
-}
actions {
preamble {
id: 16800567
@@ -167,9 +156,9 @@
}
actions {
preamble {
- id: 16835928
- name: "_packet_out"
- alias: "_packet_out"
+ id: 16798653
+ name: "_process_packet_out"
+ alias: "_process_packet_out"
}
}
actions {
@@ -186,13 +175,6 @@
alias: "count_ingress"
}
}
-actions {
- preamble {
- id: 16835663
- name: "add_packet_in_hdr"
- alias: "add_packet_in_hdr"
- }
-}
counters {
preamble {
id: 302008596
@@ -203,7 +185,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
counters {
preamble {
@@ -215,7 +197,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
direct_counters {
preamble {
diff --git a/tools/test/p4src/p4-14/p4c-out/wcmp.json b/tools/test/p4src/p4-14/p4c-out/wcmp.json
index 6313d0d..16f8380 100644
--- a/tools/test/p4src/p4-14/p4c-out/wcmp.json
+++ b/tools/test/p4src/p4-14/p4c-out/wcmp.json
@@ -9,8 +9,8 @@
"name" : "scalars_0",
"id" : 0,
"fields" : [
- ["tmp_0", 104, false],
- ["tmp", 8, false],
+ ["tmp_0", 112, false],
+ ["tmp", 16, false],
["tmp_1", 32, false],
["tmp_2", 32, false]
]
@@ -406,7 +406,7 @@
},
{
"type" : "lookahead",
- "value" : [0, 104]
+ "value" : [0, 112]
}
],
"op" : "set"
@@ -429,7 +429,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0xff"
+ "value" : "0xffff"
}
}
}
@@ -440,7 +440,7 @@
],
"transitions" : [
{
- "value" : "0x00",
+ "value" : "0x0000",
"mask" : null,
"next_state" : "parse_pkt_in"
},
@@ -484,13 +484,13 @@
{
"name" : "egress_port_counter",
"id" : 2,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
},
{
"name" : "ingress_port_counter",
"id" : 3,
- "size" : 254,
+ "size" : 511,
"is_direct" : false
}
],
@@ -535,45 +535,10 @@
"learn_lists" : [],
"actions" : [
{
- "name" : "add_packet_in_hdr",
+ "name" : "NoAction",
"id" : 0,
"runtime_data" : [],
- "primitives" : [
- {
- "op" : "add_header",
- "parameters" : [
- {
- "type" : "header",
- "value" : "packet_in_hdr"
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 25,
- "column" : 4,
- "source_fragment" : "add_header(packet_in_hdr)"
- }
- },
- {
- "op" : "assign",
- "parameters" : [
- {
- "type" : "field",
- "value" : ["packet_in_hdr", "ingress_port"]
- },
- {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- }
- ],
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 26,
- "column" : 4,
- "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
- }
- }
- ]
+ "primitives" : []
},
{
"name" : "NoAction",
@@ -588,14 +553,8 @@
"primitives" : []
},
{
- "name" : "NoAction",
- "id" : 3,
- "runtime_data" : [],
- "primitives" : []
- },
- {
"name" : "wcmp_set_selector",
- "id" : 4,
+ "id" : 3,
"runtime_data" : [],
"primitives" : [
{
@@ -714,7 +673,7 @@
},
{
"name" : "set_egress_port",
- "id" : 5,
+ "id" : 4,
"runtime_data" : [
{
"name" : "port",
@@ -745,7 +704,7 @@
},
{
"name" : "wcmp_group",
- "id" : 6,
+ "id" : 5,
"runtime_data" : [
{
"name" : "groupId",
@@ -803,7 +762,7 @@
},
{
"name" : "send_to_cpu",
- "id" : 7,
+ "id" : 6,
"runtime_data" : [],
"primitives" : [
{
@@ -820,16 +779,50 @@
],
"source_info" : {
"filename" : "include/actions.p4",
- "line" : 21,
+ "line" : 18,
"column" : 4,
"source_fragment" : "modify_field(standard_metadata.egress_spec, 255)"
}
+ },
+ {
+ "op" : "add_header",
+ "parameters" : [
+ {
+ "type" : "header",
+ "value" : "packet_in_hdr"
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 19,
+ "column" : 4,
+ "source_fragment" : "add_header(packet_in_hdr)"
+ }
+ },
+ {
+ "op" : "assign",
+ "parameters" : [
+ {
+ "type" : "field",
+ "value" : ["packet_in_hdr", "ingress_port"]
+ },
+ {
+ "type" : "field",
+ "value" : ["standard_metadata", "ingress_port"]
+ }
+ ],
+ "source_info" : {
+ "filename" : "include/actions.p4",
+ "line" : 20,
+ "column" : 4,
+ "source_fragment" : "modify_field(packet_in_hdr.ingress_port, standard_metadata.ingress_port)"
+ }
}
]
},
{
"name" : "_drop",
- "id" : 8,
+ "id" : 7,
"runtime_data" : [],
"primitives" : [
{
@@ -855,7 +848,7 @@
},
{
"name" : "set_egress_port",
- "id" : 9,
+ "id" : 8,
"runtime_data" : [
{
"name" : "port",
@@ -885,8 +878,8 @@
]
},
{
- "name" : "_packet_out",
- "id" : 10,
+ "name" : "_process_packet_out",
+ "id" : 9,
"runtime_data" : [],
"primitives" : [
{
@@ -927,7 +920,7 @@
},
{
"name" : "count_egress",
- "id" : 11,
+ "id" : 10,
"runtime_data" : [],
"primitives" : [
{
@@ -979,7 +972,7 @@
},
{
"name" : "count_ingress",
- "id" : 12,
+ "id" : 11,
"runtime_data" : [],
"primitives" : [
{
@@ -1037,37 +1030,8 @@
"init_table" : "node_2",
"tables" : [
{
- "name" : "ingress_pkt",
- "id" : 0,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 11,
- "column" : 0,
- "source_fragment" : "table ingress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [10],
- "actions" : ["_packet_out"],
- "base_default_next" : "node_4",
- "next_tables" : {
- "_packet_out" : "node_4"
- },
- "default_entry" : {
- "action_id" : 10,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- },
- {
"name" : "table0",
- "id" : 1,
+ "id" : 0,
"source_info" : {
"filename" : "wcmp.p4",
"line" : 48,
@@ -1102,18 +1066,18 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [5, 6, 7, 8, 1],
+ "action_ids" : [4, 5, 6, 7, 0],
"actions" : ["set_egress_port", "wcmp_group", "send_to_cpu", "_drop", "NoAction"],
- "base_default_next" : "node_8",
+ "base_default_next" : "node_6",
"next_tables" : {
"wcmp_group" : "wcmp_set_selector_table",
- "set_egress_port" : "node_8",
- "send_to_cpu" : "node_8",
- "_drop" : "node_8",
- "NoAction" : "node_8"
+ "set_egress_port" : "node_6",
+ "send_to_cpu" : "node_6",
+ "_drop" : "node_6",
+ "NoAction" : "node_6"
},
"default_entry" : {
- "action_id" : 1,
+ "action_id" : 0,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1121,7 +1085,7 @@
},
{
"name" : "wcmp_set_selector_table",
- "id" : 2,
+ "id" : 1,
"source_info" : {
"filename" : "wcmp.p4",
"line" : 64,
@@ -1135,15 +1099,15 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [4, 3],
+ "action_ids" : [3, 2],
"actions" : ["wcmp_set_selector", "NoAction"],
- "base_default_next" : "node_8",
+ "base_default_next" : "node_6",
"next_tables" : {
"wcmp_set_selector" : "wcmp_group_table",
- "NoAction" : "node_8"
+ "NoAction" : "node_6"
},
"default_entry" : {
- "action_id" : 3,
+ "action_id" : 2,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1151,7 +1115,7 @@
},
{
"name" : "wcmp_group_table",
- "id" : 3,
+ "id" : 2,
"source_info" : {
"filename" : "wcmp.p4",
"line" : 70,
@@ -1176,15 +1140,44 @@
"with_counters" : true,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [9, 2],
+ "action_ids" : [8, 1],
"actions" : ["set_egress_port", "NoAction"],
- "base_default_next" : "node_8",
+ "base_default_next" : "node_6",
"next_tables" : {
- "set_egress_port" : "node_8",
- "NoAction" : "node_8"
+ "set_egress_port" : "node_6",
+ "NoAction" : "node_6"
},
"default_entry" : {
- "action_id" : 2,
+ "action_id" : 1,
+ "action_const" : false,
+ "action_data" : [],
+ "action_entry_const" : false
+ }
+ },
+ {
+ "name" : "process_packet_out_table",
+ "id" : 3,
+ "source_info" : {
+ "filename" : "include/packet_io.p4",
+ "line" : 11,
+ "column" : 0,
+ "source_fragment" : "table process_packet_out_table { ..."
+ },
+ "key" : [],
+ "match_type" : "exact",
+ "type" : "simple",
+ "max_size" : 1024,
+ "with_counters" : false,
+ "support_timeout" : false,
+ "direct_meters" : null,
+ "action_ids" : [9],
+ "actions" : ["_process_packet_out"],
+ "base_default_next" : "node_8",
+ "next_tables" : {
+ "_process_packet_out" : "node_8"
+ },
+ "default_entry" : {
+ "action_id" : 9,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1206,14 +1199,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [12],
+ "action_ids" : [11],
"actions" : ["count_ingress"],
"base_default_next" : "egress_port_count_table",
"next_tables" : {
"count_ingress" : "egress_port_count_table"
},
"default_entry" : {
- "action_id" : 12,
+ "action_id" : 11,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1235,14 +1228,14 @@
"with_counters" : false,
"support_timeout" : false,
"direct_meters" : null,
- "action_ids" : [11],
+ "action_ids" : [10],
"actions" : ["count_egress"],
"base_default_next" : null,
"next_tables" : {
"count_egress" : null
},
"default_entry" : {
- "action_id" : 11,
+ "action_id" : 10,
"action_const" : false,
"action_data" : [],
"action_entry_const" : false
@@ -1255,6 +1248,32 @@
"name" : "node_2",
"id" : 0,
"source_info" : {
+ "filename" : "wcmp.p4",
+ "line" : 93,
+ "column" : 12,
+ "source_fragment" : "valid(packet_out_hdr)"
+ },
+ "expression" : {
+ "type" : "expression",
+ "value" : {
+ "op" : "!=",
+ "left" : {
+ "type" : "field",
+ "value" : ["packet_out_hdr", "$valid$"]
+ },
+ "right" : {
+ "type" : "hexstr",
+ "value" : "0x01"
+ }
+ }
+ },
+ "true_next" : "table0",
+ "false_next" : "node_6"
+ },
+ {
+ "name" : "node_6",
+ "id" : 1,
+ "source_info" : {
"filename" : "include/packet_io.p4",
"line" : 19,
"column" : 8,
@@ -1274,33 +1293,7 @@
}
}
},
- "true_next" : "ingress_pkt",
- "false_next" : "node_4"
- },
- {
- "name" : "node_4",
- "id" : 1,
- "source_info" : {
- "filename" : "wcmp.p4",
- "line" : 94,
- "column" : 12,
- "source_fragment" : "valid(packet_out_hdr)"
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "!=",
- "left" : {
- "type" : "field",
- "value" : ["packet_out_hdr", "$valid$"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x01"
- }
- }
- },
- "true_next" : "table0",
+ "true_next" : "process_packet_out_table",
"false_next" : "node_8"
},
{
@@ -1322,7 +1315,7 @@
},
"right" : {
"type" : "hexstr",
- "value" : "0x00fe"
+ "value" : "0x01ff"
}
}
},
@@ -1334,67 +1327,10 @@
{
"name" : "egress",
"id" : 1,
- "init_table" : "node_13",
- "tables" : [
- {
- "name" : "egress_pkt",
- "id" : 6,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 29,
- "column" : 0,
- "source_fragment" : "table egress_pkt { ..."
- },
- "key" : [],
- "match_type" : "exact",
- "type" : "simple",
- "max_size" : 1024,
- "with_counters" : false,
- "support_timeout" : false,
- "direct_meters" : null,
- "action_ids" : [0],
- "actions" : ["add_packet_in_hdr"],
- "base_default_next" : null,
- "next_tables" : {
- "add_packet_in_hdr" : null
- },
- "default_entry" : {
- "action_id" : 0,
- "action_const" : false,
- "action_data" : [],
- "action_entry_const" : false
- }
- }
- ],
+ "init_table" : null,
+ "tables" : [],
"action_profiles" : [],
- "conditionals" : [
- {
- "name" : "node_13",
- "id" : 3,
- "source_info" : {
- "filename" : "include/packet_io.p4",
- "line" : 40,
- "column" : 39,
- "source_fragment" : "=="
- },
- "expression" : {
- "type" : "expression",
- "value" : {
- "op" : "==",
- "left" : {
- "type" : "field",
- "value" : ["standard_metadata", "ingress_port"]
- },
- "right" : {
- "type" : "hexstr",
- "value" : "0x00ff"
- }
- }
- },
- "false_next" : null,
- "true_next" : "egress_pkt"
- }
- ]
+ "conditionals" : []
}
],
"checksums" : [],
diff --git a/tools/test/p4src/p4-14/p4c-out/wcmp.p4info b/tools/test/p4src/p4-14/p4c-out/wcmp.p4info
index 8024064..9b12a53 100644
--- a/tools/test/p4src/p4-14/p4c-out/wcmp.p4info
+++ b/tools/test/p4src/p4-14/p4c-out/wcmp.p4info
@@ -93,12 +93,12 @@
}
tables {
preamble {
- id: 33560548
- name: "ingress_pkt"
- alias: "ingress_pkt"
+ id: 33607247
+ name: "process_packet_out_table"
+ alias: "process_packet_out_table"
}
action_refs {
- id: 16835928
+ id: 16798653
}
size: 1024
}
@@ -124,17 +124,6 @@
}
size: 1024
}
-tables {
- preamble {
- id: 33608529
- name: "egress_pkt"
- alias: "egress_pkt"
- }
- action_refs {
- id: 16835663
- }
- size: 1024
-}
actions {
preamble {
id: 16800567
@@ -189,9 +178,9 @@
}
actions {
preamble {
- id: 16835928
- name: "_packet_out"
- alias: "_packet_out"
+ id: 16798653
+ name: "_process_packet_out"
+ alias: "_process_packet_out"
}
}
actions {
@@ -208,13 +197,6 @@
alias: "count_ingress"
}
}
-actions {
- preamble {
- id: 16835663
- name: "add_packet_in_hdr"
- alias: "add_packet_in_hdr"
- }
-}
counters {
preamble {
id: 302008596
@@ -225,7 +207,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
counters {
preamble {
@@ -237,7 +219,7 @@
spec {
unit: PACKETS
}
- size: 254
+ size: 511
}
direct_counters {
preamble {