[P4-dev] Incremental checksum with v1model?
andy.fingerhut at gmail.com
Mon Feb 17 12:37:51 EST 2020
TCP option parsing is, in my guesstimate, on the bleeding edge of what a P4
implementation on a high speed ASIC might support. The example P4 code
that uses a header stack containing elements of a header_union type here:
It is possible that code will work on Bmv2 simple_switch, but perhaps not
many other P4 implementations. I have not personally tried compiling it on
anything besides the open source P4 development tools.
I have an idea for another way to write a TCP option parser, one that looks
for one specific option and then stops, which might be somewhat more
portable, which I may publish soon. I will send a note here if I publish
On Sun, Feb 16, 2020 at 11:37 PM Tom Barbette <barbette at kth.se> wrote:
> Hi all!
> I could make it work with Andy's pseudo code, many thanks! A sample is
> available at
> for further reference. We modify the TS option, so we have to fix the
> checksum. As there are different layouts of options that will end up on
> different 8bit boundaries it was impossible to use the
> update_checksum_with_payload, as mentioned below.
> Regarding the header_union parsing, it did not compile on our slightly
> outdated p4c. On top of that it is still not clear to me how I can use
> eg the timestamp option after that parsing among all the possible
> locations in the vector? It seemed to me that the code was more about
> "passing" the options. But I'm only beginning in P4...
> Le 16/02/2020 à 17:13, hemant at mnkcg.com a écrit :
> > Hi Tom,
> > Regarding parsing TCP options, Andy has sample P4 code. See
> > https://github.com/jafingerhut/p4-guide/tree/master/tcp-options-parser
> > The update_checksum requires the length of input data to be a multiple of
> > output size. A TCP option may be one octet long and mess up the
> > Once we have an update_checksum working for TCP options, p4c should
> > incorporate the code. Clearly update_checksum is not working for TCP
> > options.
> > Hemant
> > -----Original Message-----
> > From: Tom Barbette <barbette at kth.se>
> > Sent: Sunday, February 16, 2020 3:48 AM
> > To: hemant at mnkcg.com
> > Subject: Re: [P4-dev] Incremental checksum with v1model?
> > Hi Hemant!
> > Thanks but I'm looking at the incremental update. The problem is that we
> > have TCP options, which can appear at various places and, except if I'm
> > missing something, cannot be referenced with their correct 16 bit
> > in the update_checksum, with all the possible placements.
> > They're already a mess just to parse in the first place so...
> > So we're triyng to just "fix" the checksum according to the
> > Thanks,
> > Tom
> > Le 14/02/2020 à 17:28, hemant at mnkcg.com a écrit :
> >> https://github.com/harshgondaliya/BurstRadar/blob/master/burstradar.p4
> >> #L270
> >> Hemant
> >> -----Original Message-----
> >> From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Tom Barbette
> >> Sent: Friday, February 14, 2020 9:43 AM
> >> To: p4-dev <p4-dev at lists.p4.org>
> >> Subject: [P4-dev] Incremental checksum with v1model?
> >> Hi all,
> >> Does anyone have an example of incremental checksum correction (in my
> >> case for TCP) in P4 with the v1model? I know PSA has the
> >> InternetChecksum.substract, but I'd like to run it with v1.
> >> I tried a few common tricks, but I have a one compilment's bug from
> >> time to time.
> >> Thanks,
> >> Tom
> >> _______________________________________________
> >> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the P4-dev