[P4-dev] statefulness in BMv2

cs.lev cs.lev at gmx.com
Sat Oct 13 03:48:04 EDT 2018


Thanks Andy, it worked. 
Sorry, I was dealing with other non-P4 source codes at the same time
and have misunderstood what parser meant in this case :-(|)

Now, it is working.

However, is there any limitations on how deep a register array can be,
how big the bit-width can be for one item, or even how many registers
can be defined and used at the same time?


Thank you so much,
cslev

On Fri, 2018-10-12 at 10:57 -0700, Andy Fingerhut wrote:
> The error message says not supported "in parser".  The BMv2 with
> v1model architecture does not support the use of registers in the
> parser code.
> 
> You should be able to achieve success by using registers in a control
> like ingress or egress.
> 
> Andy
> 
> On Fri, Oct 12, 2018 at 10:26 AM cs.lev <cs.lev at gmx.com> wrote:
> > Hi,
> > 
> > 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?
> > 
> > Thanks,
> > cslev
> > 
> > _______________________________________________
> > P4-dev mailing list
> > P4-dev at lists.p4.org
> > http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
> > 



More information about the P4-dev mailing list