git: 6f5803e375fe - main - iwx: update if_iwx.c to OpenBSD v1.184 and if_iwxreg.h to OpenBSD v1.53

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Thu, 08 Oct 2026 04:31:59 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=6f5803e375fe2214f1fb8f1e1378ab006b196adc

commit 6f5803e375fe2214f1fb8f1e1378ab006b196adc
Author:     Idwer Vollering <vidwer+fbsdbugs@gmail.com>
AuthorDate: 2026-10-08 04:13:29 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-10-08 04:16:44 +0000

    iwx: update if_iwx.c to OpenBSD v1.184 and if_iwxreg.h to OpenBSD v1.53
    
    This updates iwx to the given OpenBSD versions upstream.
    
    This is a squashed commit of the given differential revisions
    and openbsd upstream commits.
    
    Reviewed by:    adrian
    Differential Revision:  https://reviews.freebsd.org/D59757
    Differential Revision:  https://reviews.freebsd.org/D59758
    Differential Revision:  https://reviews.freebsd.org/D59759
    Differential Revision:  https://reviews.freebsd.org/D59760
    Differential Revision:  https://reviews.freebsd.org/D59761
    Differential Revision:  https://reviews.freebsd.org/D59762
    Differential Revision:  https://reviews.freebsd.org/D59763
    Differential Revision:  https://reviews.freebsd.org/D59764
    Differential Revision:  https://reviews.freebsd.org/D59765
    Differential Revision:  https://reviews.freebsd.org/D59766
    
    Obtained from: OpenBSD, dd37084bb9bbc1cb63137a98072e149306cc2e2a
    Obtained from: OpenBSD, 521eb4f37a87f4d1ba6b3aa685721d015525efb4
    Obtained from: OpenBSD, 177f96ae5464c4393971d72a9703f84ba84ad60c
    Obtained from: OpenBSD, be47d0a5f00c62ce8dd784cf7f90f635203434ae
    Obtained from: OpenBSD, 1fe292d1a480241213e618a905fef43d03ac65ca
    Obtained from: OpenBSD, 41713280ddbe6fa1b12833163070617fa75d6e43
    Obtained from: OpenBSD, 844e213d50c754e415ff22924cb86e86d4d63002
    Obtained from: OpenBSD, 9fb1f10bfcbfc611a885a088a1658b52427addcb
    Obtained from: OpenBSD, 3b9d585e0ce86bc6eed0b4493f3c73d741778f91
    Obtained from: OpenBSD, 22f856c70e6211679c512ca0726f3c6f6a152dde
---
 sys/dev/iwx/if_iwx.c    | 49 +++++++++++++++++++++++++------------------------
 sys/dev/iwx/if_iwxreg.h |  5 +++--
 2 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/sys/dev/iwx/if_iwx.c b/sys/dev/iwx/if_iwx.c
index ee12e330de92..48413c8448ad 100644
--- a/sys/dev/iwx/if_iwx.c
+++ b/sys/dev/iwx/if_iwx.c
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) AND ISC
  */
 
-/*	$OpenBSD: if_iwx.c,v 1.175 2023/07/05 15:07:28 stsp Exp $	*/
+/*	$OpenBSD: if_iwx.c,v 1.184 2024/05/08 14:03:54 stsp Exp $	*/
 
 /*
  *
@@ -911,7 +911,7 @@ iwx_alloc_fw_monitor(struct iwx_softc *sc, uint8_t max_power)
 	}
 
 	if (max_power > 26) {
-		 IWX_DPRINTF(sc, IWX_DEBUG_FIRMWARE_TLV,
+		IWX_DPRINTF(sc, IWX_DEBUG_FIRMWARE_TLV,
 		     "%s: External buffer size for monitor is too big %d, "
 		     "check the FW TLV\n", DEVNAME(sc), max_power);
 		return 0;
@@ -5633,17 +5633,15 @@ iwx_tx_fill_cmd(struct iwx_softc *sc, struct iwx_node *in,
 	} else if (sc->sc_rate_n_flags_version >= 2)
 		rate_flags |= IWX_RATE_MCS_LEGACY_OFDM_MSK;
 
-	rval = (rs->rs_rates[ieee80211_node_get_txrate_dot11rate(ni)]
-	    & IEEE80211_RATE_VAL);
-	IWX_DPRINTF(sc, IWX_DEBUG_TXRATE, "%s:%d: rval=%i dot11 %d\n", __func__, __LINE__,
-	    rval, rs->rs_rates[ieee80211_node_get_txrate_dot11rate(ni)]);
+	IWX_DPRINTF(sc, IWX_DEBUG_TXRATE, "%s:%d: rinfo->rate=%i dot11 %d\n", __func__, __LINE__,
+	    rinfo->rate, rs->rs_rates[ieee80211_node_get_txrate_dot11rate(ni)]);
 
 	if (sc->sc_rate_n_flags_version >= 2) {
 		if (rate_flags & IWX_RATE_MCS_LEGACY_OFDM_MSK) {
-			rate_flags |= (iwx_fw_rateidx_ofdm(rval) &
+			rate_flags |= (iwx_fw_rateidx_ofdm(rinfo->rate) &
 			    IWX_RATE_LEGACY_RATE_MSK);
 		} else {
-			rate_flags |= (iwx_fw_rateidx_cck(rval) &
+			rate_flags |= (iwx_fw_rateidx_cck(rinfo->rate) &
 			    IWX_RATE_LEGACY_RATE_MSK);
 		}
 	} else
@@ -5955,9 +5953,7 @@ iwx_flush_sta_tids(struct iwx_softc *sc, int sta_id, uint16_t tids)
 
 	resp_len = iwx_rx_packet_payload_len(pkt);
 	/* Some firmware versions don't provide a response. */
-	if (resp_len == 0)
-		goto out;
-	else if (resp_len != sizeof(*resp)) {
+	if (resp_len != sizeof(*resp)) {
 		err = EIO;
 		goto out;
 	}
@@ -6055,11 +6051,6 @@ iwx_flush_sta(struct iwx_softc *sc, struct iwx_node *in)
 		goto done;
 	}
 
-	/*
-	 * XXX-THJ: iwx_wait_tx_queues_empty was here, but it was a nope in the
-	 * fc drive rand has has been replaced in OpenBSD.
-	 */
-
 	err = iwx_drain_sta(sc, in, 0);
 done:
 	sc->sc_flags &= ~IWX_FLAG_TXFLUSH;
@@ -6799,7 +6790,7 @@ iwx_rval2ridx(int rval)
 			break;
 	}
 
-       return ridx;
+	return ridx;
 }
 
 static void
@@ -7840,6 +7831,9 @@ iwx_run(struct ieee80211vap *vap, 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",
@@ -7847,9 +7841,6 @@ iwx_run(struct ieee80211vap *vap, struct iwx_softc *sc)
 		return err;
 	}
 
-	if (ic->ic_opmode == IEEE80211_M_MONITOR)
-		return 0;
-
 	err = iwx_rs_init(sc, in);
 	if (err) {
 		printf("%s: could not init rate scaling (error %d)\n",
@@ -9127,7 +9118,7 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf *ml)
 			 * For v5 and above, we can check the version, for older
 			 * versions we need to check the size.
 			 */
-			 if (iwx_lookup_notif_ver(sc, IWX_LEGACY_GROUP,
+			if (iwx_lookup_notif_ver(sc, IWX_LEGACY_GROUP,
 			    IWX_ALIVE) == 6) {
 				SYNC_RESP_STRUCT(resp6, pkt);
 				if (iwx_rx_packet_payload_len(pkt) !=
@@ -9405,6 +9396,16 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf *ml)
 		case IWX_WIDE_ID(IWX_DATA_PATH_GROUP, IWX_RLC_CONFIG_CMD):
 			break;
 
+		/*
+		 * Ignore for now. The Linux driver only acts on this request
+		 * with 160Mhz channels in 11ax mode.
+		 */
+		case IWX_WIDE_ID(IWX_DATA_PATH_GROUP,
+		    IWX_THERMAL_DUAL_CHAIN_REQUEST):
+			DPRINTF(("%s: thermal dual-chain request received\n",
+			    DEVNAME(sc)));
+			break;
+
 		/* undocumented notification from iwx-ty-a0-gf-a0-77 image */
 		case IWX_WIDE_ID(IWX_DATA_PATH_GROUP, 0xf8):
 			break;
@@ -9972,7 +9973,7 @@ static const struct iwx_dev_info iwx_dev_info_table[] = {
 	_IWX_DEV_INFO(IWX_CFG_ANY, IWX_CFG_ANY,
 		      IWX_CFG_MAC_TYPE_SO, IWX_CFG_ANY,
 		      IWX_CFG_RF_TYPE_HR1, IWX_CFG_ANY,
-		      IWX_CFG_160, IWX_CFG_ANY, IWX_CFG_NO_CDB, IWX_CFG_ANY,
+		      IWX_CFG_NO_160, IWX_CFG_ANY, IWX_CFG_NO_CDB, IWX_CFG_ANY,
 		      iwx_cfg_so_a0_hr_b0), /* ax101 */
 	_IWX_DEV_INFO(IWX_CFG_ANY, IWX_CFG_ANY,
 		      IWX_CFG_MAC_TYPE_SO, IWX_CFG_ANY,
@@ -9989,7 +9990,7 @@ static const struct iwx_dev_info iwx_dev_info_table[] = {
 	_IWX_DEV_INFO(IWX_CFG_ANY, IWX_CFG_ANY,
 		      IWX_CFG_MAC_TYPE_SOF, IWX_CFG_ANY,
 		      IWX_CFG_RF_TYPE_HR1, IWX_CFG_ANY,
-		      IWX_CFG_160, IWX_CFG_ANY, IWX_CFG_NO_CDB, IWX_CFG_ANY,
+		      IWX_CFG_NO_160, IWX_CFG_ANY, IWX_CFG_NO_CDB, IWX_CFG_ANY,
 		      iwx_cfg_so_a0_hr_b0), /* AX101 */
 	_IWX_DEV_INFO(IWX_CFG_ANY, IWX_CFG_ANY,
 		      IWX_CFG_MAC_TYPE_SOF, IWX_CFG_ANY,
@@ -10175,7 +10176,7 @@ iwx_find_device_cfg(struct iwx_softc *sc)
 	cores = IWX_SUBDEVICE_CORES(sdev_id);
 
 	for (i = nitems(iwx_dev_info_table) - 1; i >= 0; i--) {
-		 const struct iwx_dev_info *dev_info = &iwx_dev_info_table[i];
+		const struct iwx_dev_info *dev_info = &iwx_dev_info_table[i];
 
 		if (dev_info->device != (uint16_t)IWX_CFG_ANY &&
 		    dev_info->device != sc->sc_pid)
diff --git a/sys/dev/iwx/if_iwxreg.h b/sys/dev/iwx/if_iwxreg.h
index 3f161b627a5f..43781a1421b8 100644
--- a/sys/dev/iwx/if_iwxreg.h
+++ b/sys/dev/iwx/if_iwxreg.h
@@ -2,7 +2,7 @@
  * SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
  */
 
-/*	$OpenBSD: if_iwxreg.h,v 1.51 2023/03/06 11:18:37 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,
@@ -1764,7 +1764,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. */
@@ -2014,6 +2014,7 @@ struct iwx_tx_queue_cfg_rsp {
 #define IWX_RX_BAID_ALLOCATION_CONFIG_CMD	0x16
 #define IWX_SCD_QUEUE_CONFIG_CMD	0x17
 #define IWX_RX_NO_DATA_NOTIF	0xf5
+#define IWX_THERMAL_DUAL_CHAIN_REQUEST 0xf6
 #define IWX_TLC_MNG_UPDATE_NOTIF 0xf7
 
 /* REGULATORY_AND_NVM group subcommand IDs */