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 32B1FA0547; Thu, 24 Jun 2021 17:16:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A451640040; Thu, 24 Jun 2021 17:16:53 +0200 (CEST) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by mails.dpdk.org (Postfix) with ESMTP id 4A4694003C for ; Thu, 24 Jun 2021 17:16:53 +0200 (CEST) Received: by mail-ed1-f44.google.com with SMTP id df12so9080818edb.2 for ; Thu, 24 Jun 2021 08:16:53 -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=HZ9fT/MyBbxKjUGEPGbCiMTMVgNjmXjxvkLKH79yLQA=; b=SffG1/ltUgcNZyLYtcFokOUOvIzky3gpIrV7FRUGcIxXtuLpFR13N2o71o2Q7zEKzv HckpEZapO79gy1U6Ilh/VI4pVEBBR+nZ+q++Y8CjarbFnw3TX4O1fg3NQQMA7I5DS/Ms wANXJn0diRCBwJkt7hhTrwGbeksHZvM0W490wQDE0p4aSFbH5UZmWQps6k0rT4daohQ3 Pfd4qjV3mMRgS+aHVlk1FMPhnaxNEJmhj9GR3Qt3bTBgJLJmXqu2KyFUxH+6X8PTD02Q S2XT087zEY/Q6/ijHp6cJgWgZecGN1wE1vnnNrVeiNwsLzjV+0NX65/b9pdBgOEDhEBB z6oA== 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=HZ9fT/MyBbxKjUGEPGbCiMTMVgNjmXjxvkLKH79yLQA=; b=Gd/BX17TL8qkjF/O6SMWbyB8EH+k3srIuaBZYsaWQK8DjUQjPcHbQaeL6TYxkxHEeH q5gYtgXiTqCDj5pYsLGFMTnePaU37+PNjv1IC9Qon5SZaccoZPzTrL57p4bLuVQ6lPTm f7ohvgy+12WQ1a11DSdKJOTSv7rEfp+yY2O5eiOR6kldp6ZL3QrOLxDjQkI2usOLPJ8l 3qifS94Fr6YAhf1T4OGYNrvOtflK8bwxCmfi73rduNG/ZsCNUpJTT71kdDybh0Pf3fXm oOuKVO38Ewy0h1VbzCCjQwBuQpddHwaQwSep/xAHMlz3KLiaeApaoveV/M26IeEQGj2u xmAA== X-Gm-Message-State: AOAM533Us/Y3G5EdpRon/fJnijjoWu9Sj5wYOMT/v2u+qJ9lz7nlGf3f VO0WJaZU+HD6XgibF0HCo2LNyI01HLzBxadCW1As71A4 X-Google-Smtp-Source: ABdhPJwirX8qXeIBQwP/8mKfjgGIudL0GPrGkGJU0n6wrZCnMEyf64oFutEeVAxrNhb8gQS2vFO0Iw== X-Received: by 2002:a05:6402:1345:: with SMTP id y5mr7899031edw.206.1624547812776; Thu, 24 Jun 2021 08:16:52 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id w10sm2145940edv.34.2021.06.24.08.16.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 08:16:52 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: Mohsin Kazmi , ray.kinsella@intel.com, Olivier Matz Date: Thu, 24 Jun 2021 17:14:49 +0200 Message-Id: <20210624151449.39799-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..48093830a0 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