From owner-svn-soc-all@FreeBSD.ORG Thu Sep 5 08:29:49 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EA9AF7A6 for ; Thu, 5 Sep 2013 08:29:48 +0000 (UTC) (envelope-from ccqin@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CAF202AC2 for ; Thu, 5 Sep 2013 08:29:48 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r858TmpS072750 for ; Thu, 5 Sep 2013 08:29:48 GMT (envelope-from ccqin@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r858TmB2072745 for svn-soc-all@FreeBSD.org; Thu, 5 Sep 2013 08:29:48 GMT (envelope-from ccqin@FreeBSD.org) Date: Thu, 5 Sep 2013 08:29:48 GMT Message-Id: <201309050829.r858TmB2072745@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to ccqin@FreeBSD.org using -f From: ccqin@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r256936 - in soc2013/ccqin/head/sys: dev/ath net80211 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 08:29:49 -0000 Author: ccqin Date: Thu Sep 5 08:29:48 2013 New Revision: 256936 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256936 Log: add net80211 ratectl state as a mbuf tag. * add NET80211_TAG_RATECTL * modify ath to use the mbuf tag to do rate control. Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c soc2013/ccqin/head/sys/dev/ath/if_ath_tx_ht.c soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath.c Thu Sep 5 07:13:08 2013 (r256935) +++ soc2013/ccqin/head/sys/dev/ath/if_ath.c Thu Sep 5 08:29:48 2013 (r256936) @@ -4054,6 +4054,8 @@ { struct ieee80211_node *ni = bf->bf_node; struct ath_node *an = NULL; + struct ieee80211_rc_info *rc_info = NULL; + struct m_tag *mtag; ATH_TX_UNLOCK_ASSERT(sc); ATH_TXQ_UNLOCK_ASSERT(txq); @@ -4080,17 +4082,23 @@ * XXX assume this isn't an aggregate * frame. */ +#if 0 ath_tx_update_ratectrl(sc, ni, bf->bf_state.bfs_rc, ts, bf->bf_state.bfs_pktlen, 1, (ts->ts_status == 0 ? 0 : 1)); - - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - ieee80211_ratectl_rc_info_set(rc_info, - 1, (ts->ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, - ts->ts_shortretry, ts->ts_longretry, - ts->ts_finaltsi, ts->ts_rate); - ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); +#endif + mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + if (NULL != mtag) { + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + ieee80211_ratectl_rc_info_set(rc_info, + 1, (ts->ts_status == 0 ? 0 : 1), + bf->bf_state.bfs_pktlen, + ts->ts_shortretry, ts->ts_longretry, + ts->ts_finaltsi, ts->ts_rate); + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + } } ath_tx_default_comp(sc, bf, 0); } else Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Thu Sep 5 07:13:08 2013 (r256935) +++ soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Thu Sep 5 08:29:48 2013 (r256936) @@ -1389,6 +1389,10 @@ static void ath_tx_do_ratelookup(struct ath_softc *sc, struct ath_buf *bf) { + struct ieee80211_node *ni = bf->bf_node; + struct ieee80211_rc_info *rc_info = NULL; + struct ieee80211_rc_series *rc = NULL; + struct m_tag *mtag; uint8_t rate, rix; int try0; @@ -1412,16 +1416,29 @@ bf->bf_state.bfs_rc); ATH_NODE_UNLOCK(ATH_NODE(bf->bf_node)); #endif + /* net80211 ratectl */ - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - struct ieee80211_rc_series *rc = rc_info->iri_rc; - struct ieee80211_node *ni = bf->bf_node; + mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + if (NULL == mtag) { + mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_RATECTL, + sizeof(struct ieee80211_rc_info), M_NOWAIT); + if (NULL == mtag) + return; + /* XXX need some msg out here.*/ + } + + rc_info = (struct ieee80211_rc_series*)(mtag + 1); + rc = rc_info->iri_rc; + bzero(rc_info, sizeof(rc_info)); if (bf->bf_state.bfs_shpream) rc_info->iri_flags |= IEEE80211_RATECTL_INFO_SP; ieee80211_ratectl_rates(ni, rc_info); + m_tag_prepend(bf->bf_m, mtag); + rix = rc[0].rix; try0 = rc[0].tries; rate = ni->ni_txrate; @@ -4074,6 +4091,8 @@ int tid = bf->bf_state.bfs_tid; struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status *ts = &bf->bf_status.ds_txstat; + struct ieee80211_rc_info *rc_info = NULL; + struct m_tag *mtag; /* The TID state is protected behind the TXQ lock */ ATH_TX_LOCK(sc); @@ -4125,16 +4144,22 @@ */ if (fail == 0 && ((bf->bf_state.bfs_txflags & HAL_TXDESC_NOACK) == 0)) { +#if 0 ath_tx_update_ratectrl(sc, ni, bf->bf_state.bfs_rc, ts, bf->bf_state.bfs_pktlen, 1, (ts->ts_status == 0) ? 0 : 1); - - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - ieee80211_ratectl_rc_info_set(rc_info, - 1, (ts->ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, - ts->ts_shortretry, ts->ts_longretry, - ts->ts_finaltsi, ts->ts_rate); - ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); +#endif + mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + if (NULL != mtag) { + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + ieee80211_ratectl_rc_info_set(rc_info, + 1, (ts->ts_status == 0 ? 0 : 1), + bf->bf_state.bfs_pktlen, + ts->ts_shortretry, ts->ts_longretry, + ts->ts_finaltsi, ts->ts_rate); + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + } } ath_tx_default_comp(sc, bf, fail); @@ -4500,6 +4525,9 @@ int drops = 0; struct ieee80211_tx_ampdu *tap; ath_bufhead bf_cq; + struct ath_tx_status ts = bf_first->bf_status.ds_txstat; + struct ieee80211_rc_info *rc_info = NULL; + struct m_tag *mtag; TAILQ_INIT(&bf_q); TAILQ_INIT(&bf_cq); @@ -4510,19 +4538,27 @@ * XXX use the length in the first frame in the series; * XXX just so things are consistent for now. */ +#if 0 ath_tx_update_ratectrl(sc, ni, bf_first->bf_state.bfs_rc, &bf_first->bf_status.ds_txstat, bf_first->bf_state.bfs_pktlen, bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes); +#endif - struct ath_tx_status ts = bf_first->bf_status.ds_txstat; - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf_first->bf_m); - ieee80211_ratectl_rc_info_set(rc_info, - bf_first->bf_state.bfs_nframes, bf_first->bf_state.bfs_nframes, - bf_first->bf_state.bfs_pktlen, - ts.ts_shortretry, ts.ts_longretry, - ts.ts_finaltsi, ts.ts_rate); - ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + + if (NULL != mtag) { + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + ieee80211_ratectl_rc_info_set(rc_info, + bf_first->bf_state.bfs_nframes, + bf_first->bf_state.bfs_nframes, + bf_first->bf_state.bfs_pktlen, + ts.ts_shortretry, ts.ts_longretry, + ts.ts_finaltsi, ts.ts_rate); + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + } + ATH_TX_LOCK(sc); tap = ath_tx_get_tx_tid(an, tid->tid); sc->sc_stats.ast_tx_aggr_failall++; @@ -4659,8 +4695,12 @@ int nframes = 0, nbad = 0, nf; int pktlen; /* XXX there's too much on the stack? */ +#if 0 struct ath_rc_series rc[ATH_RC_NUM]; +#endif int txseq; + struct ieee80211_rc_info *rc_info = NULL; + struct m_tag *mtag; DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: called; hwq_depth=%d\n", __func__, atid->hwq_depth); @@ -4781,7 +4821,7 @@ isaggr = bf_first->bf_state.bfs_aggr; ba[0] = ts.ts_ba_low; ba[1] = ts.ts_ba_high; - +#if 0 /* * Copy the TX completion status and the rate control * series from the first descriptor, as it may be freed @@ -4789,7 +4829,14 @@ * into things. */ memcpy(rc, bf_first->bf_state.bfs_rc, sizeof(rc)); - +#endif + /* + * Get the net80211 ratectl mtag here, as bf_first will + * be set to NULL later. + */ + mtag = m_tag_locate(bf_first->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, "%s: txa_start=%d, tx_ok=%d, status=%.8x, flags=%.8x, " "isaggr=%d, seq_st=%d, hasba=%d, ba=%.8x, %.8x\n", @@ -4906,16 +4953,19 @@ * control code. */ if (fail == 0) - { + { +#if 0 ath_tx_update_ratectrl(sc, ni, rc, &ts, pktlen, nframes, nbad); - - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - ieee80211_ratectl_rc_info_set(rc_info, - nframes, nbad, pktlen, - ts.ts_shortretry, ts.ts_longretry, - ts.ts_finaltsi, ts.ts_rate); - ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); +#endif + if (NULL != mtag) { + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + ieee80211_ratectl_rc_info_set(rc_info, + nframes, nbad, pktlen, + ts.ts_shortretry, ts.ts_longretry, + ts.ts_finaltsi, ts.ts_rate); + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + } } /* @@ -4990,6 +5040,8 @@ struct ath_tid *atid = &an->an_tid[tid]; struct ath_tx_status ts; int drops = 0; + struct ieee80211_rc_info *rc_info = NULL; + struct m_tag *mtag; /* * Take a copy of this; filtering/cloning the frame may free the @@ -5004,18 +5056,25 @@ * Do it outside of the TXQ lock. */ if (fail == 0 && ((bf->bf_state.bfs_txflags & HAL_TXDESC_NOACK) == 0)) - { + { +#if 0 ath_tx_update_ratectrl(sc, ni, bf->bf_state.bfs_rc, &bf->bf_status.ds_txstat, bf->bf_state.bfs_pktlen, 1, (ts.ts_status == 0) ? 0 : 1); - - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - ieee80211_ratectl_rc_info_set(rc_info, - 1, (ts.ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, - ts.ts_shortretry, ts.ts_longretry, - ts.ts_finaltsi, ts.ts_rate); - ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); +#endif + mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + + if (NULL != mtag) { + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + ieee80211_ratectl_rc_info_set(rc_info, + 1, (ts.ts_status == 0 ? 0 : 1), + bf->bf_state.bfs_pktlen, + ts.ts_shortretry, ts.ts_longretry, + ts.ts_finaltsi, ts.ts_rate); + ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); + } } /* * This is called early so atid->hwq_depth can be tracked. Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 5 07:13:08 2013 (r256935) +++ soc2013/ccqin/head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 5 08:29:48 2013 (r256936) @@ -227,11 +227,20 @@ // struct ieee80211com *ic = ni->ni_ic; const HAL_RATE_TABLE *rt = sc->sc_currates; struct ath_rc_series *ath_rc = bf->bf_state.bfs_rc; - struct ieee80211_rc_info *rc_info = IEEE80211_RATECTL_INFO(bf->bf_m); - struct ieee80211_rc_series *rc = rc_info->iri_rc; + struct ieee80211_rc_info *rc_info = NULL; + struct ieee80211_rc_series *rc = NULL; + struct m_tag *mtag; uint8_t rate; int i; + mtag = m_tag_locate(bf->bf_m, MTAG_ABI_NET80211, + NET80211_TAG_RATECTL, NULL); + if (NULL == mtag) + return; + + rc_info = (struct ieee80211_rc_info*)(mtag + 1); + rc = rc_info->iri_rc; + for (i = 0; i < IEEE80211_RATECTL_NUM; i++) { if (rc[i].tries == 0) continue; @@ -248,6 +257,10 @@ ath_rc[i].ratecode = rc[i].ratecode; ath_rc[i].tx_power_cap = rc[i].tx_power_cap; ath_rc[i].max4msframelen = rc[i].max4msframelen; + + DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR, + "%s: i=%d, rate=0x%x, flags=0x%x, max4ms=%d\n", + __func__, i, rate, rc[i].flags, rc[i].max4msframelen); } #if 0 Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Thu Sep 5 07:13:08 2013 (r256935) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Thu Sep 5 08:29:48 2013 (r256936) @@ -95,7 +95,7 @@ /* ieee80211_rc_info flags */ #define IEEE80211_RATECTL_INFO_SP 0x01 /* short preamble */ -#define IEEE80211_RATECTL_INFO(_m) ((struct ieee80211_rc_info *)(_m)->m_ccb) +#define NET80211_TAG_RATECTL 1 /* net80211 ratectl state */ /* * net80211 ratectl statistics.