[P4-dev] P4_16 resubmit/recirculate

Andy Fingerhut andy.fingerhut at gmail.com
Sun Sep 9 01:08:33 EDT 2018


Try calling resubmit() outside of any actions, perhaps, i.e. in a control
block.  The latest open source p4lang/p4c compiler has some limitations on
using if statements within actions right now.  I believe if the only code
in the then and else branches are simple assignment statements, it it
probably supported, but if there is anything with 'side effects' in the
branches like return, exit, resubmit(), etc., it is probably not currently
supported.

Andy

On Fri, Sep 7, 2018 at 12:22 AM cs.lev <cs.lev at gmx.com> wrote:

> I added the structs to my source as you suggested, and called resubmit
> in an action :S
>
> I still got an error as follows:
>
> error: MethodCallStatement: Conditional execution in actions is not
> supported on this target
>             resubmit(meta.resubmit_meta);
>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I have also tried with newer p4c compiler (v0.5).
>
> Thanks
>
> On Thu, 2018-09-06 at 14:09 +0000, Costa Molero  Edgar wrote:
> > Hi,
> >
> > You can see the extern definition in the v1model:
> >
> > extern void resubmit<T>(in T data);
> > extern void recirculate<T>(in T data);
> >
> > You need some metadata.
> >
> > For me this works: (at the ingress pipeline)
> >
> >
> > struct resubmit_meta_t {
> >    bit<8> i;
> > }
> >
> > struct metadata {
> >     resubmit_meta_t resubmit_meta;
> > }
> >
> >
> > resubmit(meta.resubmit_meta);
> >
> > Edgar
> >
> >
> > > On 6 Sep 2018, at 11:52, cs.lev <cs.lev at gmx.com> wrote:
> > >
> > > Dear All,
> > >
> > > I am trying to play with resubmit/recirculate in P4. From the
> > > specification, I have realized the recirculation can only be done
> > > in
> > > the egress pipeline, so maybe resubmit is the one that I need.
> > >
> > > I am expecting a special packet with a special header that I have
> > > defined, and once I got it, I want to modify the one of the header
> > > fields, and get received the modified packet again through the
> > > ingress
> > > pipeline.
> > >
> > > I have found an old commit message in p4lang/tutorials about
> > > resubmit,
> > > however the code itself is not part of the repo anymore, and it is
> > > also
> > > in P4_14 (not in P4_16) from which it is not straightforward how to
> > > reproduce it.
> > >
> > > My playground:
> > > In my pipeline, I don't really want to use any metadata (if it is
> > > not
> > > necessary), I only want to decrease the value of a specific header
> > > field with one and resubmit, then reduce again, and resubmit until
> > > that
> > > specific header field becomes 1. If it is reached, I would like to
> > > send
> > > it out to a port.
> > >
> > > If in an action I call resubmit() I got the following error:
> > >
> > > error: resubmit: Not enough arguments for call
> > >             resubmit();
> > >             ^^^^^^^^^^
> > > If I try to put hdr, meta, standard_metadata (from the Ingress
> > > processing control's parameters, I got the following error:
> > > error: MethodCallStatement: Conditional execution in actions is not
> > > supported on this target
> > >             resubmit(hdr);
> > >
> > >
> > > I am using the p4tutorial VM with simple_switch version: 1.10.0-
> > > 39abe290, with p4c 0.1.
> > >
> > > Thank you for considering my request.
> > >
> > > BR,
> > > cs.lev
> > >
> > > _______________________________________________
> > > 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/20180908/8322b098/attachment.html>


More information about the P4-dev mailing list