[dpdk-dev] [PATCH v2] net: fix build with gcc 4.4.7 and strict aliasing

Stephen Hemminger stephen at networkplumber.org
Tue Nov 24 23:42:44 CET 2015


On Tue, 24 Nov 2015 17:31:17 +0100
Daniel Mrzyglod <danielx.t.mrzyglod at intel.com> wrote:

> This fix is for IPv6 checksum offload error on RHEL65.
> Any optimalisation above -O0 provide error in IPv6 checksum
> flag "-fstrict-aliasing" is default for optimalisation above -O0.
> The solution is to add typedef with __attribute__((__may_alias__) for uint16_t.
> 
> Step 1 : start testpmd
> ./testpmd -c 0x6 -n 4  -- -i --portmask=0x3 --disable-hw-vlan --enable-rx-cksum --crc-strip --txqflags=0
> 
> Step 2 : settings and start
>            set verbose 1
>            set fwd csum
>            start
> 
> Step 3 : send scapy with bad checksum IPv6/TCP packet
>         Ether(src="52:00:00:00:00:00", dst="90:e2:ba:4a:33:5d")/IPv6(src="::1")/TCP(chksum=0xf)/("X"*46)
> 
> Step 4 : Recieved packets:
> RESULTS:
> IPv6/TCP': ['0xd41'] or other unexpected.
> 
> EXPECTED RESULTS:
> IPv6/TCP': ['0x9f5e']
> 
> Daniel Mrzyglod (1):
>   net: fix build with gcc 4.4.7 and strict aliasing
> 
>  lib/librte_net/rte_ip.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

An alternative way of fixing it (without resorting to attributes) would
be to use a union.


More information about the dev mailing list