[P4-dev] Incremental checksum with v1model?

hemant at mnkcg.com hemant at mnkcg.com
Mon Feb 17 10:37:33 EST 2020


Tom,

 

I have used a p4c version which is few days old.   The p4 code compiles.

 

hemant at ubuntu:~/p4c/build$ ./p4c --version

p4c 1.2.0 (SHA: c71bd1f6)

hemant at ubuntu:~/p4c/build$ ./p4c-bm2-ss --std p4-16
/tmp/p4-guide/tcp-options-parser/tcp-options-parser2.p4

 

I haven’t looked at Andy’s tcp options parsing code.  However, looking at
the TCP timestamp option, I see the option uses a TLV format.  In the P4
parser, work off of the Type of the TLV format to parse the timestamp
option.   You can just use a header stack (or array) to store TCP options
because p4c now supports runtime index into array.  The runtime index got
checked into p4c around end of January 2020.  To develop TCP options
parsing, use this IANA repo:

 

https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml#tcp-par
ameters-1

 

The URL says options 0 and 1 are one octet in size and their kind (or type)
is 0 and 1.

 

Hemant

 

-----Original Message-----
From: Tom Barbette <barbette at kth.se> 
Sent: Monday, February 17, 2020 2:37 AM
To: hemant at mnkcg.com
Cc: p4-dev at lists.p4.org
Subject: Re: [P4-dev] Incremental checksum with v1model?

 

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>
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,  <mailto:hemant at mnkcg.com> 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>
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 < <mailto:barbette at kth.se> barbette at kth.se>

> Sent: Sunday, February 16, 2020 3:48 AM

> To:  <mailto:hemant at mnkcg.com> 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,  <mailto:hemant at mnkcg.com> hemant at mnkcg.com a écrit
:

>>  <https://github.com/harshgondaliya/BurstRadar/blob/master/burstradar.p>
https://github.com/harshgondaliya/BurstRadar/blob/master/burstradar.p

>> 4

>> #L270

>> 

>> Hemant

>> 

>> -----Original Message-----

>> From: P4-dev < <mailto:p4-dev-bounces at lists.p4.org>
p4-dev-bounces at lists.p4.org> On Behalf Of Tom Barbette

>> Sent: Friday, February 14, 2020 9:43 AM

>> To: p4-dev < <mailto:p4-dev at lists.p4.org> 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

>>  <mailto:P4-dev at lists.p4.org> P4-dev at lists.p4.org

>>  <http://lists.p4.org/mailman/listinfo/p4-dev_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/713ecb66/attachment.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/713ecb66/attachment.p7s>


More information about the P4-dev mailing list