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 0EF83A0C4A for ; Wed, 7 Jul 2021 11:42:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D513B406B4; Wed, 7 Jul 2021 11:42:23 +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 00EB4406B4; Wed, 7 Jul 2021 11:42:22 +0200 (CEST) Received: by mail-ej1-f46.google.com with SMTP id hc16so2234440ejc.12; Wed, 07 Jul 2021 02:42:22 -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:in-reply-to:references; bh=H+f0GVxUmKRGxFzAsPEIX10rfjYpqYQ4d++BrvdLXk4=; b=Y5tNqFBuEO98N8TSSEIdMeAqp0/njU8E2cV8xpE7mJu8fk2CxWNkdYsUSEg0cdCkWS xERaofXMipOhyvfypA5TPG99P7J2Ixtsn00F+u//tI3UR2xtGcZAInBlDq8niW9LrV2Q p3yrKUFOm2WAA89DLCE7T/f8Xgf/6nF4pdxOd/BsJj4/6B2XdMYj/76SrTcg636RqpRN JUAVuuKRx0xoaaeUKkRPXqRNwsQRBzj4aDddHjMw9Efr9HiTu08pt862buSZdNDDhlUk KgDlBcFXCGl2vox/BRETaKsQQS+6zM8PPkzakJPkB41l5dt37t7DMOqeAKlMEi7eoCqz t9wg== 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=H+f0GVxUmKRGxFzAsPEIX10rfjYpqYQ4d++BrvdLXk4=; b=ocAISzvxF3Y9p86TqwfazbrM+0pLuITul9KSyAfarBuZutHXdoO+lFzTg1Wwx0ZWeT EwIdc+E9H4R3sA1RKkdy0xVaSjfxRGujuet64EIUbyVyUenPw/ZGBjl5HpHjXwhwYkfE 6Mo7Bmk9eM/QHjncnWSLYF5LzuMpe2ydDumf0x7xzu7YUklijMVmK4sf3bGAOxJfzYrD Z83r0t/ogVpFmzHFHnIYGzxd40n048Z3A6dz49AVZ2CBR8jMqCql2f4QuTi191tHGP5I U7tIu+oT3ZAabFUNjLpP7I+bd0xGON3GM8wHlWSsHAXFlP4uceY1E4Xj6X9hsqOKFGQd ejCg== X-Gm-Message-State: AOAM531fSGQhOBwAe/PyAK+ZdkGmqxpqnCPoFfw94RpRy0PrOLYeCVxJ 5pCDNsSaqlv/Er+gdNS8GjvAXopcKH85Qxtz46s= X-Google-Smtp-Source: ABdhPJwnXXfQvD02ZmC+oDSyTnPSK7kO7apWClPMSQ8Woy5GV7HWs0hDzOLIaMaQwTBQVPRCbz4efw== X-Received: by 2002:a17:906:8149:: with SMTP id z9mr23050579ejw.547.1625650942556; Wed, 07 Jul 2021 02:42:22 -0700 (PDT) Received: from v6dc-3.cisco.com ([2001:420:44f1:10:225:b5ff:fe52:22]) by smtp.gmail.com with ESMTPSA id x13sm268255ejv.64.2021.07.07.02.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 02:42:22 -0700 (PDT) From: Mohsin Kazmi To: dev@dpdk.org Cc: Mohsin Kazmi , stable@dpdk.org Date: Wed, 7 Jul 2021 11:40:19 +0200 Message-Id: <20210707094019.40945-1-mohsin.kazmi14@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210630110404.21209-1-mohsin.kazmi14@gmail.com> References: <20210630110404.21209-1-mohsin.kazmi14@gmail.com> Subject: [dpdk-stable] [PATCH v3] 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 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 --- 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..3f4c8c58b9 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