p4-dev@lists.p4.org

list for questions/discussion of p4 programs and tools

View all threads

Re: [P4-dev] packet replication and elimination

SG
Sahil Gupta
Fri, Nov 27, 2020 8:54 PM

The reason I suggest you recirculation feature to encapsulate the packet in
the second round.
I am not sure if you can clone packets initially at ingress and pass
through tables in egress.
If that is possible, then recirculation is not required. Else you might
recirculate just to put extra header. Check if packet is recirculated and
design action function to add extra header.
Refer advance_tunnel for more details.

On Fri, Nov 27, 2020, 3:48 PM Sachin Tiptur Satyanarayana Gupta <
sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote:

Hi Sahil,

My use case is to clone and redirect the pkts on two interfaces. Thank
you for the inputs and detailed references. I will try those things.

Thanks,

Sachin


From: Sahil Gupta sg5414@rit.edu
Sent: Friday, November 27, 2020 6:28:58 PM
To: Sachin Tiptur Satyanarayana Gupta
Cc: p4-dev@lists.p4.org
Subject: Re: [P4-dev] packet replication and elimination

Hi Sachin,
You can duplicate the pack using the cloning function and then resend the
packet back to ingress pipeline.
For adding any custom header, you can use setValid()and seInValid()
features. You can refer advance_tunnel program from tutorial exercises.
I am attaching all possible references that will help you to clone, resend
packet back to ingress pipeline, and adding custom header.
See [3] and [4], for implementations, these examples give you enough code
to complete your task.
For creating topology, mininet will be a good way to start. Refer to
tutorial exercises for an easy way to create above topology.
Hope it helps

Reference:
[1]
https://carolinafernandez.github.io/development/2019/08/06/Recurrent-processing-in-P4
[2]
https://github.com/CarolinaFernandez/p4-tutorials/tree/master/exercises/recirculate
[3]
https://github.com/CarolinaFernandez/p4-tutorials/blob/master/exercises/recirculate/solution/recirculate.p4
[4]
https://github.com/p4lang/tutorials/blob/master/exercises/p4runtime/advanced_tunnel.p4
[5] https://github.com/p4lang/tutorials/tree/master/exercises

On Fri, Nov 27, 2020 at 11:09 AM Sachin Tiptur Satyanarayana Gupta <
sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote:

Hi P4 developers,

I am working on a internship topic related to deterministic networks. We
are trying to implement packet replication and elimination as part of this.
I came across p4 and started with tutorials and thought of using bmv2
simple_switch(tutorial code base and vm image) for this.

Requirement: Below is the network topology. In this, p4 switches on the
edge,

  1. duplicates the incoming packets from sender and sends over the two
    different path to the same destination. For duplication, I am considering
    to add a custom header(sequence number) to pkts which need to be
    duplicated. Is it possible to generate sequence number in P4 for each
    packet and how can I do that?(like incrementing a variable)

  2. Eliminates the duplicate packet(if already one is received) on the
    receiving side using a lookup table. Here, I will parse sequence
    number(from custom header) and if the sequence number is not present in
    table/map, store it in map and accept the packet. If present, delete the
    map entry and drop the packet. Is this kind of map or table read/write
    access is possible with p4?

Thanks & Regards,

Sachin


P4-dev mailing list
P4-dev@lists.p4.org
http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

The reason I suggest you recirculation feature to encapsulate the packet in the second round. I am not sure if you can clone packets initially at ingress and pass through tables in egress. If that is possible, then recirculation is not required. Else you might recirculate just to put extra header. Check if packet is recirculated and design action function to add extra header. Refer advance_tunnel for more details. On Fri, Nov 27, 2020, 3:48 PM Sachin Tiptur Satyanarayana Gupta < sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote: > Hi Sahil, > > > My use case is to clone and redirect the pkts on two interfaces. Thank > you for the inputs and detailed references. I will try those things. > > > Thanks, > > Sachin > > > ------------------------------ > *From:* Sahil Gupta <sg5414@rit.edu> > *Sent:* Friday, November 27, 2020 6:28:58 PM > *To:* Sachin Tiptur Satyanarayana Gupta > *Cc:* p4-dev@lists.p4.org > *Subject:* Re: [P4-dev] packet replication and elimination > > Hi Sachin, > You can duplicate the pack using the cloning function and then resend the > packet back to ingress pipeline. > For adding any custom header, you can use setValid()and seInValid() > features. You can refer advance_tunnel program from tutorial exercises. > I am attaching all possible references that will help you to clone, resend > packet back to ingress pipeline, and adding custom header. > See [3] and [4], for implementations, these examples give you enough code > to complete your task. > For creating topology, mininet will be a good way to start. Refer to > tutorial exercises for an easy way to create above topology. > Hope it helps > > Reference: > [1] > https://carolinafernandez.github.io/development/2019/08/06/Recurrent-processing-in-P4 > [2] > https://github.com/CarolinaFernandez/p4-tutorials/tree/master/exercises/recirculate > [3] > https://github.com/CarolinaFernandez/p4-tutorials/blob/master/exercises/recirculate/solution/recirculate.p4 > [4] > https://github.com/p4lang/tutorials/blob/master/exercises/p4runtime/advanced_tunnel.p4 > [5] https://github.com/p4lang/tutorials/tree/master/exercises > > > > On Fri, Nov 27, 2020 at 11:09 AM Sachin Tiptur Satyanarayana Gupta < > sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote: > >> Hi P4 developers, >> >> >> I am working on a internship topic related to deterministic networks. We >> are trying to implement packet replication and elimination as part of this. >> I came across p4 and started with tutorials and thought of using bmv2 >> simple_switch(tutorial code base and vm image) for this. >> >> >> Requirement: Below is the network topology. In this, p4 switches on the >> edge, >> >> 1. duplicates the incoming packets from sender and sends over the two >> different path to the same destination. For duplication, I am considering >> to add a custom header(sequence number) to pkts which need to be >> duplicated. Is it possible to generate sequence number in P4 for each >> packet and how can I do that?(like incrementing a variable) >> >> 2. Eliminates the duplicate packet(if already one is received) on the >> receiving side using a lookup table. Here, I will parse sequence >> number(from custom header) and if the sequence number is not present in >> table/map, store it in map and accept the packet. If present, delete the >> map entry and drop the packet. Is this kind of map or table read/write >> access is possible with p4? >> >> >> >> >> >> Thanks & Regards, >> >> Sachin >> >> >> >> _______________________________________________ >> P4-dev mailing list >> P4-dev@lists.p4.org >> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org >> >
ST
Sachin Tiptur Satyanarayana Gupta
Mon, Nov 30, 2020 9:34 AM

I will try that. thank you for the pointers.

Thanks,

Sachin


From: Sahil Gupta sg5414@rit.edu
Sent: Friday, November 27, 2020 9:54:46 PM
To: Sachin Tiptur Satyanarayana Gupta; p4-dev
Subject: Re: [P4-dev] packet replication and elimination

The reason I suggest you recirculation feature to encapsulate the packet in the second round.
I am not sure if you can clone packets initially at ingress and pass through tables in egress.
If that is possible, then recirculation is not required. Else you might recirculate just to put extra header. Check if packet is recirculated and design action function to add extra header.
Refer advance_tunnel for more details.

On Fri, Nov 27, 2020, 3:48 PM Sachin Tiptur Satyanarayana Gupta <sachin.tiptur.satyanarayana.gupta@hof-university.demailto:sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote:

Hi Sahil,

My use case is to clone and redirect the pkts on two interfaces. Thank you for the inputs and detailed references. I will try those things.

Thanks,

Sachin


From: Sahil Gupta <sg5414@rit.edumailto:sg5414@rit.edu>
Sent: Friday, November 27, 2020 6:28:58 PM
To: Sachin Tiptur Satyanarayana Gupta
Cc: p4-dev@lists.p4.orgmailto:p4-dev@lists.p4.org
Subject: Re: [P4-dev] packet replication and elimination

Hi Sachin,
You can duplicate the pack using the cloning function and then resend the packet back to ingress pipeline.
For adding any custom header, you can use setValid()and seInValid() features. You can refer advance_tunnel program from tutorial exercises.
I am attaching all possible references that will help you to clone, resend packet back to ingress pipeline, and adding custom header.
See [3] and [4], for implementations, these examples give you enough code to complete your task.
For creating topology, mininet will be a good way to start. Refer to tutorial exercises for an easy way to create above topology.
Hope it helps

Reference:
[1] https://carolinafernandez.github.io/development/2019/08/06/Recurrent-processing-in-P4
[2] https://github.com/CarolinaFernandez/p4-tutorials/tree/master/exercises/recirculate
[3] https://github.com/CarolinaFernandez/p4-tutorials/blob/master/exercises/recirculate/solution/recirculate.p4
[4] https://github.com/p4lang/tutorials/blob/master/exercises/p4runtime/advanced_tunnel.p4
[5] https://github.com/p4lang/tutorials/tree/master/exercises

On Fri, Nov 27, 2020 at 11:09 AM Sachin Tiptur Satyanarayana Gupta <sachin.tiptur.satyanarayana.gupta@hof-university.demailto:sachin.tiptur.satyanarayana.gupta@hof-university.de> wrote:

Hi P4 developers,

I am working on a internship topic related to deterministic networks. We are trying to implement packet replication and elimination as part of this. I came across p4 and started with tutorials and thought of using bmv2 simple_switch(tutorial code base and vm image) for this.

Requirement: Below is the network topology. In this, p4 switches on the edge,

  1. duplicates the incoming packets from sender and sends over the two different path to the same destination. For duplication, I am considering to add a custom header(sequence number) to pkts which need to be duplicated. Is it possible to generate sequence number in P4 for each packet and how can I do that?(like incrementing a variable)

  2. Eliminates the duplicate packet(if already one is received) on the receiving side using a lookup table. Here, I will parse sequence number(from custom header) and if the sequence number is not present in table/map, store it in map and accept the packet. If present, delete the map entry and drop the packet. Is this kind of map or table read/write access is possible with p4?

[cid:1760abfb939f456b1e51]

Thanks & Regards,

Sachin


P4-dev mailing list
P4-dev@lists.p4.orgmailto:P4-dev@lists.p4.org
http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

I will try that. thank you for the pointers. Thanks, Sachin ________________________________ From: Sahil Gupta <sg5414@rit.edu> Sent: Friday, November 27, 2020 9:54:46 PM To: Sachin Tiptur Satyanarayana Gupta; p4-dev Subject: Re: [P4-dev] packet replication and elimination The reason I suggest you recirculation feature to encapsulate the packet in the second round. I am not sure if you can clone packets initially at ingress and pass through tables in egress. If that is possible, then recirculation is not required. Else you might recirculate just to put extra header. Check if packet is recirculated and design action function to add extra header. Refer advance_tunnel for more details. On Fri, Nov 27, 2020, 3:48 PM Sachin Tiptur Satyanarayana Gupta <sachin.tiptur.satyanarayana.gupta@hof-university.de<mailto:sachin.tiptur.satyanarayana.gupta@hof-university.de>> wrote: Hi Sahil, My use case is to clone and redirect the pkts on two interfaces. Thank you for the inputs and detailed references. I will try those things. Thanks, Sachin ________________________________ From: Sahil Gupta <sg5414@rit.edu<mailto:sg5414@rit.edu>> Sent: Friday, November 27, 2020 6:28:58 PM To: Sachin Tiptur Satyanarayana Gupta Cc: p4-dev@lists.p4.org<mailto:p4-dev@lists.p4.org> Subject: Re: [P4-dev] packet replication and elimination Hi Sachin, You can duplicate the pack using the cloning function and then resend the packet back to ingress pipeline. For adding any custom header, you can use setValid()and seInValid() features. You can refer advance_tunnel program from tutorial exercises. I am attaching all possible references that will help you to clone, resend packet back to ingress pipeline, and adding custom header. See [3] and [4], for implementations, these examples give you enough code to complete your task. For creating topology, mininet will be a good way to start. Refer to tutorial exercises for an easy way to create above topology. Hope it helps Reference: [1] https://carolinafernandez.github.io/development/2019/08/06/Recurrent-processing-in-P4 [2] https://github.com/CarolinaFernandez/p4-tutorials/tree/master/exercises/recirculate [3] https://github.com/CarolinaFernandez/p4-tutorials/blob/master/exercises/recirculate/solution/recirculate.p4 [4] https://github.com/p4lang/tutorials/blob/master/exercises/p4runtime/advanced_tunnel.p4 [5] https://github.com/p4lang/tutorials/tree/master/exercises On Fri, Nov 27, 2020 at 11:09 AM Sachin Tiptur Satyanarayana Gupta <sachin.tiptur.satyanarayana.gupta@hof-university.de<mailto:sachin.tiptur.satyanarayana.gupta@hof-university.de>> wrote: Hi P4 developers, I am working on a internship topic related to deterministic networks. We are trying to implement packet replication and elimination as part of this. I came across p4 and started with tutorials and thought of using bmv2 simple_switch(tutorial code base and vm image) for this. Requirement: Below is the network topology. In this, p4 switches on the edge, 1. duplicates the incoming packets from sender and sends over the two different path to the same destination. For duplication, I am considering to add a custom header(sequence number) to pkts which need to be duplicated. Is it possible to generate sequence number in P4 for each packet and how can I do that?(like incrementing a variable) 2. Eliminates the duplicate packet(if already one is received) on the receiving side using a lookup table. Here, I will parse sequence number(from custom header) and if the sequence number is not present in table/map, store it in map and accept the packet. If present, delete the map entry and drop the packet. Is this kind of map or table read/write access is possible with p4? [cid:1760abfb939f456b1e51] Thanks & Regards, Sachin _______________________________________________ P4-dev mailing list P4-dev@lists.p4.org<mailto:P4-dev@lists.p4.org> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org