Open
Description
The following program compiles incorrectly:
#include <core.p4>
#include <v1model.p4>
struct headers { }
struct metadata { }
parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
85B0
state start {
transition accept;
}
}
control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
apply { }
}
control MyIngress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
action a(bit<9> port) {
standard_metadata.egress_spec = port;
}
table t {
actions = {
a;
NoAction;
}
key = { }
default_action = NoAction();
}
apply {
a(0);
t.apply();
}
}
control MyEgress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
apply { }
}
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
apply { }
}
control MyDeparser(packet_out packet, in headers hdr) {
apply { }
}
V1Switch(MyParser(),
MyVerifyChecksum(),
MyIngress(),
MyEgress(),
MyComputeChecksum(),
MyDeparser()) main;
Note that action a
is invoked via table t
and directly in MyIngress
.
However, the LocalizeAllActions
and RemoveActionParameters
passes generate this program:
#include <core.p4>
#include <v1model.p4>
struct headers {
}
struct metadata {
}
parser MyParser(packet_in packet, out headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
state start {
transition accept;
}
}
control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
apply {
}
}
control MyIngress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
@name(".NoAction") action NoAction_0() {
}
@name("MyIngress.a") action a(bit<9> port) {
standard_metadata.egress_spec = port;
}
bit<9> port_0;
@name("MyIngress.a") action a_2() {
port_0 = 9w0;
standard_metadata.egress_spec = port_0;
}
@name("MyIngress.t") table t_0 {
actions = {
a();
NoAction_0();
}
key = {
}
default_action = NoAction_0();
}
apply {
a_2();
t_0.apply();
}
}
control MyEgress(inout headers hdr, inout metadata meta, inout standard_metadata_t standard_metadata) {
apply {
}
}
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
apply {
}
}
control MyDeparser(packet_out packet, in headers hdr) {
apply {
}
}
V1Switch<headers, metadata>(MyParser(), MyVerifyChecksum(), MyIngress(), MyEgress(), MyComputeChecksum(), MyDeparser()) main;
Note that there are two actions named MyIngress.a
, but they take different numbers of parameters.
This may break the control plane when trying to insert an entry into t
with action a
.
I can provide more detail if helpful, but hopefully the issue is clear...