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 C7969A0C46 for ; Tue, 7 Sep 2021 12:51:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B95964116D; Tue, 7 Sep 2021 12:51:56 +0200 (CEST) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by mails.dpdk.org (Postfix) with ESMTP id E8F10410EC; Tue, 7 Sep 2021 12:51:53 +0200 (CEST) Received: by mail-ed1-f52.google.com with SMTP id r7so13279241edd.6; Tue, 07 Sep 2021 03:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3Q2cb42bdzTTfMKiL9pOHVcgIak07Theg52j5drecAI=; b=oFvCFhE2ZnIdbse66L3iPfypVM72aS4uvgjgYvuAnFl3EOwqaWxgl8C1tdmLFFEreU Md96sICoudq2NbrkFozBN7fJvTJZEM1WBijWB+jA0dFyOuyRW7cJERl5yc6ntgCOir2c n2EPcjZIg9M0GVjGh0HG086q1ELqmGkuWbGB8hPIDl1jMe0pjJJNySvG+5zmQoefAbtl cH/zFYW+rDvCGjo7xjSxTBlEDYWpNsz2GtL3tvE/NYG4kmwAZDqbNtuLeXli+ce2VxxP zMFuabacdu9l3mUBTt1JN5S3OwnWEu+n88/n4IJR3C6dJj0TgOtNpSvwTpjcrKh4DUnc aGcA== 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:in-reply-to :references; bh=3Q2cb42bdzTTfMKiL9pOHVcgIak07Theg52j5drecAI=; b=XmOXUIhF+JqHymas4ZSPiG2fTs0+UQfavqFLTSjIT5LlooKw/A0/5pID7BvxgXvt8+ px2NKU+xgvsNlY0i7I/KszL2YWKkssUEUe5WDfBAGmoRmajKKerUVwmJaPXe4xhdQn1K 0ZWyGuHM8WvgWH2Ngbb4IZ+Lq+pQbhtaDCvO4EJ5BI7cU4NlHOzHMRdwbDw//IUW0JS9 bPiKZcxN1VJdCqp5pW/fZsKGxoOoqMTRqDCHYBnI2IX5laxBfqKXRzVmbLcR+wajdCLG aee8fUws2NUPa5dqoQaJ+CAPDFHqOHQJnWP21R/xrIPwt1CWAwz1+KtgrtYmqmrvY0Ty 3bOQ== X-Gm-Message-State: AOAM532Dao/z/r09JINNMYwZlLg3YYq2lHfm34kk45Etqu59w1/udWV6 tSXfvMcFRIPyteYiNxmL2FMZ9lf4qSQ= X-Google-Smtp-Source: ABdhPJw5RSQ9hMKnnFC9lrEiqiqKAMsH7OK3mZwsVorV3Vr/EU6bO7EWWeY7A5PGnah6dlDS8R0xJw== X-Received: by 2002:aa7:d3d6:: with SMTP id o22mr17514662edr.155.1631011913392; Tue, 07 Sep 2021 03:51:53 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id r6sm5250318ejb.119.2021.09.07.03.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 03:51:53 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: Mohsin Kazmi , stable@dpdk.org Date: Tue, 7 Sep 2021 12:49:16 +0200 Message-Id: <20210907104916.27560-1-mohsin.kazmi14@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210707094019.40945-1-mohsin.kazmi14@gmail.com> References: <20210707094019.40945-1-mohsin.kazmi14@gmail.com> Subject: [dpdk-stable] [PATCH v4] net: fix Intel-specific 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 of 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 Acked-by: Olivier Matz --- v4: * Update the commit message v3: * Update the conditional test with PKT_TX_OUTER_IP_CKSUM. * Update the commit title with "Intel-specific". v2: * Update the commit message with Fixes. lib/net/rte_net.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h index 434435ffa2..42639bc154 100644 --- a/lib/net/rte_net.h +++ b/lib/net/rte_net.h @@ -125,11 +125,22 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) * Mainly it is required to avoid fragmented headers check if * no offloads are requested. */ - if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG))) + if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG | + PKT_TX_OUTER_IP_CKSUM))) 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