[P4-dev] statefulness in BMv2

cs.lev cs.lev at gmx.com
Fri Oct 12 13:25:46 EDT 2018


On of the main reason I have started to play with P4 is to have
(persistent) states in pipeline which are global states, not just per-
packet states (e.g., metadata).

I have found some descriptions that registers can be used for this, but
maybe it is not working in BMv2, is it?
I can compile my code with such a declaration:
register<bit<8>>(2) r;

But, when I want to access it (e.g., m.write(1,1)), the compiler (p4c-
bm2-ss) says:
MethodCallStatement: not supported in parser on this target

Am I doing something wrong, or persistent states cannot be introduced
in programs for the software switch?

Is there any other way to do this?

Maybe storing data in the match-action tables can be some workaround,
but then the table and its content should be modified by the switch
program not the controller. Is there a way to do this?


More information about the P4-dev mailing list