[P4-dev] Incremental checksum with v1model?

Tom Barbette barbette at kth.se
Mon Feb 17 02:37:02 EST 2020


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



More information about the P4-dev mailing list