DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rasesh Mody <rasesh.mody@cavium.com>
To: <dev@dpdk.org>
Cc: Harish Patil <harish.patil@cavium.com>, <Dept-EngDPDKDev@cavium.com>
Subject: [dpdk-dev] [PATCH 4/7] net/qede: fix inner L3/L4 chksum offload for tunnel frames
Date: Mon, 24 Jul 2017 03:19:05 -0700	[thread overview]
Message-ID: <1500891548-21896-4-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1500891548-21896-1-git-send-email-rasesh.mody@cavium.com>

From: Harish Patil <harish.patil@cavium.com>

Force recalculation of tunnel L4 chksum when inner L3/L4 chskum gets
updated due to HW offload.

Fixes: aab21617502e ("net/qede: add Tx offloads for MPLS-in-UDP packets")

Signed-off-by: Harish Patil <harish.patil@cavium.com>
---
 drivers/net/qede/qede_rxtx.c |   29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index a232d20..5c3613c 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -1681,12 +1681,6 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
 				inner_l4_hdr_offset = (mbuf->l2_len -
 					MPLSINUDP_HDR_SIZE + mbuf->l3_len) / 2;
 
-				/* TODO: There's no DPDK flag to request outer
-				 * L4 checksum offload, so we don't do it.
-				 * bd1_bd_flags_bf |=
-				 *      ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK <<
-				 *      ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_SHIFT;
-				 */
 				/* Inner L2 size and address type */
 				bd2_bf1 |= (inner_l2_hdr_size &
 					ETH_TX_DATA_2ND_BD_TUNN_INNER_L2_HDR_SIZE_W_MASK) <<
@@ -1765,15 +1759,36 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
 		}
 
 		/* Offload the IP checksum in the hardware */
-		if (tx_ol_flags & PKT_TX_IP_CKSUM)
+		if (tx_ol_flags & PKT_TX_IP_CKSUM) {
 			bd1_bd_flags_bf |=
 				1 << ETH_TX_1ST_BD_FLAGS_IP_CSUM_SHIFT;
+			/* There's no DPDK flag to request outer-L4 csum
+			 * offload. But in the case of tunnel if inner L3 or L4
+			 * csum offload is requested then we need to force
+			 * recalculation of L4 tunnel header csum also.
+			 */
+			if (tunn_flg) {
+				bd1_bd_flags_bf |=
+					ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK <<
+					ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_SHIFT;
+			}
+		}
 
 		/* L4 checksum offload (tcp or udp) */
 		if ((tx_ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)) &&
 		    (tx_ol_flags & (PKT_TX_UDP_CKSUM | PKT_TX_TCP_CKSUM))) {
 			bd1_bd_flags_bf |=
 				1 << ETH_TX_1ST_BD_FLAGS_L4_CSUM_SHIFT;
+			/* There's no DPDK flag to request outer-L4 csum
+			 * offload. But in the case of tunnel if inner L3 or L4
+			 * csum offload is requested then we need to force
+			 * recalculation of L4 tunnel header csum also.
+			 */
+			if (tunn_flg) {
+				bd1_bd_flags_bf |=
+					ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_MASK <<
+					ETH_TX_1ST_BD_FLAGS_TUNN_L4_CSUM_SHIFT;
+			}
 		}
 
 		/* Fill the entry in the SW ring and the BDs in the FW ring */
-- 
1.7.10.3

  parent reply	other threads:[~2017-07-24 10:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 10:19 [dpdk-dev] [PATCH 1/7] net/qede/base: fix recovery from previous ungraceful exit Rasesh Mody
2017-07-24 10:19 ` [dpdk-dev] [PATCH 2/7] net/qede: fix incorrect queue id for 100G Rasesh Mody
2017-07-24 10:19 ` [dpdk-dev] [PATCH 3/7] net/qede/base: fix for adapter specific stats Rasesh Mody
2017-07-24 10:19 ` Rasesh Mody [this message]
2017-07-24 10:19 ` [dpdk-dev] [PATCH 5/7] doc: list NPAR as supported feature in qede Rasesh Mody
2017-07-28 15:56   ` Mcnamara, John
2017-08-05  5:56   ` Mody, Rasesh
2017-08-06 10:43     ` Thomas Monjalon
2017-07-24 10:19 ` [dpdk-dev] [PATCH 6/7] net/qede: fix chip details print Rasesh Mody
2017-07-24 10:19 ` [dpdk-dev] [PATCH 7/7] net/qede: update PMD version 2.5.2.1 Rasesh Mody
2017-07-31 17:53 ` [dpdk-dev] [PATCH 1/7] net/qede/base: fix recovery from previous ungraceful exit Ferruh Yigit
2017-08-05  5:59   ` Mody, Rasesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1500891548-21896-4-git-send-email-rasesh.mody@cavium.com \
    --to=rasesh.mody@cavium.com \
    --cc=Dept-EngDPDKDev@cavium.com \
    --cc=dev@dpdk.org \
    --cc=harish.patil@cavium.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).