It looks like iwm firmware does not like a MAC context which does not
specify the AP's BSSID.
The driver currently adds such a context when initializing the hardware
for the first time after boot (with the BSSID set to all zeros, I also tried
a broadcast address and that doesn't work either).
This then triggers the well-known performance bug for some reason which
only Intel engineers with magic spell books can figure out.
I noticed performance is fixed after running 'ifconfig iwm0 scan' once.
This brings the interface down and runs the same hardware init sequence,
but this time it copies the now cached BSSID from ic->ic_bss into the mac
context command and things start working.
This diff makes sure we don't add a MAC context before we know the BSSID.
Now things start working correctly right after boot.
I've tested this on 8260 hardware only so far, AFAIK all HW is affected
by this problem. Additional testing appreciated.
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.141
diff -u -p -r1.141 if_iwm.c
--- if_iwm.c 22 Sep 2016 08:28:38 -0000 1.141
+++ if_iwm.c 27 Sep 2016 15:26:08 -0000
@@ -5171,6 +5171,13 @@ iwm_auth(struct iwm_softc *sc)
return err;
in->in_phyctxt = &sc->sc_phyctxt[0];
+ err = iwm_mac_ctxt_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD, 0);
+ if (err) {
+ printf("%s: could not add MAC context (error %d)\n",
+ DEVNAME(sc), err);
+ return err;
+ }
+
err = iwm_binding_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD);
if (err)
return err;
@@ -5743,7 +5750,6 @@ int
iwm_init_hw(struct iwm_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
- struct iwm_node *in = (struct iwm_node *)ic->ic_bss;
int err, i, ac;
err = iwm_preinit(sc);
@@ -5865,13 +5871,6 @@ iwm_init_hw(struct iwm_softc *sc)
goto err;
}
}
-
- err = iwm_mac_ctxt_cmd(sc, in, IWM_FW_CTXT_ACTION_ADD, 0);
- if (err) {
- printf("%s: could not add MAC context (error %d)\n",
- DEVNAME(sc), err);
- goto err;
- }
err = iwm_disable_beacon_filter(sc);
if (err) {