iwx: fix binding command

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

iwx: fix binding command

Stefan Sperling-5
The iwx(4) binding command can fail with 5 Ghz channels.
Some firmware versions don't expect LMAC_5G_INDEX in the binding command.
I have no idea what "CDB" stands for, but this check matches what the
Linux driver does and makes the command work on -48 firmware.

The Linux driver actually checks two capabilities, CAPA_BINDING_CDB_SUPPORT
and CAPA_CDB_SUPPORT. Because BINDING_CDB_SUPPORT is set for all firmware
versions used by iwx(4) we don't need to check it explicitly. Linux has to
check both flags because their code runs with iwm(4) and iwx(4) devices.

ok?
 
diff cad9585f8bd2c9a5a5bcdc5cd1fa273652ba3309 17409ae76a1a51c4975a1efea612708ad984b8df
blob - b65fa80f56f6dd878b1ac48bbed7ae2d191ffc76
blob + dd72733d9028d10a3e8dfdce7f1211c72475843f
--- sys/dev/pci/if_iwx.c
+++ sys/dev/pci/if_iwx.c
@@ -3765,7 +3765,8 @@ iwx_binding_cmd(struct iwx_softc *sc, struct iwx_node
  for (i = 1; i < IWX_MAX_MACS_IN_BINDING; i++)
  cmd.macs[i] = htole32(IWX_FW_CTXT_INVALID);
 
- if (IEEE80211_IS_CHAN_2GHZ(phyctxt->channel))
+ if (IEEE80211_IS_CHAN_2GHZ(phyctxt->channel) ||
+    !isset(sc->sc_enabled_capa, IWX_UCODE_TLV_CAPA_CDB_SUPPORT))
  cmd.lmac_id = htole32(IWX_LMAC_24G_INDEX);
  else
  cmd.lmac_id = htole32(IWX_LMAC_5G_INDEX);