p4-dev@lists.p4.org

list for questions/discussion of p4 programs and tools

View all threads

Re: [P4-dev] packet replication and elimination

ST
Sachin Tiptur Satyanarayana Gupta
Fri, Nov 27, 2020 4:07 PM

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:021bd7b5-32f6-45f2-9314-d942608b1d92]

Thanks & Regards,

Sachin

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:021bd7b5-32f6-45f2-9314-d942608b1d92] Thanks & Regards, Sachin
SG
Sahil Gupta
Fri, Nov 27, 2020 5:28 PM

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

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 >