From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id 978942C40 for ; Thu, 3 Mar 2016 15:28:05 +0100 (CET) Received: by mail-wm0-f42.google.com with SMTP id p65so33873017wmp.0 for ; Thu, 03 Mar 2016 06:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1YNEjrb4GJMPEQ8dDxAk1q3K6cx38cCUFeVMKbfh4dg=; b=hodYVXXdkrsXp85wJWbJL7q6dj5RfQ+m5gDxRtdK4fvb1vz9KclVOfg1dTz60ooiE6 Iif0bImEIGvNqUBL83OIsn4C722fH8kkmX+eNeAOeKOzgOQSYhybJSL7J3FY3/KjxCdK TDseXJNsRiLLdk4zNZPJdlLji5bjB2iDAzQ8uvvjHkWDOi8hgsD74Y+arfOk01gRbq3+ LuqfA07scobsmQIIYf5fNVPHx5adQHxlG29aXgcqBg6gS/mFEuKmJZsbqELoQsVN/duq yZQ9SEgfB1Xg2R0ijvxYrkwgFktb7QK9NjMvzOOZjJWhqQx7rFEBtdQWQTo2Vx0ghB+B YxwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1YNEjrb4GJMPEQ8dDxAk1q3K6cx38cCUFeVMKbfh4dg=; b=NBtB9Sgm00Rjnv4NvOZejVDCqnd4jvKxqfeYmkAVqSf/yudmv+Ov2ReeyjTtNZfci5 pU3culJVsR+6PkiUxn6CIP75CnlkbAo9LykMFwmNJbJcXaPhKdxYm1rBT5Ixz9SzJs5U 7tZE3or5JoxiUX+boPRdRLQqBjvI0y6IWp2Tdfdp5cYJMvsE4Fy1fCVWIc7Jc6MA8uLB OpIyrJZsDAMnusEF1Bvycwnrf7iC9+1OmTP91cK7Sz0Hp5RfFxLgLfRhdCVQEcBqXYWv YZkXiuezjMhDtDsvVI3T9W4IBjCEyxZGLri16WqFQxv9w5Mzjm2hL6SE7B14cw5JMNc9 hZnw== X-Gm-Message-State: AD7BkJLdgF6G1zp8mWV9NGtxNob7dBStL7hamkrdlFACb5HFl8XK+SlY1n2GHV85h2yEz4BG X-Received: by 10.194.7.201 with SMTP id l9mr3409758wja.16.1457015285510; Thu, 03 Mar 2016 06:28:05 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id lz5sm40794482wjb.5.2016.03.03.06.28.04 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Mar 2016 06:28:04 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Thu, 3 Mar 2016 15:27:39 +0100 Message-Id: <1457015260-3041-7-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH v2 6/7] mlx5: fix RX checksum offload in non L3/L4 packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2016 14:28:05 -0000 From: Yaacov Hazan Change rxq_cq_to_ol_flags() to set checksum flags according to packet type, so for non L3/L4 packets the mbuf chksum_bad flags will not be set. Fixes: 67fa62bc672d ("mlx5: support checksum offload") Signed-off-by: Yaacov Hazan --- doc/guides/rel_notes/release_16_04.rst | 4 ++++ drivers/net/mlx5/Makefile | 5 +++++ drivers/net/mlx5/mlx5_rxtx.c | 26 ++++++++++++++++++-------- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 6e94bbe..8669515 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -163,6 +163,10 @@ Drivers Prevented reception of multicast frames outside of configured VLANs. +* **mlx5: Fixed RX checksum offload in non L3/L4 packets.** + + Fixed report of bad checksum for packets of unknown type. + Libraries ~~~~~~~~~ diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 39cdf2c..7076ae3 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -132,6 +132,11 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh infiniband/verbs.h \ enum IBV_EXP_DEVICE_ATTR_VLAN_OFFLOADS \ $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_EXP_CQ_RX_TCP_PACKET \ + infiniband/verbs.h \ + enum IBV_EXP_CQ_RX_TCP_PACKET \ + $(AUTOCONF_OUTPUT) $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 4c53c7a..4919189 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -719,14 +719,24 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags) { uint32_t ol_flags = 0; - if (rxq->csum) - ol_flags |= - TRANSPOSE(~flags, - IBV_EXP_CQ_RX_IP_CSUM_OK, - PKT_RX_IP_CKSUM_BAD) | - TRANSPOSE(~flags, - IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK, - PKT_RX_L4_CKSUM_BAD); + if (rxq->csum) { + /* Set IP checksum flag only for IPv4/IPv6 packets. */ + if (flags & + (IBV_EXP_CQ_RX_IPV4_PACKET | IBV_EXP_CQ_RX_IPV6_PACKET)) + ol_flags |= + TRANSPOSE(~flags, + IBV_EXP_CQ_RX_IP_CSUM_OK, + PKT_RX_IP_CKSUM_BAD); +#ifdef HAVE_EXP_CQ_RX_TCP_PACKET + /* Set L4 checksum flag only for TCP/UDP packets. */ + if (flags & + (IBV_EXP_CQ_RX_TCP_PACKET | IBV_EXP_CQ_RX_UDP_PACKET)) +#endif /* HAVE_EXP_CQ_RX_TCP_PACKET */ + ol_flags |= + TRANSPOSE(~flags, + IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK, + PKT_RX_L4_CKSUM_BAD); + } /* * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional -- 2.1.4