From owner-svn-src-all@FreeBSD.ORG Sat May 2 20:16:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13452106566B; Sat, 2 May 2009 20:16:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00EF88FC0A; Sat, 2 May 2009 20:16:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n42KGtZt094143; Sat, 2 May 2009 20:16:55 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n42KGtkM094138; Sat, 2 May 2009 20:16:55 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200905022016.n42KGtkM094138@svn.freebsd.org> From: Sam Leffler Date: Sat, 2 May 2009 20:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191753 - in head/sys: dev/ath net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2009 20:16:56 -0000 Author: sam Date: Sat May 2 20:16:55 2009 New Revision: 191753 URL: http://svn.freebsd.org/changeset/base/191753 Log: 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 Modified: head/sys/dev/ath/if_ath.c head/sys/net80211/ieee80211_superg.c head/sys/net80211/ieee80211_superg.h head/sys/net80211/ieee80211_var.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat May 2 20:13:37 2009 (r191752) +++ head/sys/dev/ath/if_ath.c Sat May 2 20:16:55 2009 (r191753) @@ -3995,12 +3995,7 @@ rx_next: if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) { #ifdef IEEE80211_SUPPORT_SUPERG - if (ic->ic_stageqdepth) { - ieee80211_age_stageq(ic, WME_AC_VO, 100); - ieee80211_age_stageq(ic, WME_AC_VI, 100); - ieee80211_age_stageq(ic, WME_AC_BE, 100); - ieee80211_age_stageq(ic, WME_AC_BK, 100); - } + ieee80211_ff_age_all(ic, 100); #endif if (!IFQ_IS_EMPTY(&ifp->if_snd)) ath_start(ifp); @@ -4980,7 +4975,7 @@ ath_tx_processq(struct ath_softc *sc, st * Flush fast-frame staging queue when traffic slows. */ if (txq->axq_depth <= 1) - ieee80211_flush_stageq(ic, txq->axq_ac); + ieee80211_ff_flush(ic, txq->axq_ac); #endif return nacked; } Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Sat May 2 20:13:37 2009 (r191752) +++ head/sys/net80211/ieee80211_superg.c Sat May 2 20:16:55 2009 (r191753) @@ -90,17 +90,38 @@ int ieee80211_ffagemax = -1; /* max time 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 * 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 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 { 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 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 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 ieee802 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; } Modified: head/sys/net80211/ieee80211_superg.h ============================================================================== --- head/sys/net80211/ieee80211_superg.h Sat May 2 20:13:37 2009 (r191752) +++ head/sys/net80211/ieee80211_superg.h Sat May 2 20:16:55 2009 (r191753) @@ -57,6 +57,18 @@ struct ieee80211_ath_ie { #define ATH_OUI_SUBTYPE 0x01 #ifdef _KERNEL +struct ieee80211_stageq { + struct mbuf *head; /* frames linked w/ m_nextpkt */ + struct mbuf *tail; /* last frame in queue */ + int depth; /* # items on head */ +}; + +struct ieee80211_superg { + /* fast-frames staging q */ + struct ieee80211_stageq ff_stageq[WME_NUM_AC]; + int ff_stageqdepth; /* cumulative depth */ +}; + void ieee80211_superg_attach(struct ieee80211com *); void ieee80211_superg_detach(struct ieee80211com *); void ieee80211_superg_vattach(struct ieee80211vap *); @@ -72,20 +84,33 @@ void ieee80211_ff_node_init(struct ieee8 void ieee80211_ff_node_cleanup(struct ieee80211_node *); struct mbuf *ieee80211_ff_check(struct ieee80211_node *, struct mbuf *); -void ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *, int); +void ieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *, + int quanta); static __inline void -ieee80211_flush_stageq(struct ieee80211com *ic, int ac) +ieee80211_ff_flush(struct ieee80211com *ic, int ac) { - if (ic->ic_ff_stageq[ac].depth) - ieee80211_ff_age(ic, &ic->ic_ff_stageq[ac], 0x7fffffff); + struct ieee80211_superg *sg = ic->ic_superg; + + if (sg != NULL && sg->ff_stageq[ac].depth) + ieee80211_ff_age(ic, &sg->ff_stageq[ac], 0x7fffffff); } static __inline void -ieee80211_age_stageq(struct ieee80211com *ic, int ac, int quanta) +ieee80211_ff_age_all(struct ieee80211com *ic, int quanta) { - if (ic->ic_ff_stageq[ac].depth) - ieee80211_ff_age(ic, &ic->ic_ff_stageq[ac], quanta); + struct ieee80211_superg *sg = ic->ic_superg; + + if (sg != NULL && sg->ff_stageqdepth) { + if (sg->ff_stageq[WME_AC_VO].depth) + ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VO], quanta); + if (sg->ff_stageq[WME_AC_VI].depth) + ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VI], quanta); + if (sg->ff_stageq[WME_AC_BE].depth) + ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BE], quanta); + if (sg->ff_stageq[WME_AC_BK].depth) + ieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BK], quanta); + } } struct mbuf *ieee80211_ff_encap(struct ieee80211vap *, struct mbuf *, Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat May 2 20:13:37 2009 (r191752) +++ head/sys/net80211/ieee80211_var.h Sat May 2 20:16:55 2009 (r191753) @@ -110,12 +110,7 @@ struct ieee80211_tdma_param; struct ieee80211_rate_table; struct ieee80211_tx_ampdu; struct ieee80211_rx_ampdu; - -struct ieee80211_stageq { - struct mbuf *head; /* frames linked w/ m_nextpkt */ - struct mbuf *tail; /* last frame in queue */ - int depth; /* # items on head */ -}; +struct ieee80211_superg; struct ieee80211com { struct ifnet *ic_ifp; /* associated device */ @@ -211,9 +206,8 @@ struct ieee80211com { int ic_lastnonerp; /* last time non-ERP sta noted*/ int ic_lastnonht; /* last time non-HT sta noted */ - /* fast-frames staging q */ - struct ieee80211_stageq ic_ff_stageq[WME_NUM_AC]; - int ic_stageqdepth; /* cumulative depth */ + /* optional state for Atheros SuperG protocol extensions */ + struct ieee80211_superg *ic_superg; /* virtual ap create/delete */ struct ieee80211vap* (*ic_vap_create)(struct ieee80211com *,