[dpdk-dev] net/enic: bad L4 checksum ptype set on ICMP packets

Message ID 1471472126-8103-1-git-send-email-johndale@cisco.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

John Daley (johndale) Aug. 17, 2016, 10:15 p.m. UTC
  The bad L4 checksum flag was set on IP packets which were not
also TCP or UDP packets. This includes ICMP, IGMP and OSPF packets.

L4 ptypes were being treated as bits instead of values within the
L4 mask causing the code to check L4 checksum in the completion
queue and incorrectly set the L4 bad checksum flag.

Fixes: 947d860c821f ("enic: improve Rx performance")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_rxtx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson Sept. 21, 2016, 11:19 a.m. UTC | #1
On Wed, Aug 17, 2016 at 03:15:26PM -0700, John Daley wrote:
> The bad L4 checksum flag was set on IP packets which were not
> also TCP or UDP packets. This includes ICMP, IGMP and OSPF packets.
> 
> L4 ptypes were being treated as bits instead of values within the
> L4 mask causing the code to check L4 checksum in the completion
> queue and incorrectly set the L4 bad checksum flag.
> 
> Fixes: 947d860c821f ("enic: improve Rx performance")
> 
> Reviewed-by: Nelson Escobar <neescoba@cisco.com>
> Signed-off-by: John Daley <johndale@cisco.com>

Applied to dpdk-next-net/rel_16_11

/Bruce
  

Patch

diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index 50f0b28..ad59613 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -212,9 +212,12 @@  enic_cq_rx_to_pkt_flags(struct cq_desc *cqd, struct rte_mbuf *mbuf)
 	/* checksum flags */
 	if (!enic_cq_rx_desc_csum_not_calc(cqrd) &&
 		(mbuf->packet_type & RTE_PTYPE_L3_IPV4)) {
+		uint32_t l4_flags = mbuf->packet_type & RTE_PTYPE_L4_MASK;
+
 		if (unlikely(!enic_cq_rx_desc_ipv4_csum_ok(cqrd)))
 			pkt_flags |= PKT_RX_IP_CKSUM_BAD;
-		if (mbuf->packet_type & (RTE_PTYPE_L4_UDP | RTE_PTYPE_L4_TCP)) {
+		if (l4_flags == RTE_PTYPE_L4_UDP ||
+		    l4_flags == RTE_PTYPE_L4_TCP) {
 			if (unlikely(!enic_cq_rx_desc_tcp_udp_csum_ok(cqrd)))
 				pkt_flags |= PKT_RX_L4_CKSUM_BAD;
 		}