Lines 396-401
Link Here
|
396 |
} |
396 |
} |
397 |
|
397 |
|
398 |
WPI_LOCK_INIT(sc); |
398 |
WPI_LOCK_INIT(sc); |
|
|
399 |
WPI_RXON_LOCK_INIT(sc); |
399 |
WPI_NT_LOCK_INIT(sc); |
400 |
WPI_NT_LOCK_INIT(sc); |
400 |
WPI_TXQ_LOCK_INIT(sc); |
401 |
WPI_TXQ_LOCK_INIT(sc); |
401 |
|
402 |
|
Lines 520-527
Link Here
|
520 |
|
521 |
|
521 |
wpi_radiotap_attach(sc); |
522 |
wpi_radiotap_attach(sc); |
522 |
|
523 |
|
523 |
callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); |
524 |
callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0); |
524 |
callout_init_mtx(&sc->scan_timeout, &sc->sc_mtx, 0); |
525 |
callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0); |
525 |
callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); |
526 |
callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); |
526 |
callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0); |
527 |
callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0); |
527 |
TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc); |
528 |
TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc); |
Lines 722-727
Link Here
|
722 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); |
723 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); |
723 |
WPI_TXQ_LOCK_DESTROY(sc); |
724 |
WPI_TXQ_LOCK_DESTROY(sc); |
724 |
WPI_NT_LOCK_DESTROY(sc); |
725 |
WPI_NT_LOCK_DESTROY(sc); |
|
|
726 |
WPI_RXON_LOCK_DESTROY(sc); |
725 |
WPI_LOCK_DESTROY(sc); |
727 |
WPI_LOCK_DESTROY(sc); |
726 |
return 0; |
728 |
return 0; |
727 |
} |
729 |
} |
Lines 1652-1661
Link Here
|
1652 |
ieee80211_state_name[vap->iv_state], |
1654 |
ieee80211_state_name[vap->iv_state], |
1653 |
ieee80211_state_name[nstate]); |
1655 |
ieee80211_state_name[nstate]); |
1654 |
|
1656 |
|
1655 |
IEEE80211_UNLOCK(ic); |
|
|
1656 |
WPI_LOCK(sc); |
1657 |
switch (nstate) { |
1657 |
switch (nstate) { |
1658 |
case IEEE80211_S_SCAN: |
1658 |
case IEEE80211_S_SCAN: |
|
|
1659 |
WPI_RXON_LOCK(sc); |
1659 |
if ((sc->rxon.filter & htole32(WPI_FILTER_BSS)) && |
1660 |
if ((sc->rxon.filter & htole32(WPI_FILTER_BSS)) && |
1660 |
vap->iv_opmode != IEEE80211_M_STA) { |
1661 |
vap->iv_opmode != IEEE80211_M_STA) { |
1661 |
sc->rxon.filter &= ~htole32(WPI_FILTER_BSS); |
1662 |
sc->rxon.filter &= ~htole32(WPI_FILTER_BSS); |
Lines 1664-1669
Link Here
|
1664 |
"%s: could not send RXON\n", __func__); |
1665 |
"%s: could not send RXON\n", __func__); |
1665 |
} |
1666 |
} |
1666 |
} |
1667 |
} |
|
|
1668 |
WPI_RXON_UNLOCK(sc); |
1667 |
break; |
1669 |
break; |
1668 |
|
1670 |
|
1669 |
case IEEE80211_S_ASSOC: |
1671 |
case IEEE80211_S_ASSOC: |
Lines 1688-1694
Link Here
|
1688 |
* RUN -> RUN transition; Just restart the timers. |
1690 |
* RUN -> RUN transition; Just restart the timers. |
1689 |
*/ |
1691 |
*/ |
1690 |
if (vap->iv_state == IEEE80211_S_RUN) { |
1692 |
if (vap->iv_state == IEEE80211_S_RUN) { |
|
|
1693 |
WPI_RXON_LOCK(sc); |
1691 |
wpi_calib_timeout(sc); |
1694 |
wpi_calib_timeout(sc); |
|
|
1695 |
WPI_RXON_UNLOCK(sc); |
1692 |
break; |
1696 |
break; |
1693 |
} |
1697 |
} |
1694 |
|
1698 |
|
Lines 1706-1713
Link Here
|
1706 |
default: |
1710 |
default: |
1707 |
break; |
1711 |
break; |
1708 |
} |
1712 |
} |
1709 |
WPI_UNLOCK(sc); |
|
|
1710 |
IEEE80211_LOCK(ic); |
1711 |
if (error != 0) { |
1713 |
if (error != 0) { |
1712 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); |
1714 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); |
1713 |
return error; |
1715 |
return error; |
Lines 2163-2169
Link Here
|
2163 |
"scan finished nchan=%d status=%d chan=%d\n", |
2165 |
"scan finished nchan=%d status=%d chan=%d\n", |
2164 |
scan->nchan, scan->status, scan->chan); |
2166 |
scan->nchan, scan->status, scan->chan); |
2165 |
#endif |
2167 |
#endif |
|
|
2168 |
WPI_RXON_LOCK(sc); |
2166 |
callout_stop(&sc->scan_timeout); |
2169 |
callout_stop(&sc->scan_timeout); |
|
|
2170 |
WPI_RXON_UNLOCK(sc); |
2167 |
WPI_UNLOCK(sc); |
2171 |
WPI_UNLOCK(sc); |
2168 |
ieee80211_scan_next(vap); |
2172 |
ieee80211_scan_next(vap); |
2169 |
WPI_LOCK(sc); |
2173 |
WPI_LOCK(sc); |
Lines 3344-3350
Link Here
|
3344 |
{ |
3348 |
{ |
3345 |
struct wpi_softc *sc = ifp->if_softc; |
3349 |
struct wpi_softc *sc = ifp->if_softc; |
3346 |
|
3350 |
|
3347 |
WPI_LOCK(sc); |
3351 |
WPI_RXON_LOCK(sc); |
3348 |
wpi_set_promisc(sc); |
3352 |
wpi_set_promisc(sc); |
3349 |
|
3353 |
|
3350 |
if (wpi_send_rxon(sc, 1, 1) != 0) { |
3354 |
if (wpi_send_rxon(sc, 1, 1) != 0) { |
Lines 3351-3357
Link Here
|
3351 |
device_printf(sc->sc_dev, "%s: could not send RXON\n", |
3355 |
device_printf(sc->sc_dev, "%s: could not send RXON\n", |
3352 |
__func__); |
3356 |
__func__); |
3353 |
} |
3357 |
} |
3354 |
WPI_UNLOCK(sc); |
3358 |
WPI_RXON_UNLOCK(sc); |
3355 |
} |
3359 |
} |
3356 |
|
3360 |
|
3357 |
static void |
3361 |
static void |
Lines 3634-3639
Link Here
|
3634 |
{ |
3638 |
{ |
3635 |
int error; |
3639 |
int error; |
3636 |
|
3640 |
|
|
|
3641 |
if (async) |
3642 |
WPI_RXON_LOCK_ASSERT(sc); |
3643 |
|
3637 |
if (assoc && (sc->rxon.filter & htole32(WPI_FILTER_BSS))) { |
3644 |
if (assoc && (sc->rxon.filter & htole32(WPI_FILTER_BSS))) { |
3638 |
struct wpi_assoc rxon_assoc; |
3645 |
struct wpi_assoc rxon_assoc; |
3639 |
|
3646 |
|
Lines 4036-4041
Link Here
|
4036 |
struct ieee80211_node *ni = vap->iv_bss; |
4043 |
struct ieee80211_node *ni = vap->iv_bss; |
4037 |
int error; |
4044 |
int error; |
4038 |
|
4045 |
|
|
|
4046 |
WPI_RXON_LOCK(sc); |
4047 |
|
4039 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); |
4048 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); |
4040 |
|
4049 |
|
4041 |
/* Update adapter configuration. */ |
4050 |
/* Update adapter configuration. */ |
Lines 4073-4078
Link Here
|
4073 |
|
4082 |
|
4074 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); |
4083 |
DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); |
4075 |
|
4084 |
|
|
|
4085 |
WPI_RXON_UNLOCK(sc); |
4086 |
|
4076 |
return error; |
4087 |
return error; |
4077 |
} |
4088 |
} |
4078 |
|
4089 |
|
Lines 4253-4258
Link Here
|
4253 |
} |
4264 |
} |
4254 |
|
4265 |
|
4255 |
/* Update adapter configuration. */ |
4266 |
/* Update adapter configuration. */ |
|
|
4267 |
WPI_RXON_LOCK(sc); |
4256 |
IEEE80211_ADDR_COPY(sc->rxon.bssid, ni->ni_bssid); |
4268 |
IEEE80211_ADDR_COPY(sc->rxon.bssid, ni->ni_bssid); |
4257 |
sc->rxon.associd = htole16(IEEE80211_NODE_AID(ni)); |
4269 |
sc->rxon.associd = htole16(IEEE80211_NODE_AID(ni)); |
4258 |
sc->rxon.chan = ieee80211_chan2ieee(ic, ni->ni_chan); |
4270 |
sc->rxon.chan = ieee80211_chan2ieee(ic, ni->ni_chan); |
Lines 4287-4292
Link Here
|
4287 |
return error; |
4299 |
return error; |
4288 |
} |
4300 |
} |
4289 |
|
4301 |
|
|
|
4302 |
/* Start periodic calibration timer. */ |
4303 |
callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); |
4304 |
|
4305 |
WPI_RXON_UNLOCK(sc); |
4306 |
|
4290 |
if (vap->iv_opmode == IEEE80211_M_IBSS || |
4307 |
if (vap->iv_opmode == IEEE80211_M_IBSS || |
4291 |
vap->iv_opmode == IEEE80211_M_HOSTAP) { |
4308 |
vap->iv_opmode == IEEE80211_M_HOSTAP) { |
4292 |
if ((error = wpi_setup_beacon(sc, ni)) != 0) { |
4309 |
if ((error = wpi_setup_beacon(sc, ni)) != 0) { |
Lines 4313-4321
Link Here
|
4313 |
/* Link LED always on while associated. */ |
4330 |
/* Link LED always on while associated. */ |
4314 |
wpi_set_led(sc, WPI_LED_LINK, 0, 1); |
4331 |
wpi_set_led(sc, WPI_LED_LINK, 0, 1); |
4315 |
|
4332 |
|
4316 |
/* Start periodic calibration timer. */ |
|
|
4317 |
callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); |
4318 |
|
4319 |
/* Enable power-saving mode if requested by user. */ |
4333 |
/* Enable power-saving mode if requested by user. */ |
4320 |
if ((vap->iv_flags & IEEE80211_F_PMGTON) && |
4334 |
if ((vap->iv_flags & IEEE80211_F_PMGTON) && |
4321 |
vap->iv_opmode != IEEE80211_M_IBSS) |
4335 |
vap->iv_opmode != IEEE80211_M_IBSS) |
Lines 5274-5281
Link Here
|
5274 |
|
5288 |
|
5275 |
sc->sc_tx_timer = 0; |
5289 |
sc->sc_tx_timer = 0; |
5276 |
callout_stop(&sc->watchdog_to); |
5290 |
callout_stop(&sc->watchdog_to); |
|
|
5291 |
|
5292 |
WPI_RXON_LOCK(sc); |
5277 |
callout_stop(&sc->scan_timeout); |
5293 |
callout_stop(&sc->scan_timeout); |
5278 |
callout_stop(&sc->calib_to); |
5294 |
callout_stop(&sc->calib_to); |
|
|
5295 |
WPI_RXON_UNLOCK(sc); |
5279 |
|
5296 |
|
5280 |
IF_LOCK(&ifp->if_snd); |
5297 |
IF_LOCK(&ifp->if_snd); |
5281 |
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
5298 |
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
Lines 5337-5342
Link Here
|
5337 |
sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); |
5354 |
sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); |
5338 |
sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); |
5355 |
sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); |
5339 |
sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); |
5356 |
sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); |
|
|
5357 |
WPI_UNLOCK(sc); |
5340 |
|
5358 |
|
5341 |
/* |
5359 |
/* |
5342 |
* Only need to set the channel in Monitor mode. AP scanning and auth |
5360 |
* Only need to set the channel in Monitor mode. AP scanning and auth |
Lines 5343-5348
Link Here
|
5343 |
* are already taken care of by their respective firmware commands. |
5361 |
* are already taken care of by their respective firmware commands. |
5344 |
*/ |
5362 |
*/ |
5345 |
if (ic->ic_opmode == IEEE80211_M_MONITOR) { |
5363 |
if (ic->ic_opmode == IEEE80211_M_MONITOR) { |
|
|
5364 |
WPI_RXON_LOCK(sc); |
5346 |
sc->rxon.chan = ieee80211_chan2ieee(ic, c); |
5365 |
sc->rxon.chan = ieee80211_chan2ieee(ic, c); |
5347 |
if (IEEE80211_IS_CHAN_2GHZ(c)) { |
5366 |
if (IEEE80211_IS_CHAN_2GHZ(c)) { |
5348 |
sc->rxon.flags |= htole32(WPI_RXON_AUTO | |
5367 |
sc->rxon.flags |= htole32(WPI_RXON_AUTO | |
Lines 5351-5362
Link Here
|
5351 |
sc->rxon.flags &= ~htole32(WPI_RXON_AUTO | |
5370 |
sc->rxon.flags &= ~htole32(WPI_RXON_AUTO | |
5352 |
WPI_RXON_24GHZ); |
5371 |
WPI_RXON_24GHZ); |
5353 |
} |
5372 |
} |
5354 |
if ((error = wpi_send_rxon(sc, 0, 0)) != 0) |
5373 |
if ((error = wpi_send_rxon(sc, 0, 1)) != 0) |
5355 |
device_printf(sc->sc_dev, |
5374 |
device_printf(sc->sc_dev, |
5356 |
"%s: error %d setting channel\n", __func__, |
5375 |
"%s: error %d setting channel\n", __func__, |
5357 |
error); |
5376 |
error); |
|
|
5377 |
WPI_RXON_UNLOCK(sc); |
5358 |
} |
5378 |
} |
5359 |
WPI_UNLOCK(sc); |
|
|
5360 |
} |
5379 |
} |
5361 |
|
5380 |
|
5362 |
/** |
5381 |
/** |
Lines 5372-5384
Link Here
|
5372 |
struct wpi_softc *sc = ic->ic_ifp->if_softc; |
5391 |
struct wpi_softc *sc = ic->ic_ifp->if_softc; |
5373 |
int error; |
5392 |
int error; |
5374 |
|
5393 |
|
|
|
5394 |
WPI_RXON_LOCK(sc); |
5375 |
if (sc->rxon.chan != ieee80211_chan2ieee(ic, ic->ic_curchan)) { |
5395 |
if (sc->rxon.chan != ieee80211_chan2ieee(ic, ic->ic_curchan)) { |
5376 |
WPI_LOCK(sc); |
|
|
5377 |
error = wpi_scan(sc, ic->ic_curchan); |
5396 |
error = wpi_scan(sc, ic->ic_curchan); |
5378 |
WPI_UNLOCK(sc); |
5397 |
WPI_RXON_UNLOCK(sc); |
5379 |
if (error != 0) |
5398 |
if (error != 0) |
5380 |
ieee80211_cancel_scan(vap); |
5399 |
ieee80211_cancel_scan(vap); |
5381 |
} else { |
5400 |
} else { |
|
|
5401 |
WPI_RXON_UNLOCK(sc); |
5382 |
/* Send probe request when associated. */ |
5402 |
/* Send probe request when associated. */ |
5383 |
sc->sc_scan_curchan(ss, maxdwell); |
5403 |
sc->sc_scan_curchan(ss, maxdwell); |
5384 |
} |
5404 |
} |