[P4-dev] P4_16 resubmit/recirculate

cs.lev cs.lev at gmx.com
Mon Sep 10 02:32:23 EDT 2018


Thans everyone!
I will check all options and let you know, which one worked out well.

lev

On Sun, 2018-09-09 at 11:06 -0400, hemant at mnkcg.com wrote:
> The bmv2 and p4test backends use the predication midend pass.  This
> pass operates on action bodies and tries to convert if-statements to
> ? expression.   If conversion fails, the pass raises an error – the
> error seen is from the predication pass.   
>  
> Andy is correct.  Move the call to resubmit() to outside the action,
> perhaps in the control’s apply {} block.  It would be also good for
> the tutorials to be updated with a P4-16 program that works for
> resubmit(), recirculate() etc.
>  
> Hemant
>  
> From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Andy
> Fingerhut
> Sent: Sunday, September 09, 2018 1:09 AM
> To: cs.lev at gmx.com
> Cc: Costa Molero Edgar <cedgar at ethz.ch>; p4-dev <p4-dev at lists.p4.org>
> Subject: Re: [P4-dev] P4_16 resubmit/recirculate
>  
> 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



More information about the P4-dev mailing list