From: jmatthew Date: Mon, 15 Jan 2024 08:56:45 +0000 (+0000) Subject: The maximum number of ring slots a tx packet can use is 32, which is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8490bd922a4d1301b10674d08d2ac19bc6ee4564;p=openbsd 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@ --- 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);