It is just me who feels that our beloved Packet is going to experience a bunch of compilation problems with the code he has on his terminal?
I can see at least 3 distinct errors there. How many do you see?
Happy hacking
It is just me who feels that our beloved Packet is going to experience a bunch of compilation problems with the code he has on his terminal?
I can see at least 3 distinct errors there. How many do you see?
Happy hacking
Let’s see:
If you consider this to be P4_16
.
hdr
(or equivalent) before ipv4 keysize
number is wrong (the space)table
should be declared inside controlYou could also consider no arguments for control or no action declared. But that could be ignored just not to be too specific.
If you consider this as P4_14
(I used less times):
reads
instead of key
, plus remove all ’ = ’apply(routing)
instead of the control block apply and the apply()
method from the table.Funny enough size :
seems to be correct for P4_14
and table declaration too, right?
It seems to have correct things from P4_14
and P4_16
, a weird mix
For further reference of the block , here:
table routing{
key = { ipv4.dstAddr : lpm; }
actions = { drop; route; }
size : 204 8;
}
control ingress () {
apply{
routing.apply();
}
}
Good catch on P4_14 vs P4_16 @ederollora !
@judysnow @ederollora –
Looks like we are in a general agreement!
I decided not to count ipv4.dst_addr
not having hdr.
in front as a bug, since I could not really tell what are the types of the arguments passed to ingress()
control. I usually spell out all the parameters to the parsers/controls in my slides only once, in the very beginning, since they take way too much space. So, one can imaging an ingress control that is being passed just the IPv4 header
Hopefully, the site maintainers will do something relatively soon.
Happy hacking!
How does this look @vgurevich ? Luckily, I’m one of the maintainers, so I’ll fix it! I don’t think I’ll have room for the header and action definitions.
header ipv4 {
bit<32> dstAddr;
}
action drop() {}
action route() {}
control ingress () {
table routing {
key = { ipv4.dstAddr : lpm; }
actions = { drop; route; }
size = 2048;
}
apply{
routing.apply();
}
}
Dear @judysnow – thank you for taking care of that.
To follow the initial layout and spirit of the code, I’d do the same thing as you proposed and leave the header definition and the actions out of the picture – just start at control ingress()
.
Also, even though the language allows it, more often than not actions are defined inside the same control as the table and not in the global scope anyway, so leaving them out will eliminate additional questions
Also, I noted that the same code fragment is used in at least one other place (“Ready to Try P4?”), so you might want to watch out for that.
Happy hacking!
Hi @vgurevich
Thanks! I fixed the other place (Learn « P4 – Language Consortium) last night, but I have to get an artist-type person to fix the image. I don’t even have the source for it.
judy
Packet is all fixed now! He’s even an emoji
Just type packet with a : before and a : after.
I wish his resolution/aspect ratio were better. If anyone has a better image, I’ll add it.