Adrian Chadd noted that Linux iwlwifi adds a mac context to the
firmware when the driver initialises the interface, and changes it
(rather than adding it) whenever the interface is brought up.
This does the same for iwm(4).
ok?
Index: if_iwm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v
retrieving revision 1.46
diff -u -p -r1.46 if_iwm.c
--- if_iwm.c 19 Jul 2015 21:40:00 -0000 1.46
+++ if_iwm.c 22 Sep 2015 17:20:17 -0000
@@ -4628,7 +4628,8 @@ iwm_mvm_ack_rates(struct iwm_softc *sc,
uint8_t ofdm = 0;
int i;
- if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) {
+ if (ni->ni_chan == IEEE80211_CHAN_ANYC ||
+ IEEE80211_IS_CHAN_2GHZ(ni->ni_chan)) {
for (i = 0; i <= IWM_LAST_CCK_RATE; i++) {
cck |= (1 << i);
if (lowest_present_cck > i)
@@ -4992,11 +4993,6 @@ iwm_auth(struct iwm_softc *sc)
if (error)
return error;
- if ((error = iwm_mvm_mac_ctxt_add(sc, in)) != 0) {
- DPRINTF(("%s: failed to add MAC\n", DEVNAME(sc)));
- return error;
- }
-
if ((error = iwm_mvm_phy_ctxt_changed(sc, &sc->sc_phyctxt[0],
in->in_ni.ni_chan, 1, 1)) != 0) {
DPRINTF(("%s: failed add phy ctxt\n", DEVNAME(sc)));
@@ -5445,6 +5441,7 @@ 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 error, i, qid;
if ((error = iwm_preinit(sc)) != 0)
@@ -5507,6 +5504,12 @@ iwm_init_hw(struct iwm_softc *sc)
for (qid = 0; qid < 4; qid++) {
iwm_enable_txq(sc, qid, qid);
}
+
+ /* Add the MAC context. */
+ if ((error = iwm_mvm_mac_ctxt_add(sc, in)) != 0) {
+ printf("%s: failed to add MAC\n", DEVNAME(sc));
+ goto error;
+ }
return 0;