[dpdk-dev] [PATCH] app/testpmd: fix IP checksum calculation

George Prekas prekageo at amazon.com
Thu Dec 3 17:35:50 CET 2020


On 12/3/2020 10:08 AM, Stephen Hemminger wrote:
> On Thu, 3 Dec 2020 07:59:54 -0600
> George Prekas <prekageo at amazon.com> wrote:
>
>> Insert a compiler barrier to make sure that the IP checksum calculation
>> happens after setting all the fields of the IP header.
>>
>> Signed-off-by: George Prekas <prekageo at amazon.com>
> I don't think this is necessary. All other OS's don't have to do this.
> The CPU is going to maintain proper memory order.

Hi Stephen,

This is not a CPU or OS issue. This is a compiler issue. The compiler is 
free to reorder statements if it does not detect dependencies between 
them. Without this compiler barrier, the calculated IP checksum is wrong.




More information about the dev mailing list