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 82896A0A0C; Tue, 29 Jun 2021 19:09:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3AB55411A5; Tue, 29 Jun 2021 19:09:03 +0200 (CEST) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by mails.dpdk.org (Postfix) with ESMTP id 102A340E01; Tue, 29 Jun 2021 19:09:02 +0200 (CEST) Received: by mail-ej1-f42.google.com with SMTP id v20so19014261eji.10; Tue, 29 Jun 2021 10:09:02 -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=6Hyt4Vb7iI1Anc+amJMzx5M5oNBolYZKkCuxFyMg2bE=; b=CKpuwq80JxLhnIfN7dw8AT+c5hRl01oOl2rZENr9TKsDzCl3p+TQSgwruhWjE1bcBw 2cO25NZTHOGRW58AKNOGGwo/KOugqDaBaSG9TO2LTeXO1udLqW4J0CSkKOeOiEJsDrYw glZ5BHoaBAVu+3iST5OtmjyVN+p/ACdZp/pmHun5uhkvjfYcL6wLjm6jT7bHRE31V9n4 I3jrgz8scrb41+bM3zOjdM5sW8G8/vS75w4obozROvUjw8ombWBhlPFxdAUniQ4uYUTG zx9wozW9MH4l2HWFogw7fcRqhcI2+wzsvJgrh+3XQARMoJfjkBDHx9ncllie9LgILbjB fnBA== 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=6Hyt4Vb7iI1Anc+amJMzx5M5oNBolYZKkCuxFyMg2bE=; b=nYiF3a0/bO0DN9WCHVT7jUWlPUBcFuXjrBKrW+w/ViQcKniVEp+MNwVE83UhIuhkCE +pNOwvWoD+A/rVuDR5t+k5kHPtn3d8dkoOy3H9tN7UOJOtWSsuxXNPa3VJnIrmrUr61U 7iI6Gu6sWjvqMLchwmsxBtW695YIo3CFeCTFLqqkWmGCP02BhghslWYAMIJtUhGvHs6d M3CQPtXoUJ7YGZSsJyQqs/VtO4gZU6a172bkB9WhOoJhh7+zqXHndjeqGbYho8DWQOjb 225daScc1XbpmnyYyHeys7OZMskk4fT5CaNQtmsc9drg6ei2Q8wk1SsIMsFotHgbRXDB KWpA== X-Gm-Message-State: AOAM530MJlU5uDFGX3gZ7fHiXlFg0ZS3qGN+8Og0s5j01uL4z9rSF41W AvnyfNsSYa3JC7WXrjvoJyJQq/e3eW4sNT6m X-Google-Smtp-Source: ABdhPJyeBgslt9q9H18j2xKNBfmEZrUQRJXmo4s/+8LSww/XyiJMbYELbSmynTqgCt+PF2eyMjrypg== X-Received: by 2002:a17:906:9bef:: with SMTP id de47mr30174982ejc.78.1624986541606; Tue, 29 Jun 2021 10:09:01 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id s4sm11612162edu.49.2021.06.29.10.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 10:09:01 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: ray.kinsella@intel.com, Mohsin Kazmi , stable@dpdk.org, Olivier Matz , Konstantin Ananyev , Thomas Monjalon , Tomasz Kulasek Date: Tue, 29 Jun 2021 19:06:58 +0200 Message-Id: <20210629170658.19452-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. Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation") Cc: stable@dpdk.org Signed-off-by: Mohsin Kazmi Acked-by: Qi Zhang --- 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