FreeBSD Bugzilla – Attachment 154371 Details for
Bug 197143
[wpi] [patch]: sync with iwn / OpenBSD wpi
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add mutex for rxon structure
patch-wpi59.diff (text/plain), 6.68 KB, created by
Andriy Voskoboinyk
on 2015-03-15 13:58:10 UTC
(
hide
)
Description:
Add mutex for rxon structure
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-03-15 13:58:10 UTC
Size:
6.68 KB
patch
obsolete
>Index: sys/dev/wpi/if_wpi.c >=================================================================== >--- sys/dev/wpi/if_wpi.c (revision 279775) >+++ sys/dev/wpi/if_wpi.c (working copy) >@@ -396,6 +396,7 @@ > } > > WPI_LOCK_INIT(sc); >+ WPI_RXON_LOCK_INIT(sc); > WPI_NT_LOCK_INIT(sc); > WPI_TXQ_LOCK_INIT(sc); > >@@ -520,8 +521,8 @@ > > wpi_radiotap_attach(sc); > >- callout_init_mtx(&sc->calib_to, &sc->sc_mtx, 0); >- callout_init_mtx(&sc->scan_timeout, &sc->sc_mtx, 0); >+ callout_init_mtx(&sc->calib_to, &sc->rxon_mtx, 0); >+ callout_init_mtx(&sc->scan_timeout, &sc->rxon_mtx, 0); > callout_init_mtx(&sc->watchdog_to, &sc->sc_mtx, 0); > callout_init_mtx(&sc->watchdog_rfkill, &sc->sc_mtx, 0); > TASK_INIT(&sc->sc_reinittask, 0, wpi_hw_reset, sc); >@@ -722,6 +723,7 @@ > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); > WPI_TXQ_LOCK_DESTROY(sc); > WPI_NT_LOCK_DESTROY(sc); >+ WPI_RXON_LOCK_DESTROY(sc); > WPI_LOCK_DESTROY(sc); > return 0; > } >@@ -1652,10 +1654,9 @@ > ieee80211_state_name[vap->iv_state], > ieee80211_state_name[nstate]); > >- IEEE80211_UNLOCK(ic); >- WPI_LOCK(sc); > switch (nstate) { > case IEEE80211_S_SCAN: >+ WPI_RXON_LOCK(sc); > if ((sc->rxon.filter & htole32(WPI_FILTER_BSS)) && > vap->iv_opmode != IEEE80211_M_STA) { > sc->rxon.filter &= ~htole32(WPI_FILTER_BSS); >@@ -1664,6 +1665,7 @@ > "%s: could not send RXON\n", __func__); > } > } >+ WPI_RXON_UNLOCK(sc); > break; > > case IEEE80211_S_ASSOC: >@@ -1688,7 +1690,9 @@ > * RUN -> RUN transition; Just restart the timers. > */ > if (vap->iv_state == IEEE80211_S_RUN) { >+ WPI_RXON_LOCK(sc); > wpi_calib_timeout(sc); >+ WPI_RXON_UNLOCK(sc); > break; > } > >@@ -1706,8 +1710,6 @@ > default: > break; > } >- WPI_UNLOCK(sc); >- IEEE80211_LOCK(ic); > if (error != 0) { > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, __func__); > return error; >@@ -2163,7 +2165,9 @@ > "scan finished nchan=%d status=%d chan=%d\n", > scan->nchan, scan->status, scan->chan); > #endif >+ WPI_RXON_LOCK(sc); > callout_stop(&sc->scan_timeout); >+ WPI_RXON_UNLOCK(sc); > WPI_UNLOCK(sc); > ieee80211_scan_next(vap); > WPI_LOCK(sc); >@@ -3344,7 +3348,7 @@ > { > struct wpi_softc *sc = ifp->if_softc; > >- WPI_LOCK(sc); >+ WPI_RXON_LOCK(sc); > wpi_set_promisc(sc); > > if (wpi_send_rxon(sc, 1, 1) != 0) { >@@ -3351,7 +3355,7 @@ > device_printf(sc->sc_dev, "%s: could not send RXON\n", > __func__); > } >- WPI_UNLOCK(sc); >+ WPI_RXON_UNLOCK(sc); > } > > static void >@@ -3634,6 +3638,9 @@ > { > int error; > >+ if (async) >+ WPI_RXON_LOCK_ASSERT(sc); >+ > if (assoc && (sc->rxon.filter & htole32(WPI_FILTER_BSS))) { > struct wpi_assoc rxon_assoc; > >@@ -4036,6 +4043,8 @@ > struct ieee80211_node *ni = vap->iv_bss; > int error; > >+ WPI_RXON_LOCK(sc); >+ > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); > > /* Update adapter configuration. */ >@@ -4073,6 +4082,8 @@ > > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); > >+ WPI_RXON_UNLOCK(sc); >+ > return error; > } > >@@ -4253,6 +4264,7 @@ > } > > /* Update adapter configuration. */ >+ WPI_RXON_LOCK(sc); > IEEE80211_ADDR_COPY(sc->rxon.bssid, ni->ni_bssid); > sc->rxon.associd = htole16(IEEE80211_NODE_AID(ni)); > sc->rxon.chan = ieee80211_chan2ieee(ic, ni->ni_chan); >@@ -4287,6 +4299,11 @@ > return error; > } > >+ /* Start periodic calibration timer. */ >+ callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); >+ >+ WPI_RXON_UNLOCK(sc); >+ > if (vap->iv_opmode == IEEE80211_M_IBSS || > vap->iv_opmode == IEEE80211_M_HOSTAP) { > if ((error = wpi_setup_beacon(sc, ni)) != 0) { >@@ -4313,9 +4330,6 @@ > /* Link LED always on while associated. */ > wpi_set_led(sc, WPI_LED_LINK, 0, 1); > >- /* Start periodic calibration timer. */ >- callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); >- > /* Enable power-saving mode if requested by user. */ > if ((vap->iv_flags & IEEE80211_F_PMGTON) && > vap->iv_opmode != IEEE80211_M_IBSS) >@@ -5274,8 +5288,11 @@ > > sc->sc_tx_timer = 0; > callout_stop(&sc->watchdog_to); >+ >+ WPI_RXON_LOCK(sc); > callout_stop(&sc->scan_timeout); > callout_stop(&sc->calib_to); >+ WPI_RXON_UNLOCK(sc); > > IF_LOCK(&ifp->if_snd); > ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); >@@ -5337,6 +5354,7 @@ > sc->sc_rxtap.wr_chan_flags = htole16(c->ic_flags); > sc->sc_txtap.wt_chan_freq = htole16(c->ic_freq); > sc->sc_txtap.wt_chan_flags = htole16(c->ic_flags); >+ WPI_UNLOCK(sc); > > /* > * Only need to set the channel in Monitor mode. AP scanning and auth >@@ -5343,6 +5361,7 @@ > * are already taken care of by their respective firmware commands. > */ > if (ic->ic_opmode == IEEE80211_M_MONITOR) { >+ WPI_RXON_LOCK(sc); > sc->rxon.chan = ieee80211_chan2ieee(ic, c); > if (IEEE80211_IS_CHAN_2GHZ(c)) { > sc->rxon.flags |= htole32(WPI_RXON_AUTO | >@@ -5351,12 +5370,12 @@ > sc->rxon.flags &= ~htole32(WPI_RXON_AUTO | > WPI_RXON_24GHZ); > } >- if ((error = wpi_send_rxon(sc, 0, 0)) != 0) >+ if ((error = wpi_send_rxon(sc, 0, 1)) != 0) > device_printf(sc->sc_dev, > "%s: error %d setting channel\n", __func__, > error); >+ WPI_RXON_UNLOCK(sc); > } >- WPI_UNLOCK(sc); > } > > /** >@@ -5372,13 +5391,14 @@ > struct wpi_softc *sc = ic->ic_ifp->if_softc; > int error; > >+ WPI_RXON_LOCK(sc); > if (sc->rxon.chan != ieee80211_chan2ieee(ic, ic->ic_curchan)) { >- WPI_LOCK(sc); > error = wpi_scan(sc, ic->ic_curchan); >- WPI_UNLOCK(sc); >+ WPI_RXON_UNLOCK(sc); > if (error != 0) > ieee80211_cancel_scan(vap); > } else { >+ WPI_RXON_UNLOCK(sc); > /* Send probe request when associated. */ > sc->sc_scan_curchan(ss, maxdwell); > } >Index: sys/dev/wpi/if_wpivar.h >=================================================================== >--- sys/dev/wpi/if_wpivar.h (revision 279775) >+++ sys/dev/wpi/if_wpivar.h (working copy) >@@ -199,6 +199,8 @@ > int sc_cap_off; /* PCIe Capabilities. */ > > struct wpi_rxon rxon; >+ struct mtx rxon_mtx; >+ > int temp; > uint32_t qfullmsk; > >@@ -237,7 +239,7 @@ > char domain[4]; /* Regulatory domain. */ > }; > >-/* WPI_LOCK > WPI_NT_LOCK / WPI_VAP_LOCK > WPI_TXQ_LOCK */ >+/* WPI_LOCK > WPI_RXON_LOCK > WPI_NT_LOCK / WPI_VAP_LOCK > WPI_TXQ_LOCK */ > > #define WPI_LOCK_INIT(_sc) \ > mtx_init(&(_sc)->sc_mtx, device_get_nameunit((_sc)->sc_dev), \ >@@ -247,6 +249,13 @@ > #define WPI_LOCK_ASSERT(sc) mtx_assert(&(sc)->sc_mtx, MA_OWNED) > #define WPI_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->sc_mtx) > >+#define WPI_RXON_LOCK_INIT(_sc) \ >+ mtx_init(&(_sc)->rxon_mtx, "lock for wpi_rxon structure", NULL, MTX_DEF) >+#define WPI_RXON_LOCK(_sc) mtx_lock(&(_sc)->rxon_mtx) >+#define WPI_RXON_UNLOCK(_sc) mtx_unlock(&(_sc)->rxon_mtx) >+#define WPI_RXON_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rxon_mtx, MA_OWNED) >+#define WPI_RXON_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->rxon_mtx) >+ > #define WPI_NT_LOCK_INIT(_sc) \ > mtx_init(&(_sc)->nt_mtx, "node table lock", NULL, MTX_DEF) > #define WPI_NT_LOCK(_sc) mtx_lock(&(_sc)->nt_mtx)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197143
:
152282
|
152662
|
152977
|
153911
|
153977
|
153983
|
153985
|
153999
|
154000
|
154002
|
154006
|
154007
|
154009
|
154010
|
154011
|
154013
|
154015
|
154016
|
154017
|
154019
|
154020
|
154021
|
154022
|
154024
|
154026
|
154030
|
154032
|
154033
|
154328
|
154329
|
154330
|
154332
|
154334
|
154335
|
154336
|
154337
|
154338
|
154340
|
154341
|
154343
|
154346
|
154347
|
154348
|
154349
|
154350
|
154351
|
154352
|
154353
|
154354
|
154355
|
154356
|
154357
|
154358
|
154359
|
154360
|
154361
|
154362
|
154363
|
154364
|
154365
|
154366
|
154368
|
154369
|
154370
| 154371 |
154372
|
154373
|
154374
|
154375
|
154378
|
154379
|
154380
|
154381
|
154382
|
154383
|
154384
|
155332
|
155333
|
156164
|
156165
|
156166
|
156167
|
156168
|
156169
|
156170
|
156171
|
156172
|
156173
|
156174
|
156175
|
156176
|
156177
|
156178
|
156179
|
156180
|
156181
|
156182
|
156183
|
156184
|
156185
|
156186
|
156187
|
156188
|
156189
|
156190
|
156191
|
156192
|
156193
|
156194
|
156195