I'm using an Ralink RT2870 based adapter (run(4) driver) in the hostap mode. and I've noticed that if_run doesn't support stations working in the power save mode (PSM). The reason is in lack of the TIM in beacons. The attached patch adds this functionality and completely fixes this issue. Despite the fact that patch is working, it seems that it needs an additional work. For example, now the result of ieee80211_beacon_update is ignored with a corresponding message, but may be necessary to process it...
Can somebody review it? -- Alexander Zagrebin
--- sys/dev/usb/wlan/if_run.c.orig 2011-01-21 08:28:14.000000000 +0300 +++ sys/dev/usb/wlan/if_run.c 2011-02-03 20:46:16.809999991 +0300 @@ -3903,6 +3903,7 @@ struct run_softc *sc = ic->ic_ifp->if_softc; uint32_t i; + setbit(RUN_VAP(vap)->bo.bo_flags, item); i = RUN_CMDQ_GET(&sc->cmdq_store); DPRINTF("cmdq_store=%d\n", i); sc->cmdq[i].func = run_update_beacon_cb; @@ -3921,13 +3922,25 @@ struct rt2860_txwi txwi; struct mbuf *m; uint8_t ridx; + uint8_t flags[4]; if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) return; + /* + * ieee80211_beacon_construct called from ieee80211_beacon_alloc + * will clear bo_flags, so we need store it for later use + */ + memcpy(&flags, &RUN_VAP(vap)->bo.bo_flags, sizeof(flags)); + if ((m = ieee80211_beacon_alloc(vap->iv_bss, &RUN_VAP(vap)->bo)) == NULL) return; + /* Now we may restore bo_flags and update the dynamic beacon contents */ + memcpy(&RUN_VAP(vap)->bo.bo_flags, &flags, sizeof(flags)); + if (ieee80211_beacon_update(vap->iv_bss, &RUN_VAP(vap)->bo, m, 1)) + device_printf(sc->sc_dev, "ieee80211_beacon_update failed\n"); + memset(&txwi, 0, sizeof txwi); txwi.wcid = 0xff; txwi.len = htole16(m->m_pkthdr.len);
_______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"