From: stsp Date: Mon, 6 Nov 2023 08:34:41 +0000 (+0000) Subject: avoid using MCS9 in iwm(4) Tx rate selection if 40 MHz is disabled X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=93e9809bc90f62da83dce23eb9c99d2d0e7cfd00;p=openbsd avoid using MCS9 in iwm(4) Tx rate selection if 40 MHz is disabled MCS9 is not valid on 20HMz so we must not use it in 20MHz-only mode. Fixes firmware panic 0x00002078, which indicates the driver sets a rate with a bad number of antennas, bad number of Tx streams, or bad bandwidth. Observed by dlg@ with the miktrotik AP for which iwm(4) firmware requires our 20MHz-only workaround to interoperate in 11ac mode. ok dlg@ --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 2c107ba4b55..fbab94fecb8 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.411 2023/10/21 06:41:26 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.412 2023/11/06 08:34:41 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -9294,8 +9294,17 @@ iwm_set_rate_table_vht(struct iwm_node *in, struct iwm_lq_cmd *lqcmd) if (i < 2 && in->in_phyctxt->vht_chan_width >= IEEE80211_VHTOP0_CHAN_WIDTH_80) tab |= IWM_RATE_MCS_CHAN_WIDTH_80; - else + else if (in->in_phyctxt->sco == + IEEE80211_HTOP0_SCO_SCA || + in->in_phyctxt->sco == + IEEE80211_HTOP0_SCO_SCB) tab |= IWM_RATE_MCS_CHAN_WIDTH_40; + else { + /* no 40 MHz, fall back on MCS 8 */ + tab &= ~IWM_RATE_VHT_MCS_RATE_CODE_MSK; + tab |= 8; + } + tab |= IWM_RATE_MCS_RTS_REQUIRED_MSK; if (i < 4) { if (ieee80211_ra_vht_use_sgi(ni))