From 34d6c773ee76548293958cf85f9c9915415a1b29 Mon Sep 17 00:00:00 2001 From: stsp Date: Mon, 22 Nov 2021 10:31:58 +0000 Subject: [PATCH] Fix iwx(4) Tx ring array size which was one entry too short. Fortunately, this bug was harmless. The last Tx agg queue is never used because ieee80211_classify() only returns TID values in the range 0 - 3. And iterations over the txq array use nitems() to find the upper bound. The possiblity of shrinking the txq array by 4 elements to get rid of unused Tx agg queues could be investigated later. For now, just fix the off-by-one error. ok kettenis@ --- sys/dev/pci/if_iwxreg.h | 3 ++- sys/dev/pci/if_iwxvar.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h index e29148ff81f..92913cf703a 100644 --- a/sys/dev/pci/if_iwxreg.h +++ b/sys/dev/pci/if_iwxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwxreg.h,v 1.31 2021/09/23 15:34:00 stsp Exp $ */ +/* $OpenBSD: if_iwxreg.h,v 1.32 2021/11/22 10:31:58 stsp Exp $ */ /*- * Based on BSD-licensed source modules in the Linux iwlwifi driver, @@ -1420,6 +1420,7 @@ struct iwx_gen3_bc_tbl { #define IWX_MAX_TID_COUNT 8 #define IWX_FIRST_AGG_TX_QUEUE (IWX_DQA_MGMT_QUEUE + 1) #define IWX_LAST_AGG_TX_QUEUE (IWX_FIRST_AGG_TX_QUEUE + IWX_MAX_TID_COUNT - 1) +#define IWX_NUM_TX_QUEUES (IWX_LAST_AGG_TX_QUEUE + 1) /** * Max Tx window size is the max number of contiguous TFDs that the scheduler diff --git a/sys/dev/pci/if_iwxvar.h b/sys/dev/pci/if_iwxvar.h index 009848fc254..69eebcb3b19 100644 --- a/sys/dev/pci/if_iwxvar.h +++ b/sys/dev/pci/if_iwxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwxvar.h,v 1.25 2021/10/15 13:38:10 stsp Exp $ */ +/* $OpenBSD: if_iwxvar.h,v 1.26 2021/11/22 10:31:58 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh @@ -497,7 +497,7 @@ struct iwx_softc { int sc_msix; /* TX/RX rings. */ - struct iwx_tx_ring txq[IWX_LAST_AGG_TX_QUEUE]; + struct iwx_tx_ring txq[IWX_NUM_TX_QUEUES]; struct iwx_rx_ring rxq; int qfullmsk; int qenablemsk; -- 2.20.1