[P4-dev] statefulness in BMv2

Raj Joshi rajjoshi at comp.nus.edu.sg
Sat Oct 13 06:45:42 EDT 2018


>
> 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?

==> All these things depend on the specific hardware target (programmable
switch/NIC) that you are dealing with - how much hardware resources (esp.
SRAM) are available and how these are used to implement register arrays. I
am not sure of the exact limits in case of bmv2/simple_switch. But since it
is open source, theoretically speaking there shouldn't be any limits.

Raj


On Sat, Oct 13, 2018 at 1:19 PM cs.lev <cs.lev at gmx.com> wrote:

> 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
> > >
>
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20181013/7be03d76/attachment.html>


More information about the P4-dev mailing list