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 82811A0350; Mon, 28 Feb 2022 04:27:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2940741171; Mon, 28 Feb 2022 04:27:41 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 0BC3541159; Mon, 28 Feb 2022 04:27:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646018859; x=1677554859; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ffrD4P4FTIjf0hi0dSbCaT6Prmfc5FiJ+RenTHfQGbI=; b=Q9Wsogo071kgihi582L2tbP/7uKzOVhdx+VeBjd+zMjufsxcuFPreiH2 NZsnS8lh+bk/M1OjE6Wo8hJmY/AZZt4sWcLnty1H4QklCUwqyjngHkMku Utk6DUywQK5PjQdFJFCxBB1RmGHcSfR1sOqDU3HVOX3qU+7H0Wx0u8rBG GadlJLSusVWx2rWs6hJSfivps+ExIVNoGftf9NHpKmrQwd9STFtDy/reW 57c5bzw6+vR/6PHPFrt5SF33+LJObqa769IOWcWuqefMDXNfKB4uel0kd 7MKUxlBzLcW6S37QVT3u3qy7s6vS5wSXVBgjIr8qFpNRvv549Teb2Kx9q A==; X-IronPort-AV: E=McAfee;i="6200,9189,10271"; a="240203532" X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="240203532" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2022 19:27:38 -0800 X-IronPort-AV: E=Sophos;i="5.90,142,1643702400"; d="scan'208";a="550057551" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2022 19:27:36 -0800 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, ferruh.yigit@intel.com, Kevin Liu , stable@dpdk.org Subject: [PATCH v2 2/2] app/testpmd: fix SW L4 checksum in multi-segments Date: Wed, 29 Dec 2021 09:37:02 +0000 Message-Id: <20211229093702.1930214-3-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211229093702.1930214-1-kevinx.liu@intel.com> References: <20211224150925.3296471-1-kevinx.liu@intel.com> <20211229093702.1930214-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Testpmd forwards packets in checksum mode that it needs to calculate the checksum of each layer's protocol. In process_inner_cksums, when parsing tunnel packets, inner L4 offset should be outer_l2_len + outer_l3_len + l2_len + l3_len. In process_outer_cksums, when parsing tunnel packets, outer L4 offset should be outer_l2_len + outer_l3_len. Fixes: e6b9d6411e91 ("app/testpmd: add SW L4 checksum in multi-segments") Cc: stable@dpdk.org Signed-off-by: Kevin Liu --- app/test-pmd/csumonly.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 02bc3929c7..c235456e58 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -513,7 +513,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; } else { if (info->is_tunnel) - l4_off = info->l2_len + + l4_off = info->outer_l2_len + info->outer_l3_len + info->l2_len + info->l3_len; else @@ -536,7 +536,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; } else { if (info->is_tunnel) - l4_off = info->l2_len + info->outer_l3_len + + l4_off = info->outer_l2_len + info->outer_l3_len + info->l2_len + info->l3_len; else l4_off = info->l2_len + info->l3_len; @@ -625,7 +625,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; udp_hdr->dgram_cksum = get_udptcp_checksum(m, outer_l3_hdr, - info->l2_len + info->outer_l3_len, + info->outer_l2_len + info->outer_l3_len, info->outer_ethertype); } -- 2.33.1