net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vap

Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3658
This commit is contained in:
Adrian Chadd 2015-09-22 06:34:07 +00:00
parent 44369387a1
commit 0cf00015be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288095
20 changed files with 38 additions and 45 deletions

View File

@ -199,7 +199,7 @@ ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni)
* we assume the mbuf routines will return us something
* with this alignment (perhaps should assert).
*/
m = ieee80211_beacon_alloc(ni, &avp->av_boff);
m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off);
if (m == NULL) {
device_printf(sc->sc_dev, "%s: cannot get mbuf\n", __func__);
sc->sc_stats.ast_be_nombuf++;
@ -374,7 +374,7 @@ ath_beacon_setup(struct ath_softc *sc, struct ath_buf *bf)
void
ath_beacon_update(struct ieee80211vap *vap, int item)
{
struct ieee80211_beacon_offsets *bo = &ATH_VAP(vap)->av_boff;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
setbit(bo->bo_flags, item);
}
@ -713,7 +713,7 @@ ath_beacon_generate(struct ath_softc *sc, struct ieee80211vap *vap)
/* XXX lock mcastq? */
nmcastq = avp->av_mcastq.axq_depth;
if (ieee80211_beacon_update(bf->bf_node, &avp->av_boff, m, nmcastq)) {
if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, nmcastq)) {
/* XXX too conservative? */
bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap);
error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m,
@ -726,7 +726,7 @@ ath_beacon_generate(struct ath_softc *sc, struct ieee80211vap *vap)
return NULL;
}
}
if ((avp->av_boff.bo_tim[4] & 1) && cabq->axq_depth) {
if ((vap->iv_bcn_off.bo_tim[4] & 1) && cabq->axq_depth) {
DPRINTF(sc, ATH_DEBUG_BEACON,
"%s: cabq did not drain, mcastq %u cabq %u\n",
__func__, nmcastq, cabq->axq_depth);
@ -764,7 +764,7 @@ ath_beacon_generate(struct ath_softc *sc, struct ieee80211vap *vap)
* Enable the CAB queue before the beacon queue to
* insure cab frames are triggered by this beacon.
*/
if (avp->av_boff.bo_tim[4] & 1) {
if (vap->iv_bcn_off.bo_tim[4] & 1) {
/* NB: only at DTIM */
ATH_TXQ_LOCK(&avp->av_mcastq);
@ -829,7 +829,7 @@ ath_beacon_start_adhoc(struct ath_softc *sc, struct ieee80211vap *vap)
*/
bf = avp->av_bcbuf;
m = bf->bf_m;
if (ieee80211_beacon_update(bf->bf_node, &avp->av_boff, m, 0)) {
if (ieee80211_beacon_update(bf->bf_node, &vap->iv_bcn_off, m, 0)) {
/* XXX too conservative? */
bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap);
error = bus_dmamap_load_mbuf_sg(sc->sc_dmat, bf->bf_dmamap, m,

View File

@ -548,7 +548,7 @@ ath_tdma_update(struct ieee80211_node *ni,
* slot position changes) because ieee80211_add_tdma
* skips over the data.
*/
memcpy(ATH_VAP(vap)->av_boff.bo_tdma +
memcpy(vap->iv_bcn_off.bo_tdma +
__offsetof(struct ieee80211_tdma_param, tdma_tstamp),
&ni->ni_tstamp.data, 8);
#if 0

View File

@ -477,7 +477,6 @@ struct ath_vap {
struct ieee80211vap av_vap; /* base class */
int av_bslot; /* beacon slot index */
struct ath_buf *av_bcbuf; /* beacon buffer */
struct ieee80211_beacon_offsets av_boff;/* dynamic update state */
struct ath_txq av_mcastq; /* buffered mcast s/w queue */
void (*av_recv_mgmt)(struct ieee80211_node *,

View File

@ -1834,10 +1834,10 @@ mwl_beacon_setup(struct ieee80211vap *vap)
{
struct mwl_hal_vap *hvap = MWL_VAP(vap)->mv_hvap;
struct ieee80211_node *ni = vap->iv_bss;
struct ieee80211_beacon_offsets bo;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct mbuf *m;
m = ieee80211_beacon_alloc(ni, &bo);
m = ieee80211_beacon_alloc(ni, bo);
if (m == NULL)
return ENOBUFS;
mwl_hal_setbeacon(hvap, mtod(m, const void *), m->m_len);

View File

@ -768,7 +768,7 @@ rt2560_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
vap->iv_opmode == IEEE80211_M_IBSS ||
vap->iv_opmode == IEEE80211_M_MBSS) {
m = ieee80211_beacon_alloc(ni, &rvp->ral_bo);
m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off);
if (m == NULL) {
device_printf(sc->sc_dev,
"could not allocate beacon\n");
@ -1273,8 +1273,7 @@ rt2560_rx_intr(struct rt2560_softc *sc)
static void
rt2560_beacon_update(struct ieee80211vap *vap, int item)
{
struct rt2560_vap *rvp = RT2560_VAP(vap);
struct ieee80211_beacon_offsets *bo = &rvp->ral_bo;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
setbit(bo->bo_flags, item);
}
@ -1288,7 +1287,6 @@ rt2560_beacon_expire(struct rt2560_softc *sc)
{
struct ieee80211com *ic = &sc->sc_ic;
struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
struct rt2560_vap *rvp = RT2560_VAP(vap);
struct rt2560_tx_data *data;
if (ic->ic_opmode != IEEE80211_M_IBSS &&
@ -1307,7 +1305,7 @@ rt2560_beacon_expire(struct rt2560_softc *sc)
bus_dmamap_unload(sc->bcnq.data_dmat, data->map);
/* XXX 1 =>'s mcast frames which means all PS sta's will wakeup! */
ieee80211_beacon_update(data->ni, &rvp->ral_bo, data->m, 1);
ieee80211_beacon_update(data->ni, &vap->iv_bcn_off, data->m, 1);
rt2560_tx_bcn(sc, data->m, data->ni);

View File

@ -97,7 +97,6 @@ struct rt2560_rx_ring {
struct rt2560_vap {
struct ieee80211vap ral_vap;
struct ieee80211_beacon_offsets ral_bo;
int (*ral_newstate)(struct ieee80211vap *,
enum ieee80211_state, int);

View File

@ -2626,12 +2626,12 @@ static int
rt2661_prepare_beacon(struct rt2661_softc *sc, struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_beacon_offsets bo;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct rt2661_tx_desc desc;
struct mbuf *m0;
int rate;
m0 = ieee80211_beacon_alloc(vap->iv_bss, &bo);
m0 = ieee80211_beacon_alloc(vap->iv_bss, bo);
if (m0 == NULL) {
device_printf(sc->sc_dev, "could not allocate beacon frame\n");
return ENOBUFS;

View File

@ -4268,12 +4268,12 @@ static int
rt2860_setup_beacon(struct rt2860_softc *sc, struct ieee80211vap *vap)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_beacon_offsets bo;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct rt2860_txwi txwi;
struct mbuf *m;
int ridx;
if ((m = ieee80211_beacon_alloc(vap->iv_bss, &bo)) == NULL)
if ((m = ieee80211_beacon_alloc(vap->iv_bss, bo)) == NULL)
return ENOBUFS;
memset(&txwi, 0, sizeof txwi);

View File

@ -724,7 +724,6 @@ struct rsu_data {
struct rsu_vap {
struct ieee80211vap vap;
struct ieee80211_beacon_offsets bo;
int (*newstate)(struct ieee80211vap *,
enum ieee80211_state, int);

View File

@ -4811,13 +4811,13 @@ static void
run_update_beacon(struct ieee80211vap *vap, int item)
{
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct ieee80211_node *ni = vap->iv_bss;
struct run_softc *sc = ic->ic_softc;
struct run_vap *rvp = RUN_VAP(vap);
int mcast = 0;
uint32_t i;
KASSERT(vap != NULL, ("no beacon"));
switch (item) {
case IEEE80211_BEACON_ERP:
run_updateslot(ic);
@ -4832,14 +4832,13 @@ run_update_beacon(struct ieee80211vap *vap, int item)
break;
}
setbit(rvp->bo.bo_flags, item);
setbit(bo->bo_flags, item);
if (rvp->beacon_mbuf == NULL) {
rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss,
&rvp->bo);
rvp->beacon_mbuf = ieee80211_beacon_alloc(ni, bo);
if (rvp->beacon_mbuf == NULL)
return;
}
ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast);
ieee80211_beacon_update(ni, bo, rvp->beacon_mbuf, mcast);
i = RUN_CMDQ_GET(&sc->cmdq_store);
DPRINTF("cmdq_store=%d\n", i);
@ -4854,6 +4853,7 @@ static void
run_update_beacon_cb(void *arg)
{
struct ieee80211vap *vap = arg;
struct ieee80211_node *ni = vap->iv_bss;
struct run_vap *rvp = RUN_VAP(vap);
struct ieee80211com *ic = vap->iv_ic;
struct run_softc *sc = ic->ic_softc;
@ -4862,7 +4862,7 @@ run_update_beacon_cb(void *arg)
uint16_t txwisize;
uint8_t ridx;
if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC)
if (ni->ni_chan == IEEE80211_CHAN_ANYC)
return;
if (ic->ic_bsschan == IEEE80211_CHAN_ANYC)
return;
@ -4872,8 +4872,8 @@ run_update_beacon_cb(void *arg)
* is taking care of apropriate calls.
*/
if (rvp->beacon_mbuf == NULL) {
rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss,
&rvp->bo);
rvp->beacon_mbuf = ieee80211_beacon_alloc(ni,
&vap->iv_bcn_off);
if (rvp->beacon_mbuf == NULL)
return;
}

View File

@ -119,7 +119,6 @@ struct run_cmdq {
struct run_vap {
struct ieee80211vap vap;
struct ieee80211_beacon_offsets bo;
struct mbuf *beacon_mbuf;
int (*newstate)(struct ieee80211vap *,

View File

@ -713,7 +713,7 @@ ural_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
if (vap->iv_opmode == IEEE80211_M_HOSTAP ||
vap->iv_opmode == IEEE80211_M_IBSS) {
m = ieee80211_beacon_alloc(ni, &uvp->bo);
m = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off);
if (m == NULL) {
device_printf(sc->sc_dev,
"could not allocate beacon\n");

View File

@ -73,7 +73,7 @@ typedef STAILQ_HEAD(, ural_tx_data) ural_txdhead;
struct ural_vap {
struct ieee80211vap vap;
struct ieee80211_beacon_offsets bo;
struct usb_callout ratectl_ch;
struct task ratectl_task;

View File

@ -1134,7 +1134,6 @@ struct urtwn_fw_info {
struct urtwn_vap {
struct ieee80211vap vap;
struct ieee80211_beacon_offsets bo;
int (*newstate)(struct ieee80211vap *,
enum ieee80211_state, int);

View File

@ -58,7 +58,6 @@
struct wi_vap {
struct ieee80211vap wv_vap;
struct ieee80211_beacon_offsets wv_bo;
void (*wv_recv_mgmt)(struct ieee80211_node *, struct mbuf *,
int, const struct ieee80211_rx_stats *rxs, int, int);

View File

@ -4309,8 +4309,9 @@ wpi_auth(struct wpi_softc *sc, struct ieee80211vap *vap)
static int
wpi_config_beacon(struct wpi_vap *wvp)
{
struct ieee80211com *ic = wvp->wv_vap.iv_ic;
struct ieee80211_beacon_offsets *bo = &wvp->wv_boff;
struct ieee80211vap *vap = &wvp->wv_vap;
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct wpi_buf *bcn = &wvp->wv_bcbuf;
struct wpi_softc *sc = ic->ic_softc;
struct wpi_cmd_beacon *cmd = (struct wpi_cmd_beacon *)&bcn->data;
@ -4361,9 +4362,10 @@ end: bcn->m = m;
static int
wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni)
{
struct wpi_vap *wvp = WPI_VAP(ni->ni_vap);
struct ieee80211vap *vap = ni->ni_vap;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
struct wpi_vap *wvp = WPI_VAP(vap);
struct wpi_buf *bcn = &wvp->wv_bcbuf;
struct ieee80211_beacon_offsets *bo = &wvp->wv_boff;
struct mbuf *m;
int error;
@ -4397,7 +4399,7 @@ wpi_update_beacon(struct ieee80211vap *vap, int item)
struct wpi_softc *sc = vap->iv_ic->ic_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_beacon_offsets *bo = &vap->iv_bcn_off;
struct ieee80211_node *ni = vap->iv_bss;
int mcast = 0;

View File

@ -125,7 +125,6 @@ struct wpi_vap {
struct ieee80211vap wv_vap;
struct wpi_buf wv_bcbuf;
struct ieee80211_beacon_offsets wv_boff;
struct mtx wv_mtx;
uint32_t wv_gtk;

View File

@ -183,7 +183,7 @@ wtap_reset_vap(struct ieee80211vap *vap, u_long cmd)
static void
wtap_beacon_update(struct ieee80211vap *vap, int item)
{
struct ieee80211_beacon_offsets *bo = &WTAP_VAP(vap)->av_boff;
struct ieee80211_beacon_offsets *bo = &vap->iv_bcn_off;
DWTAP_PRINTF("%s\n", __func__);
setbit(bo->bo_flags, item);
@ -205,7 +205,7 @@ wtap_beacon_alloc(struct wtap_softc *sc, struct ieee80211_node *ni)
* we assume the mbuf routines will return us something
* with this alignment (perhaps should assert).
*/
avp->beacon = ieee80211_beacon_alloc(ni, &avp->av_boff);
avp->beacon = ieee80211_beacon_alloc(ni, &vap->iv_bcn_off);
if (avp->beacon == NULL) {
printf("%s: cannot get mbuf\n", __func__);
return ENOMEM;
@ -242,7 +242,7 @@ wtap_beacon_intrp(void *arg)
* of the TIM bitmap).
*/
m = m_dup(avp->beacon, M_NOWAIT);
if (ieee80211_beacon_update(avp->bf_node, &avp->av_boff, m, 0)) {
if (ieee80211_beacon_update(avp->bf_node, &vap->iv_bcn_off, m, 0)) {
printf("%s, need to remap the memory because the beacon frame"
" changed size.\n",__func__);
}

View File

@ -116,7 +116,6 @@ struct wtap_vap {
struct wtap_medium *av_md; /* back pointer */
struct mbuf *beacon; /* beacon */
struct ieee80211_node *bf_node; /* pointer to the node */
struct ieee80211_beacon_offsets av_boff;/* dynamic update state */
struct callout av_swba; /* software beacon alert */
uint32_t av_bcinterval; /* beacon interval */
void (*av_recv_mgmt)(struct ieee80211_node *,

View File

@ -417,6 +417,7 @@ struct ieee80211vap {
int iv_amsdu_limit; /* A-MSDU tx limit (bytes) */
u_int iv_ampdu_mintraffic[WME_NUM_AC];
struct ieee80211_beacon_offsets iv_bcn_off;
uint32_t *iv_aid_bitmap; /* association id map */
uint16_t iv_max_aid;
uint16_t iv_sta_assoc; /* stations associated */