Stefan Sperling wrote: > I've run into an issue where iwn(4) fails to init the hardware. > > Running 'ifconfig iwn0 scan' resulted in: > > setting configuration > iwn0: fatal firmware error > firmware error log: > error type = "SYSASSERT" (0x00000005) > program counter = 0x00022088 > source line = 0x000000A4 > error data = 0x000000A400000000 > branch link = 0x0002225800022258 > interrupt link = 0x0000153200000000 > time = 27873 > driver status: > tx ring 0: qid=0 cur=0 queued=0 > tx ring 1: qid=1 cur=0 queued=0 > tx ring 2: qid=2 cur=0 queued=0 > tx ring 3: qid=3 cur=0 queued=0 > tx ring 4: qid=4 cur=6 queued=0 > tx ring 5: qid=5 cur=0 queued=0 > tx ring 6: qid=6 cur=0 queued=0 > tx ring 7: qid=7 cur=0 queued=0 > tx ring 8: qid=8 cur=0 queued=0 > tx ring 9: qid=9 cur=0 queued=0 > tx ring 10: qid=10 cur=0 queued=0 > tx ring 11: qid=11 cur=0 queued=0 > tx ring 12: qid=12 cur=0 queued=0 > tx ring 13: qid=13 cur=0 queued=0 > tx ring 14: qid=14 cur=0 queued=0 > tx ring 15: qid=15 cur=0 queued=0 > tx ring 16: qid=16 cur=0 queued=0 > tx ring 17: qid=17 cur=0 queued=0 > tx ring 18: qid=18 cur=0 queued=0 > tx ring 19: qid=19 cur=0 queued=0 > rx ring: cur=7 > 802.11 state 0 > iwn0: RXON command failed > iwn0: could not configure device > iwn0: could not load firmware .data section > iwn0: could not load firmware > iwn0: could not initialize hardware > > A debug printf revealed the rxon command channel was set to zero: > > iwn_config: rxon chan 0 flags 40008000 cck f ofdm ff > > Fix a misplaced curly brace while here...
Cannot comment on the code unfortunately. But with a current kernel I regularly get the above error on startup since today. Your diff fixes it. I'd be happy to see a fix for this to go in :-) > ok? > > Index: if_iwn.c > =================================================================== > RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v > retrieving revision 1.153 > diff -u -p -r1.153 if_iwn.c > --- if_iwn.c 7 Jan 2016 23:08:38 -0000 1.153 > +++ if_iwn.c 9 Jan 2016 21:12:23 -0000 > @@ -3429,7 +3429,7 @@ iwn_set_link_quality(struct iwn_softc *s > /* Next retry at immediate lower bit-rate. */ > if (txrate > 0) > txrate--; > - } > + } > } > > return iwn_cmd(sc, IWN_CMD_LINK_QUALITY, &linkq, sizeof linkq, 1); > @@ -4455,15 +4455,9 @@ iwn_config(struct iwn_softc *sc) > IEEE80211_ADDR_COPY(ic->ic_myaddr, LLADDR(ifp->if_sadl)); > IEEE80211_ADDR_COPY(sc->rxon.myaddr, ic->ic_myaddr); > IEEE80211_ADDR_COPY(sc->rxon.wlap, ic->ic_myaddr); > - sc->rxon.chan = ieee80211_chan2ieee(ic, ic->ic_ibss_chan); > + sc->rxon.chan = 1; > sc->rxon.flags = htole32(IWN_RXON_TSF | IWN_RXON_CTS_TO_SELF); > - if (IEEE80211_IS_CHAN_2GHZ(ic->ic_ibss_chan)) { > - sc->rxon.flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); > - if (ic->ic_flags & IEEE80211_F_USEPROT) > - sc->rxon.flags |= htole32(IWN_RXON_TGG_PROT); > - DPRINTF(("%s: 2ghz prot 0x%x\n", __func__, > - le32toh(sc->rxon.flags))); > - } > + sc->rxon.flags |= htole32(IWN_RXON_AUTO | IWN_RXON_24GHZ); > switch (ic->ic_opmode) { > case IEEE80211_M_STA: > sc->rxon.mode = IWN_MODE_STA; > @@ -4489,6 +4483,9 @@ iwn_config(struct iwn_softc *sc) > IWN_RXCHAIN_IDLE_COUNT(2); > sc->rxon.rxchain = htole16(rxchain); > DPRINTF(("setting configuration\n")); > + DPRINTF(("%s: rxon chan %d flags %x cck %x ofdm %x\n", __func__, > + sc->rxon.chan, le32toh(sc->rxon.flags), sc->rxon.cck_mask, > + sc->rxon.ofdm_mask)); > error = iwn_cmd(sc, IWN_CMD_RXON, &sc->rxon, sc->rxonsz, 0); > if (error != 0) { > printf("%s: RXON command failed\n", sc->sc_dev.dv_xname); >