[P4-dev] Incremental checksum with v1model?

hemant at mnkcg.com hemant at mnkcg.com
Mon Feb 17 22:46:39 EST 2020


TCP parsing has similar complexity as parsing MPLS stack in the P4 parser.  One can parse MPLS stack recursively in the parser and recursion ends with MPLS bos label.  TCP has option 0 for end of options list.  Parse TCP options recursively and end recursion at end of options list.   

                                                                                                                                                                             

Hemant

 

From: Andy Fingerhut <andy.fingerhut at gmail.com> 
Sent: Monday, February 17, 2020 12:38 PM
To: Tom Barbette <barbette at kth.se>
Cc: hemant at mnkcg.com; p4-dev <p4-dev at lists.p4.org>
Subject: Re: [P4-dev] Incremental checksum with v1model?

 

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: https://github.com/jafingerhut/p4-guide/tree/master/tcp-options-parser

 

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 it.

 

Andy

 

On Sun, Feb 16, 2020 at 11:37 PM Tom Barbette <barbette at kth.se <mailto:barbette at kth.se> > wrote:

Hi all!

I could make it work with Andy's pseudo code, many thanks! A sample is 
available at 
https://github.com/cheetahlb/cheetah-p4/blob/master/cheetah-stateless.p4 
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...

Thanks,

Tom

Le 16/02/2020 à 17:13, hemant at mnkcg.com <mailto: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 multiple.
> 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 <mailto:barbette at kth.se> >
> Sent: Sunday, February 16, 2020 3:48 AM
> To: hemant at mnkcg.com <mailto: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 boundary
> 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 modifications.
> 
> Thanks,
> Tom
> 
> Le 14/02/2020 à 17:28, hemant at mnkcg.com <mailto: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 <mailto: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 <mailto: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 <mailto: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 <mailto: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/20200217/a405edc6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1594 bytes
Desc: not available
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20200217/a405edc6/attachment-0001.p7s>


More information about the P4-dev mailing list