[dpdk-dev] [PATCH] app/testpmd: fix IP checksum calculation
Stephen Hemminger
stephen at networkplumber.org
Thu Dec 3 19:33:05 CET 2020
On Thu, 3 Dec 2020 10:35:50 -0600
George Prekas <prekageo at amazon.com> wrote:
> 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.
>
>
But the compiler should be detecting any aliasing here, if no you have
a bad compiler.
More information about the dev
mailing list