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 20FBCA0C3F for ; Wed, 30 Jun 2021 13:06:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1740A41260; Wed, 30 Jun 2021 13:06:12 +0200 (CEST) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by mails.dpdk.org (Postfix) with ESMTP id C964A40040; Wed, 30 Jun 2021 13:06:09 +0200 (CEST) Received: by mail-ej1-f54.google.com with SMTP id gt10so2172467ejc.5; Wed, 30 Jun 2021 04:06:09 -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=NL2HNGU1az6iLtFEhqIIa7zT2JUmACjSrdOwCaRhJRQ=; b=UWkqVQxx6LODAZ1KrIeET2PlhDKCww8fHAdZjgEV5Tj45HtQbyqYlIXXd9MYYmZlpJ X+DvkZjqg/iEbRR5mAT4mhbSZWqvU7Q8+xsKwCtx+MlY1Oax6H9LlQoTlY/OC81j96rI WH/Y9DZa6UmbfXDH6RwixtK6k/Xs0L/b7duvsdvXEvV5OXROWxaoVOSYsnHkxiPwHWGV LIhz+xQhY/CupoCg463h5iOi6FQ7PFrrSU0M3HpeHxvL/jF2MA6/L8YQHyXGXm8FKR2C UO4J3mh8WGTvKG/XuXHcdRSCt5wdKhGheMnH7Fe4W/4KwmtbEl+tzccte1VbVT6CZtVJ +VKQ== 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=NL2HNGU1az6iLtFEhqIIa7zT2JUmACjSrdOwCaRhJRQ=; b=Auwu48xk06oKGuBr1BiNmBQNo8WjeA7hrWkVk3a2wQY45NYaQMaSebhztL94OSAI8/ IdNb1cFDswqIU71zeJDT7Rvnia3mmplQKZRZDoZm2SIx8KXWmJuK+aGfpFQTGpsLOy3A a1XzI279cSxZtOBe58ISZ2GyYJ2U2H+rZzulIOHAzA89bFw1E8YypU0MWa6dUjEDuXAU 3LuWDNPZqR4PLWqQ7NvUTagUFOn/kEiU11vrIEHVyzLJEpaD1uiIhVr1Y2/dFKdaA76Y H88xdDnLBJ2Vrl/Euh6wNwIZwP/39V4DlwbCpFWAXxPSqj27UHJSA7a7/bxu9dzN0Ak4 iVlg== X-Gm-Message-State: AOAM530M+EKip0z5hGHwsvGEFWil4ArDLLeTSj+yV3tibgg8n7WQ9RK2 XTY/Q4dUakptISiroLYkBFdiJMBPa0vjLmpAALA= X-Google-Smtp-Source: ABdhPJydJUto1ZT2DSfUTjRq57Fa0WPB01DE7RnRpLDh74J6QByuS+7iGFhHw32qlDYIHf+Es7B7vQ== X-Received: by 2002:a17:906:ae85:: with SMTP id md5mr35042333ejb.93.1625051169282; Wed, 30 Jun 2021 04:06:09 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id g23sm2939629edp.74.2021.06.30.04.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 04:06:09 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: ray.kinsella@intel.com, Mohsin Kazmi , stable@dpdk.org, Olivier Matz , Tomasz Kulasek , Konstantin Ananyev , Thomas Monjalon Date: Wed, 30 Jun 2021 13:04:04 +0200 Message-Id: <20210630110404.21209-1-mohsin.kazmi14@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH v2] net: prepare the outer ipv4 hdr for checksum X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- v2: * Update the commit message with Fixes. --- 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