summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2024-01-15 08:56:46 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2024-01-15 08:56:46 +0000
commitb59c26f781778c82036ad1364f0ebac396df399b (patch)
tree12a9f7b005eded3382dffc83024ba4ae1171815d /sys
parent41e22ba41a25e25f7201d6a462d74fac7b9f7d57 (diff)
The maximum number of ring slots a tx packet can use is 32, which is
indicated by writing 0 to the 5 bit 'BD count' field in the first slot. Accordingly, mask the value we're writing there. Each packet uses one slot for offload information and then one per DMA segment, which means the maximum number of DMA segments must be 31 rather than 32. Trying to send a packet using 33 slots makes the nic firmware very upset. ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bnxt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/pci/if_bnxt.c b/sys/dev/pci/if_bnxt.c
index fc1de6ddcca..7ffc1d40232 100644
--- a/sys/dev/pci/if_bnxt.c
+++ b/sys/dev/pci/if_bnxt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bnxt.c,v 1.43 2024/01/10 05:06:00 jmatthew Exp $ */
+/* $OpenBSD: if_bnxt.c,v 1.44 2024/01/15 08:56:45 jmatthew Exp $ */
/*-
* Broadcom NetXtreme-C/E network driver.
*
@@ -92,7 +92,7 @@
#define BNXT_CP_PAGES 4
-#define BNXT_MAX_TX_SEGS 32 /* a bit much? */
+#define BNXT_MAX_TX_SEGS 31
#define BNXT_TX_SLOTS(bs) (bs->bs_map->dm_nsegs + 1)
#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)
@@ -1395,8 +1395,9 @@ bnxt_start(struct ifqueue *ifq)
else
txflags = TX_BD_LONG_FLAGS_LHINT_GTE2K;
txflags |= TX_BD_LONG_TYPE_TX_BD_LONG |
- TX_BD_LONG_FLAGS_NO_CMPL |
- (BNXT_TX_SLOTS(bs) << TX_BD_LONG_FLAGS_BD_CNT_SFT);
+ TX_BD_LONG_FLAGS_NO_CMPL;
+ txflags |= (BNXT_TX_SLOTS(bs) << TX_BD_LONG_FLAGS_BD_CNT_SFT) &
+ TX_BD_LONG_FLAGS_BD_CNT_MASK;
if (map->dm_nsegs == 1)
txflags |= TX_BD_SHORT_FLAGS_PACKET_END;
txring[idx].flags_type = htole16(txflags);