Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2025 16:03:19 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: efe9a3996ee3 - main - mlx5: recalculate tcp checksum for ipv6 hw lro coalesced packet
Message-ID:  <202503131603.52DG3JSI048692@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=efe9a3996ee319358c51681a6d9da8b4bf608b03

commit efe9a3996ee319358c51681a6d9da8b4bf608b03
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-14 11:17:20 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-03-13 16:00:27 +0000

    mlx5: recalculate tcp checksum for ipv6 hw lro coalesced packet
    
    Reviewed by:    Ariel Ehrenberg <aehrenberg@nvidia.com>, Slava Shwartsman <slavash@nvidia.com>
    Sponsored by:   NVidia networking
    MFC after:      1 week
---
 sys/dev/mlx5/mlx5_en/mlx5_en_rx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
index f30cdeae199f..77e6a6b77c58 100644
--- a/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
+++ b/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
@@ -250,6 +250,15 @@ mlx5e_lro_update_hdr(struct mbuf *mb, struct mlx5_cqe64 *cqe)
 		ip6->ip6_hlim = cqe->lro_min_ttl;
 		ip6->ip6_plen = cpu_to_be16(tot_len -
 		    sizeof(struct ip6_hdr));
+
+		/* TCP checksum */
+		th->th_sum = 0;
+		tcp_csum = ~in6_cksum_partial_l2(mb, IPPROTO_TCP,
+		    sizeof(struct ether_header),
+		    sizeof(struct ether_header) + sizeof(struct ip6_hdr),
+		    tot_len - sizeof(struct ip6_hdr), th->th_off * 4) & 0xffff;
+		tcp_csum = csum_reduce(tcp_csum + cqe->check_sum);
+		th->th_sum = ~tcp_csum & 0xffff;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202503131603.52DG3JSI048692>