From 7615283dfcfbad2fbbef983746b36864c81d490c Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Wed, 8 May 2024 14:03:55 +0000 Subject: fix iwx(4) monitor mode Monitor mode was broken by a recent firmware update. Two tweaks make it work again: 1) The firmware does not like us sending the power-mode command while in monitor mode and will panic, so simply don't do that. 2) We no longer add two queues while in monitor mode, just one queue for frame injection. This queue's index will be 1, not 2. Make the driver expect the correct index to prevent an error when monitor mode is entered. tested by jmc@ and myself on iwx ax200 --- sys/dev/pci/if_iwx.c | 8 ++++---- sys/dev/pci/if_iwxreg.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 3a4810b4859..15eea66717c 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.183 2024/04/13 23:44:11 jsg Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.184 2024/05/08 14:03:54 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -8323,6 +8323,9 @@ iwx_run(struct iwx_softc *sc) return err; } #endif + if (ic->ic_opmode == IEEE80211_M_MONITOR) + return 0; + err = iwx_power_mac_update_mode(sc, in); if (err) { printf("%s: could not update MAC power (error %d)\n", @@ -8330,9 +8333,6 @@ iwx_run(struct iwx_softc *sc) return err; } - if (ic->ic_opmode == IEEE80211_M_MONITOR) - return 0; - /* Start at lowest available bit-rate. Firmware will raise. */ in->in_ni.ni_txrate = 0; in->in_ni.ni_txmcs = 0; diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h index 8713b11a6ea..e184c0a0652 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.52 2023/10/06 15:15:41 stsp Exp $ */ +/* $OpenBSD: if_iwxreg.h,v 1.53 2024/05/08 14:03:54 stsp Exp $ */ /*- * Based on BSD-licensed source modules in the Linux iwlwifi driver, @@ -1760,7 +1760,7 @@ struct iwx_gen3_bc_tbl_entry { #define IWX_DQA_CMD_QUEUE 0 #define IWX_DQA_AUX_QUEUE 1 -#define IWX_DQA_INJECT_MONITOR_QUEUE 2 /* used in monitor mode only */ +#define IWX_DQA_INJECT_MONITOR_QUEUE 1 /* used in monitor mode only */ #define IWX_DQA_MGMT_QUEUE 1 /* default queue other modes */ /* Reserve 8 DQA Tx queues for QoS data frames. */ -- cgit v1.2.3