socsvn commit: r256936 - in soc2013/ccqin/head/sys: dev/ath net80211
ccqin at FreeBSD.org
ccqin at FreeBSD.org
Thu Sep 5 08:29:49 UTC 2013
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.
More information about the svn-soc-all
mailing list