]> git.droids-corp.org - dpdk.git/commitdiff
app/testpmd: fix L4 checksum in multi-segments
authorKevin Liu <kevinx.liu@intel.com>
Wed, 29 Dec 2021 09:37:02 +0000 (09:37 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 14 Mar 2022 20:23:26 +0000 (21:23 +0100)
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 <kevinx.liu@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
app/test-pmd/csumonly.c

index 5274d498eea2bf7c4ef7f61aad0cda896e53a678..dbddd20a07dc2ee3ff66425d802155381b1d3d92 100644 (file)
@@ -511,7 +511,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
@@ -534,7 +534,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;
@@ -623,7 +623,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);
        }