Closed fruffy closed 3 years ago
header BOOL {
bool a;
bit<7> padding;
}
struct Headers {
ethernet_t eth_hdr;
BOOL b;
}
struct Meta {}
parser p(packet_in pkt, out Headers hdr, inout Meta m, inout standard_metadata_t sm) {
state start {
transition parse_hdrs;
}
state parse_hdrs {
pkt.extract(hdr.eth_hdr);
pkt.extract(hdr.b);
transition accept;
}
}
control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
apply {
// bool evaluation
h.b.a = 1 == 1;
}
}
Reducing the program to this snippet causes the same error. So bools and uneven bits are not supported?
The Invalid packet data
error message is output by the STF framework, not bmv2: https://github.com/p4lang/p4c/blob/eab654a4e06c823e1876ef52e4a0dd70cf5763cc/backends/bmv2/bmv2stf.py#L425. The error is produced when the packet cannot be sent on the veth. It does seem that there is something fishy with your input packet: you are missing half a byte (... 00 00 0
).
This is related to #976. I have a program with fairly diverse and complex headers. When trying to feed this program into simple_switch, I get the following error message:
What could be the reason for this? One thing I can think of is that I am using bools, ints, and uneven bit values in the header.
gauntlet_various_ops-bmv2.p4.txt gauntlet_various_ops-bmv2.stf.txt