From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id C50B05588 for ; Mon, 22 Feb 2016 19:19:12 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id g62so186569972wme.1 for ; Mon, 22 Feb 2016 10:19:12 -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=iIjM/VzBN3xw/PUq8uz1UaPls6SaAW9twiPY1vK0qpY=; b=GmQmbOCvnSWs/l9F99WjvlX23ZCtCsBvgPy6lMoNHLJLJNjrlY5F5CEy3T7OTj7bAI mvCPNAA7bQRECT9alSsZsrW95n4HZShPpGyUHsaMOpWXDcsTpDPuR1G7flPUJuyn8KBp d/O7gFz+rw0Hc3oIsj6yK4JRDQUJrMhjTjcd5ouLktKAbPgbijc6ZuUe2ZrFGmVU7TUh u5mSlaAF4QcsogmcE7ljaAKAZ38yySZ7PJVUi9XWbLeXF6NKCNK1RTV9sa3TF7j1w4Me gni28+MQPXtmihpMfd//PbAhml2Ak+KChYEughlcF6eZh5eVWXCsDFtd/pqj2EphavNl HaVg== 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=iIjM/VzBN3xw/PUq8uz1UaPls6SaAW9twiPY1vK0qpY=; b=bTMmGn/BgDSzy5kBV/HJxkz/2tWT+G7Lm7gbxL4fWYqT20kOo9RdHNs8Zyhr9y4lth bXNy82l7/doIMGAQiU/SPGKsznEPux3ACqaL2N09OVHtGbOjjq4fYsZlqGJ+cqzLeAcu up+PQFESHAuowJskIWRlS1iGKxxdppvY7dzj7tX2cKYn7r9I5JGfZ2DIf84tWQodYPiR o6/22GnlA0yTnZ6LmcB07enIP6VRP3YbqQ3mFLmDAQbezbRsk2q+F+DDRxhjFHW5qT0m bC3PB44KOvajRMYCMqjBLoT5B30Ppk8eVl/LHMiXpgnhrCh7SmJt2ZS6XACqRPCO3qnA nzSw== X-Gm-Message-State: AG10YOSMCk8ThkZxG4AfpjOhpsw0mxIebOUV0p9Y2vKXQkZ/GkcDTT2uBE4AL7O4XB/cuidU X-Received: by 10.194.201.166 with SMTP id kb6mr29918919wjc.125.1456165152693; Mon, 22 Feb 2016 10:19:12 -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 e14sm22296466wmi.21.2016.02.22.10.19.11 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Feb 2016 10:19:12 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 22 Feb 2016 19:18:42 +0100 Message-Id: <1456165123-28365-7-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 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: Mon, 22 Feb 2016 18:19:12 -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 eebe768460..4750205 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -155,6 +155,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