Fixed packet I/O in p4-14 programs
Tested on BMv2 and working
Change-Id: I834d7b5a8627181c6888500545e1bdbfe9af8dc1
diff --git a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2DefaultPipeconfFactory.java b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2DefaultPipeconfFactory.java
index 9a12170..cd89bba 100644
--- a/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2DefaultPipeconfFactory.java
+++ b/drivers/bmv2/src/main/java/org/onosproject/drivers/bmv2/Bmv2DefaultPipeconfFactory.java
@@ -40,8 +40,8 @@
public final class Bmv2DefaultPipeconfFactory {
private static final String PIPECONF_ID = "bmv2-default-pipeconf";
- private static final String JSON_PATH = "/default.json";
- private static final String P4INFO_PATH = "/default.p4info";
+ private static final String JSON_PATH = "/default_14.json";
+ private static final String P4INFO_PATH = "/default_14.p4info";
private static final PiPipeconf PIPECONF = buildPipeconf();
diff --git a/drivers/bmv2/src/main/resources/default_14.json b/drivers/bmv2/src/main/resources/default_14.json
new file mode 120000
index 0000000..a965e1c
--- /dev/null
+++ b/drivers/bmv2/src/main/resources/default_14.json
@@ -0,0 +1 @@
+../../../../../tools/test/p4src/p4-14/p4c-out/default.json
\ No newline at end of file
diff --git a/drivers/bmv2/src/main/resources/default_14.p4info b/drivers/bmv2/src/main/resources/default_14.p4info
new file mode 120000
index 0000000..dbf60a5
--- /dev/null
+++ b/drivers/bmv2/src/main/resources/default_14.p4info
@@ -0,0 +1 @@
+../../../../../tools/test/p4src/p4-14/p4c-out/default.p4info
\ No newline at end of file
diff --git a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/DefaultP4Interpreter.java b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/DefaultP4Interpreter.java
index e0ea07b..d22fc07 100644
--- a/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/DefaultP4Interpreter.java
+++ b/drivers/p4runtime/src/main/java/org/onosproject/drivers/p4runtime/DefaultP4Interpreter.java
@@ -74,7 +74,7 @@
// FIXME: Should move this class out of the p4runtime drivers.
// e.g. in a dedicated onos/pipeconf directory, along with any related P4 source code.
- private static final boolean PACKET_IO_ENABLED = false;
+ private static final boolean PACKET_IO_ENABLED = true;
public static final String TABLE0 = "table0";
public static final String SEND_TO_CPU = "send_to_cpu";
diff --git a/tools/test/p4src/p4-14/Makefile b/tools/test/p4src/p4-14/Makefile
index ec365e2..48427dc 100644
--- a/tools/test/p4src/p4-14/Makefile
+++ b/tools/test/p4src/p4-14/Makefile
@@ -12,6 +12,8 @@
bmv2: default-bmv2 empty-bmv2 ecmp-bmv2 wcmp-bmv2
+tofino: default-tofino ecmp-tofino
+
default-bmv2: default.p4
p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/default.json \
--p4runtime-file p4c-out/default.p4info --p4runtime-format text \
diff --git a/tools/test/p4src/p4-14/default.p4 b/tools/test/p4src/p4-14/default.p4
index f653b98..9f06650 100644
--- a/tools/test/p4src/p4-14/default.p4
+++ b/tools/test/p4src/p4-14/default.p4
@@ -27,13 +27,9 @@
}
control ingress {
- ingress_pkt_io();
if (not valid(packet_out_hdr)) {
apply(table0);
}
+ ingress_pkt_io_control();
process_port_counters();
-}
-
-control egress {
- egress_pkt_io();
}
\ No newline at end of file
diff --git a/tools/test/p4src/p4-14/ecmp.p4 b/tools/test/p4src/p4-14/ecmp.p4
index dce5f88..aa3a315 100644
--- a/tools/test/p4src/p4-14/ecmp.p4
+++ b/tools/test/p4src/p4-14/ecmp.p4
@@ -83,7 +83,6 @@
}
control ingress {
- ingress_pkt_io();
if (not valid(packet_out_hdr)) {
apply(table0) {
ecmp_group {
@@ -91,9 +90,6 @@
}
}
}
+ ingress_pkt_io_control();
process_port_counters();
-}
-
-control egress {
- egress_pkt_io();
}
\ No newline at end of file
diff --git a/tools/test/p4src/p4-14/include/actions.p4 b/tools/test/p4src/p4-14/include/actions.p4
index 961890d..1e6d425 100644
--- a/tools/test/p4src/p4-14/include/actions.p4
+++ b/tools/test/p4src/p4-14/include/actions.p4
@@ -15,10 +15,8 @@
}
action send_to_cpu() {
- #ifdef __TOFINO_BUILD__
- modify_field(ig_intr_md_for_tm.copy_to_cpu, 1);
- #else
- modify_field(standard_metadata.egress_spec, CPU_PORT);
- #endif
+ modify_field(EGR_PORT_FIELD, CPU_PORT);
+ add_header(packet_in_hdr);
+ modify_field(packet_in_hdr.ingress_port, IGR_PORT_FIELD);
}
#endif
\ No newline at end of file
diff --git a/tools/test/p4src/p4-14/include/defines.p4 b/tools/test/p4src/p4-14/include/defines.p4
index 35baa4f..e054493 100644
--- a/tools/test/p4src/p4-14/include/defines.p4
+++ b/tools/test/p4src/p4-14/include/defines.p4
@@ -1,8 +1,7 @@
// Logic ports as defined in the simple_switch target
-#define MAX_PORTS 254
+#define MAX_PORTS 511
#define DROP_PORT 511
-#define NULL_ETH_TYPE 0x00
#define ETHERTYPE_IPV4 0x0800
#define IP_PROTOCOLS_TCP 6
#define IP_PROTOCOLS_UDP 17
diff --git a/tools/test/p4src/p4-14/include/packet_io.p4 b/tools/test/p4src/p4-14/include/packet_io.p4
index 5da7a65..5cd71a3 100644
--- a/tools/test/p4src/p4-14/include/packet_io.p4
+++ b/tools/test/p4src/p4-14/include/packet_io.p4
@@ -3,43 +3,21 @@
#include "headers.p4"
#include "parser.p4"
-action _packet_out() {
+action _process_packet_out() {
modify_field(EGR_PORT_FIELD, packet_out_hdr.egress_port);
remove_header(packet_out_hdr);
}
-table ingress_pkt {
+table process_packet_out_table {
actions {
- _packet_out;
+ _process_packet_out;
}
- default_action: _packet_out();
+ default_action: _process_packet_out();
}
-control ingress_pkt_io {
+control ingress_pkt_io_control {
if (valid(packet_out_hdr)) {
- apply(ingress_pkt);
- }
-}
-
-action add_packet_in_hdr() {
- add_header(packet_in_hdr);
- modify_field(packet_in_hdr.ingress_port, IGR_PORT_FIELD);
-}
-
-table egress_pkt {
- actions {
- add_packet_in_hdr;
- }
- default_action: add_packet_in_hdr();
-}
-
-control egress_pkt_io {
- #ifdef __TOFINO_BUILD__
- if (ig_intr_md_for_tm.copy_to_cpu == 1) {
- #else
- if (IGR_PORT_FIELD == CPU_PORT) {
- #endif
- apply(egress_pkt);
+ apply(process_packet_out_table);
}
}
diff --git a/tools/test/p4src/p4-14/include/parser.p4 b/tools/test/p4src/p4-14/include/parser.p4
index 73dcdfd..0223297 100644
--- a/tools/test/p4src/p4-14/include/parser.p4
+++ b/tools/test/p4src/p4-14/include/parser.p4
@@ -11,11 +11,12 @@
header udp_t udp;
parser start {
- // FIXME: Cheat the compiler to generate the deparser of packet in
- // This is just a hack, we assume first 8 bit of etherType won't be 0
- return select( current(96, 8) ) {
- NULL_ETH_TYPE : parse_pkt_in;
- default : default_parser;
+ // Hack to force deparsing of packet_in hdr.
+ // We assume it's impossible to receive a pkt with the first 8 bits of etherType 0.
+ // p4c-tofino complains when switching over 16 bits, i.e. the full etherType
+ return select(current(96, 8)) {
+ 0 : parse_pkt_in;
+ default : default_parser;
}
}
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 {
diff --git a/tools/test/p4src/p4-14/wcmp.p4 b/tools/test/p4src/p4-14/wcmp.p4
index a388be7..a3514b4 100644
--- a/tools/test/p4src/p4-14/wcmp.p4
+++ b/tools/test/p4src/p4-14/wcmp.p4
@@ -90,7 +90,6 @@
}
control ingress {
- ingress_pkt_io();
if (not valid(packet_out_hdr)) {
apply(table0) {
wcmp_group {
@@ -102,9 +101,6 @@
}
}
}
+ ingress_pkt_io_control();
process_port_counters();
-}
-
-control egress {
- egress_pkt_io();
-}
+}
\ No newline at end of file