FreeBSD Bugzilla – Attachment 154347 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]
Use ieee80211_beacon_update() for dynamic beacon contents
patch-wpi36.diff (text/plain), 5.41 KB, created by
Andriy Voskoboinyk
on 2015-03-15 12:24:42 UTC
(
hide
)
Description:
Use ieee80211_beacon_update() for dynamic beacon contents
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-03-15 12:24:42 UTC
Size:
5.41 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) >@@ -227,8 +227,9 @@ > struct ieee80211_channel *); > static int wpi_scan(struct wpi_softc *, struct ieee80211_channel *); > static int wpi_auth(struct wpi_softc *, struct ieee80211vap *); >+static int wpi_config_beacon(struct wpi_vap *); >+static int wpi_setup_beacon(struct wpi_softc *, struct ieee80211_node *); > static void wpi_update_beacon(struct ieee80211vap *, int); >-static int wpi_setup_beacon(struct wpi_softc *, struct ieee80211_node *); > static void wpi_newassoc(struct ieee80211_node *, int); > static int wpi_run(struct wpi_softc *, struct ieee80211vap *); > static int wpi_key_alloc(struct ieee80211vap *, struct ieee80211_key *, >@@ -639,10 +640,17 @@ > wpi_vap_delete(struct ieee80211vap *vap) > { > struct wpi_vap *wvp = WPI_VAP(vap); >+ struct wpi_buf *bcn = &wvp->wv_bcbuf; >+ enum ieee80211_opmode opmode = vap->iv_opmode; > > ieee80211_ratectl_deinit(vap); > ieee80211_vap_detach(vap); > >+ if (opmode == IEEE80211_M_IBSS) { >+ if (bcn->m != NULL) >+ m_freem(bcn->m); >+ } >+ > free(wvp, M_80211_VAP); > } > >@@ -3945,14 +3953,65 @@ > } > > static int >+wpi_config_beacon(struct wpi_vap *wvp) >+{ >+ struct ieee80211com *ic = wvp->vap.iv_ic; >+ struct ieee80211_beacon_offsets *bo = &wvp->wv_boff; >+ struct wpi_buf *bcn = &wvp->wv_bcbuf; >+ struct wpi_softc *sc = ic->ic_ifp->if_softc; >+ struct wpi_cmd_beacon *cmd = (struct wpi_cmd_beacon *)&bcn->data; >+ struct ieee80211_tim_ie *tie; >+ struct mbuf *m; >+ uint8_t *ptr; >+ int error; >+ >+ DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__); >+ >+ WPI_LOCK_ASSERT(sc); >+ >+ cmd->len = htole16(bcn->m->m_pkthdr.len); >+ cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ? >+ wpi_ridx_to_plcp[WPI_RIDX_OFDM6] : wpi_ridx_to_plcp[WPI_RIDX_CCK1]; >+ >+ /* XXX seems to be unused */ >+ if (*(bo->bo_tim) == IEEE80211_ELEMID_TIM) { >+ tie = (struct ieee80211_tim_ie *) bo->bo_tim; >+ ptr = mtod(bcn->m, uint8_t *); >+ >+ cmd->tim = htole16(bo->bo_tim - ptr); >+ cmd->timsz = tie->tim_len; >+ } >+ >+ /* Necessary for recursion in ieee80211_beacon_update(). */ >+ m = bcn->m; >+ bcn->m = m_dup(m, M_NOWAIT); >+ if (bcn->m == NULL) { >+ device_printf(sc->sc_dev, >+ "%s: could not copy beacon frame\n", __func__); >+ error = ENOMEM; >+ goto end; >+ } >+ >+ if ((error = wpi_cmd2(sc, bcn)) != 0) { >+ device_printf(sc->sc_dev, >+ "%s: could not update beacon frame, error %d", __func__, >+ error); >+ } >+ >+ /* Restore mbuf. */ >+end: bcn->m = m; >+ >+ return error; >+} >+ >+static int > wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni) > { >- struct ieee80211com *ic = sc->sc_ifp->if_l2com; > struct wpi_vap *wvp = WPI_VAP(ni->ni_vap); > struct wpi_buf *bcn = &wvp->wv_bcbuf; >- struct ieee80211_beacon_offsets bo; >- struct wpi_cmd_beacon *cmd = (struct wpi_cmd_beacon *)&bcn->data; >+ struct ieee80211_beacon_offsets *bo = &wvp->wv_boff; > struct mbuf *m; >+ int error; > > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__); > >@@ -3959,7 +4018,7 @@ > if (ni->ni_chan == IEEE80211_CHAN_ANYC) > return EINVAL; > >- m = ieee80211_beacon_alloc(ni, &bo); >+ m = ieee80211_beacon_alloc(ni, bo); > if (m == NULL) { > device_printf(sc->sc_dev, > "%s: could not allocate beacon frame\n", __func__); >@@ -3966,14 +4025,14 @@ > return ENOMEM; > } > >- cmd->len = htole16(m->m_pkthdr.len); >- cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ? >- wpi_ridx_to_plcp[WPI_RIDX_OFDM6] : wpi_ridx_to_plcp[WPI_RIDX_CCK1]; >+ if (bcn->m != NULL) >+ m_freem(bcn->m); > >- /* NB: m will be freed in wpi_cmd_done() */ > bcn->m = m; > >- return wpi_cmd2(sc, bcn); >+ error = wpi_config_beacon(wvp); >+ >+ return error; > } > > static void >@@ -3980,16 +4039,41 @@ > wpi_update_beacon(struct ieee80211vap *vap, int item) > { > struct wpi_softc *sc = vap->iv_ic->ic_ifp->if_softc; >+ struct wpi_vap *wvp = WPI_VAP(vap); >+ struct wpi_buf *bcn = &wvp->wv_bcbuf; >+ struct ieee80211_beacon_offsets *bo = &wvp->wv_boff; > struct ieee80211_node *ni = vap->iv_bss; >- int error; >+ int mcast = 0; > >+ DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); >+ > WPI_LOCK(sc); >- if ((error = wpi_setup_beacon(sc, ni)) != 0) { >- device_printf(sc->sc_dev, >- "%s: could not update beacon frame, error %d", __func__, >- error); >+ if (bcn->m == NULL) { >+ bcn->m = ieee80211_beacon_alloc(ni, bo); >+ if (bcn->m == NULL) { >+ device_printf(sc->sc_dev, >+ "%s: could not allocate beacon frame\n", __func__); >+ WPI_UNLOCK(sc); >+ >+ DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END_ERR, >+ __func__); >+ >+ return; >+ } > } > WPI_UNLOCK(sc); >+ >+ if (item == IEEE80211_BEACON_TIM) >+ mcast = 1; /* TODO */ >+ >+ setbit(bo->bo_flags, item); >+ ieee80211_beacon_update(ni, bo, bcn->m, mcast); >+ >+ WPI_LOCK(sc); >+ wpi_config_beacon(wvp); >+ WPI_UNLOCK(sc); >+ >+ DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); > } > > static void >Index: sys/dev/wpi/if_wpivar.h >=================================================================== >--- sys/dev/wpi/if_wpivar.h (revision 279775) >+++ sys/dev/wpi/if_wpivar.h (working copy) >@@ -121,11 +121,13 @@ > }; > > struct wpi_vap { >- struct ieee80211vap vap; >- struct wpi_buf wv_bcbuf; >+ struct ieee80211vap vap; > >- int (*newstate)(struct ieee80211vap *, >- enum ieee80211_state, int); >+ struct wpi_buf wv_bcbuf; >+ struct ieee80211_beacon_offsets wv_boff; >+ >+ int (*newstate)(struct ieee80211vap *, >+ enum ieee80211_state, int); > }; > #define WPI_VAP(vap) ((struct wpi_vap *)(vap)) >
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