diff options
author | sam <sam@FreeBSD.org> | 2009-05-02 20:16:55 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-05-02 20:16:55 +0000 |
commit | 81f398305ad92fe26044bdd2aa59cb0799f3751b (patch) | |
tree | 30f6ca4cbd6d3ef52796d2af9945c2c555ff14f7 /sys/net80211/ieee80211_superg.c | |
parent | ed7c3176b96444dc82c6a07114013192611024f3 (diff) | |
download | FreeBSD-src-81f398305ad92fe26044bdd2aa59cb0799f3751b.zip FreeBSD-src-81f398305ad92fe26044bdd2aa59cb0799f3751b.tar.gz |
make superg/fast-frames state dynamically-allocated (and indirect off
the com structure instead of embedded); this reduces the overhead when
not configured and reduces visibility of the contents
Diffstat (limited to 'sys/net80211/ieee80211_superg.c')
-rw-r--r-- | sys/net80211/ieee80211_superg.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/sys/net80211/ieee80211_superg.c b/sys/net80211/ieee80211_superg.c index c6e2d28..de5df09 100644 --- a/sys/net80211/ieee80211_superg.c +++ b/sys/net80211/ieee80211_superg.c @@ -90,17 +90,38 @@ int ieee80211_ffagemax = -1; /* max time frames held on stage q */ void ieee80211_superg_attach(struct ieee80211com *ic) { + struct ieee80211_superg *sg; + + if (ic->ic_caps & IEEE80211_C_FF) { + sg = (struct ieee80211_superg *) malloc( + sizeof(struct ieee80211_superg), M_80211_VAP, + M_NOWAIT | M_ZERO); + if (sg == NULL) { + printf("%s: cannot allocate SuperG state block\n", + __func__); + return; + } + ic->ic_superg = sg; + } ieee80211_ffagemax = msecs_to_ticks(150); } void ieee80211_superg_detach(struct ieee80211com *ic) { + if (ic->ic_superg != NULL) { + free(ic->ic_superg, M_80211_VAP); + ic->ic_superg = NULL; + } } void ieee80211_superg_vattach(struct ieee80211vap *vap) { + struct ieee80211com *ic = vap->iv_ic; + + if (ic->ic_superg == NULL) /* NB: can't do fast-frames w/o state */ + vap->iv_caps &= ~IEEE80211_C_FF; if (vap->iv_caps & IEEE80211_C_FF) vap->iv_flags |= IEEE80211_F_FF; /* NB: we only implement sta mode */ @@ -527,8 +548,10 @@ ff_flush(struct mbuf *head, struct mbuf *last) * Age frames on the staging queue. */ void -ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, int quanta) +ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, + int quanta) { + struct ieee80211_superg *sg = ic->ic_superg; struct mbuf *m, *head; struct ieee80211_node *ni; struct ieee80211_tx_ampdu *tap; @@ -546,7 +569,7 @@ ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq, int quant sq->head = m->m_nextpkt; sq->depth--; - ic->ic_stageqdepth--; + sg->ff_stageqdepth--; } if (m == NULL) sq->tail = NULL; @@ -631,6 +654,7 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_superg *sg = ic->ic_superg; const int pri = M_WME_GETAC(m); struct ieee80211_stageq *sq; struct ieee80211_tx_ampdu *tap; @@ -669,7 +693,7 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) IEEE80211_UNLOCK(ic); return m; } - sq = &ic->ic_ff_stageq[pri]; + sq = &sg->ff_stageq[pri]; /* * Check the txop limit to insure the aggregate fits. */ @@ -730,7 +754,7 @@ ieee80211_ff_check(struct ieee80211_node *ni, struct mbuf *m) tap->txa_private = m; stageq_add(sq, m); - ic->ic_stageqdepth++; + sg->ff_stageqdepth++; IEEE80211_UNLOCK(ic); IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni, @@ -755,6 +779,7 @@ void ieee80211_ff_node_cleanup(struct ieee80211_node *ni) { struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_superg *sg = ic->ic_superg; struct ieee80211_tx_ampdu *tap; struct mbuf *m, *head; int ac; @@ -766,7 +791,7 @@ ieee80211_ff_node_cleanup(struct ieee80211_node *ni) m = tap->txa_private; if (m != NULL) { tap->txa_private = NULL; - stageq_remove(&ic->ic_ff_stageq[ac], m); + stageq_remove(&sg->ff_stageq[ac], m); m->m_nextpkt = head; head = m; } |