From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8EDC2A0547; Thu, 24 Jun 2021 17:30:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1227240040; Thu, 24 Jun 2021 17:30:06 +0200 (CEST) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by mails.dpdk.org (Postfix) with ESMTP id 519514003C for ; Thu, 24 Jun 2021 17:30:05 +0200 (CEST) Received: by mail-ej1-f46.google.com with SMTP id hq39so10184083ejc.5 for ; Thu, 24 Jun 2021 08:30:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=edAU+lNVA949xjpeI/qSuwYSFC4GuWIx7durhr5zFoo=; b=b91M07MxAGQEvNub9VnrnaS3Y5W7j8ToH3zXPuRgX5alwECQPaeu4UrywFi0H6qAwX 10qPLav4bOU9NrJ2j1sxPkgexMZVCMnKgWVLd3nquNzhoNi/EKUVgGbkdEDX2EEzQwQq 8l7rSp1Ttq+/hQyquyvoDjpX2rlonfxd/CP4jZvMXUW/OxHCTOcxkuw0b0rWbSJgIg0o qEyJBQyOtd+v6KY8C4A63mhAv25cZHmjRMcGnSbie5OqfZ8VF1NnY9ndObQ6vyNS+lBP Mfby0ZCRfxmf02RKXoH2vDAT2O+Yoxz/MnxMV4Gk3w9aGNXOsjfTSBJKauIW44tAYO0l JChQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=edAU+lNVA949xjpeI/qSuwYSFC4GuWIx7durhr5zFoo=; b=l4SoF23sRHrcUZXlwvMTTFMgeh25nxZhG6gxK2Wij4oCUMdxvPamMWyxo2KSnw7SRH 9INiK4rE+sm4RmN4MRN5q9QMXvXS6H/KBCCnJsT71ENwF3YgbXWjjhgcvBgl2JlWGdCF jqYvBtFqGpfM+bko2kLShlMsmtvi1cp/yfgA6Dnk0JyNCrpmFz1vivhrDKfaJZYtTeMi jwwZl29gOxhSxW/H4N9U4UG0Upt8tmXyX0SQScDKzHEiH/BsrAFn8yPpHzcxRwDx/Xim vsF2IP6T6ah68QgkYuVTB0Ksc6sfHMKf0HN0FhwJaz1gMPfPw2EmYn1tOIlzKhAcDheQ TQBA== X-Gm-Message-State: AOAM531MrFp6L05IXUPmtzk8SueExM2pSJFLurGGLjugOIYf71sfFCTC 5vDE0EdWzGNIH3V+Ugs8nCZKQrpA3v/zhW+dD/6O2xZQ X-Google-Smtp-Source: ABdhPJxRRPaTVP0r8FTZyzqj3ypAfyn9EGB6WWvHzvih/ZLW+yODQSmyjap7qdPXzbuw+gabyBhWlA== X-Received: by 2002:a17:907:264c:: with SMTP id ar12mr5843862ejc.391.1624548604820; Thu, 24 Jun 2021 08:30:04 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id ar14sm1335329ejc.108.2021.06.24.08.30.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 08:30:04 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: Mohsin Kazmi , ray.kinsella@intel.com, Olivier Matz Date: Thu, 24 Jun 2021 17:28:02 +0200 Message-Id: <20210624152802.40249-1-mohsin.kazmi14@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net: prepare the outer ipv4 hdr for checksum X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Preparation the headers for the hardware offload misses the outer ipv4 checksum offload. It results in bad checksum computed by hardware NIC. This patch fixes the issue by setting the outer ipv4 checksum field to 0. Cc: ray.kinsella@intel.com Signed-off-by: Mohsin Kazmi --- lib/net/rte_net.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h index 434435ffa2..e47365099e 100644 --- a/lib/net/rte_net.h +++ b/lib/net/rte_net.h @@ -128,8 +128,18 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG))) return 0; - if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6)) + if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6)) { inner_l3_offset += m->outer_l2_len + m->outer_l3_len; + /* + * prepare outer ipv4 header checksum by setting it to 0, + * in order to be computed by hardware NICs. + */ + if (ol_flags & PKT_TX_OUTER_IP_CKSUM) { + ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, m->outer_l2_len); + ipv4_hdr->hdr_checksum = 0; + } + } /* * Check if headers are fragmented. -- 2.17.1