Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Feb 2026 14:14:39 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Cc:        acazuc <acazuc@acazuc.fr>
Subject:   git: 2e94e1631ef5 - main - bnxt: set hardware checksum only if required
Message-ID:  <6984a5cf.371e3.fcac435@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by emaste:

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

commit 2e94e1631ef517f5495e25d7fa22c95f7dca0dc6
Author:     acazuc <acazuc@acazuc.fr>
AuthorDate: 2025-11-27 10:29:34 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-02-05 14:07:49 +0000

    bnxt: set hardware checksum only if required
    
    The test condition in the bnxt driver for TCP/UDP transmit hardware checksum
    offload is invalid: only the TCP / UDP csum bits should be tested
    
    Only the relevant ipi_csum_flags bits are now tested
    
    Reviewed by: tuexen
    Sponsored by: Stormshield
    Differential Revision: https://reviews.freebsd.org/D53941
---
 sys/dev/bnxt/bnxt_en/bnxt_txrx.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/sys/dev/bnxt/bnxt_en/bnxt_txrx.c b/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
index 2e10de6f0174..3e867454de8a 100644
--- a/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_txrx.c
@@ -154,12 +154,22 @@ bnxt_isc_txd_encap(void *sc, if_pkt_info_t pi)
 			lflags |= TX_BD_LONG_LFLAGS_LSO |
 			    TX_BD_LONG_LFLAGS_T_IPID;
 		}
-		else if(pi->ipi_csum_flags & CSUM_OFFLOAD) {
-			lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM |
-			    TX_BD_LONG_LFLAGS_IP_CHKSUM;
-		}
-		else if(pi->ipi_csum_flags & CSUM_IP) {
-			lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
+		else {
+			if (pi->ipi_csum_flags & CSUM_IP) {
+				lflags |= TX_BD_LONG_LFLAGS_IP_CHKSUM;
+			}
+			switch (pi->ipi_ipproto) {
+				case IPPROTO_TCP:
+					if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) {
+						lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+					}
+					break;
+				case IPPROTO_UDP:
+					if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) {
+						lflags |= TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM;
+					}
+					break;
+			}
 		}
 		tbdh->lflags = htole16(lflags);
 	}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6984a5cf.371e3.fcac435>