From f72ac518f7cb91d348666a8164b80b77618b1441 Mon Sep 17 00:00:00 2001 From: stsp Date: Mon, 26 Jul 2021 14:15:40 +0000 Subject: [PATCH] Fix accounting of the number of frames queued on an iwx(4) Tx ring. Stop decrementing ring->queued inside the if-statement which guards maintenance of the OACTIVE flag. This is wrong and resulted in a negative counter value (visible in firmware error traces). The counter is already decremented in the loop above where frames are taken off the ring. --- sys/dev/pci/if_iwx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index f5f4485201c..5ec96aa5f19 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.70 2021/07/20 14:44:09 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.71 2021/07/26 14:15:40 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -4325,7 +4325,7 @@ iwx_rx_tx_cmd(struct iwx_softc *sc, struct iwx_rx_packet *pkt, ring->tail = (ring->tail + 1) % IWX_TX_RING_COUNT; } - if (--ring->queued < IWX_TX_RING_LOMARK) { + if (ring->queued < IWX_TX_RING_LOMARK) { sc->qfullmsk &= ~(1 << ring->qid); if (sc->qfullmsk == 0 && ifq_is_oactive(&ifp->if_snd)) { ifq_clr_oactive(&ifp->if_snd); -- 2.20.1