git: fb9a72c59a4a - stable/15 - bnxt: set hardware checksum only if required

From: Sumit Saxena <ssaxena_at_FreeBSD.org>
Date: Wed, 30 Sep 2026 10:41:23 UTC
The branch stable/15 has been updated by ssaxena:

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

commit fb9a72c59a4a21172ffac3bfbcc011ed45c08f77
Author:     acazuc <acazuc@acazuc.fr>
AuthorDate: 2025-11-27 10:29:34 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2026-09-30 10:39:29 +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
    
    (cherry picked from commit 2e94e1631ef517f5495e25d7fa22c95f7dca0dc6)
---
 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);
 	}