net/enic: fix L4 Rx ptype comparison
authorHyong Youb Kim <hyonkim@cisco.com>
Wed, 10 Jan 2018 09:17:04 +0000 (01:17 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
commit5dbff3af25a4a68980992f5040246e1d7f20b4cd
tree5fac6e49b3ead743b7a4743998aaebf1591fb6e6
parent023f19d66900ed5fbdd137ab57731b7a8dcc390b
net/enic: fix L4 Rx ptype comparison

For non-UDP/TCP packets, enic may wrongly set PKT_RX_L4_CKSUM_BAD in
ol_flags. The comparison that checks if a packet is UDP or TCP assumes
that RTE_PTYPE_L4 values are bit flags, but they are not. For example,
the following evaluates to true because NONFRAG is 0x600 and UDP is
0x200, and causes the current code to think the packet is UDP.

!!(RTE_PTYPE_L4_NONFRAG & RTE_PTYPE_L4_UDP)

So, fix this by comparing the packet type against UDP and TCP
individually.

Fixes: 453d15059b58 ("net/enic: use new Rx checksum flags")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
drivers/net/enic/enic_rxtx.c