aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoracazuc <acazuc@acazuc.fr>2025-11-27 10:29:34 +0000
committerEd Maste <emaste@FreeBSD.org>2026-02-05 14:07:49 +0000
commit2e94e1631ef517f5495e25d7fa22c95f7dca0dc6 (patch)
treea2b43124ef0ccea0daa7bd6794702ebbe9a01872
parentc12d6cc326b70326d776324067bdf07e4fa328aa (diff)
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
-rw-r--r--sys/dev/bnxt/bnxt_en/bnxt_txrx.c22
1 files 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);
}