Date: Sat, 14 Sep 2013 03:39:02 GMT From: ccqin@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r257290 - in soc2013/ccqin/head/sys: dev/ath net80211 Message-ID: <201309140339.r8E3d2b9024590@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ccqin Date: Sat Sep 14 03:39:02 2013 New Revision: 257290 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=257290 Log: Add aggregation support and export ratectl statistics api. * add IEEE80211_RATECTL_INFO_AGGR to indicate aggregation scenario. * add iri_maxaggrsize to enable ratectl algo return max aggregation size to aggregation code. * modify ath to use the aggregation support. * add ieee80211_ratectl_stats() to net80211 ratectl api to print per-vap ratectl stats. * export per-vap ratectl statistics api through sysctl. when ieee80211_ratectl_init() is called, the api is attached. * export per-device ratectl statistics when the ath attach sysctl stuffs. * add some debug options. Modified: soc2013/ccqin/head/sys/dev/ath/if_ath.c soc2013/ccqin/head/sys/dev/ath/if_ath_sysctl.c soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c soc2013/ccqin/head/sys/net80211/ieee80211_freebsd.c soc2013/ccqin/head/sys/net80211/ieee80211_node.c soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.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 Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/dev/ath/if_ath.c Sat Sep 14 03:39:02 2013 (r257290) @@ -4110,6 +4110,7 @@ bf->bf_state.bfs_pktlen, ts->ts_shortretry, ts->ts_longretry, ts->ts_finaltsi, ts->ts_rate); + rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); } ath_tx_default_comp(sc, bf, 0); Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath_sysctl.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/dev/ath/if_ath_sysctl.c Sat Sep 14 03:39:02 2013 (r257290) @@ -71,6 +71,7 @@ #include <net80211/ieee80211_var.h> #include <net80211/ieee80211_regdomain.h> +#include <net80211/ieee80211_ratectl.h> #ifdef IEEE80211_SUPPORT_SUPERG #include <net80211/ieee80211_superg.h> #endif @@ -602,6 +603,28 @@ } #endif /* ATH_DEBUG_ALQ */ +static int +ath_sysctl_ratectl_stats(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + struct ieee80211com *ic = sc->sc_ifp->if_l2com; + struct ieee80211vap *vap; + int error, v; + + v = 0; + error = sysctl_handle_int(oidp, &v, 0, req); + if (error || !req->newptr) + return error; + + printf("\n[%s]: per-device net80211 ratectl statistics\n", + ic->ic_ifp->if_xname); + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { + ieee80211_ratectl_stats(vap); + } + + return 0; +} + void ath_sysctlattach(struct ath_softc *sc) { @@ -792,6 +815,10 @@ #ifdef ATH_DEBUG_ALQ ath_sysctl_alq_attach(sc); #endif + + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "ratectl_stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_ratectl_stats, "I", "per-device net80211 ratectl statistics"); } static int Modified: soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/dev/ath/if_ath_tx.c Sat Sep 14 03:39:02 2013 (r257290) @@ -1437,8 +1437,13 @@ 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; + if (bf->bf_state.bfs_aggr) + rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; + + rc_info->iri_framelen = bf->bf_state.bfs_pktlen; ieee80211_ratectl_rates(ni, rc_info); @@ -1568,7 +1573,8 @@ * frames that must go out - eg management/raw frames. */ bf->bf_state.bfs_txflags |= HAL_TXDESC_CLRDMASK; - + + bf->bf_state.bfs_aggr = 0; /* Setup the descriptor before handoff */ ath_tx_do_ratelookup(sc, bf); ath_tx_calc_duration(sc, bf); @@ -4169,7 +4175,7 @@ "%s: found ratectl mbuf tag.\n", __func__); rc_info = (struct ieee80211_rc_info*)(mtag + 1); } - + rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_rc_info_set(rc_info, 1, (ts->ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, @@ -4581,6 +4587,7 @@ bf_first->bf_state.bfs_pktlen, ts.ts_shortretry, ts.ts_longretry, ts.ts_finaltsi, ts.ts_rate); + rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_tx_complete(ni->ni_vap, ni, rc_info); ATH_TX_LOCK(sc); @@ -4995,6 +5002,7 @@ rc_info = (struct ieee80211_rc_info*)(mtag + 1); } + rc_info->iri_flags |= IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_rc_info_set(rc_info, nframes, nbad, pktlen, ts.ts_shortretry, ts.ts_longretry, @@ -5112,6 +5120,7 @@ rc_info = (struct ieee80211_rc_info*)(mtag + 1); } + rc_info->iri_flags &= ~IEEE80211_RATECTL_INFO_AGGR; ieee80211_ratectl_rc_info_set(rc_info, 1, (ts.ts_status == 0 ? 0 : 1), bf->bf_state.bfs_pktlen, @@ -5335,6 +5344,15 @@ } /* + * If non-aggregate scenario appears, this will be + * turned off. + * + * This flag is used by ath_tx_do_ratelookup() to + * distinguish aggr/non-aggr scenario. + */ + bf->bf_state.bfs_aggr = 1; + + /* * If the packet doesn't fall within the BAW (eg a NULL * data frame), schedule it directly; continue. */ @@ -5577,6 +5595,7 @@ /* Update CLRDMASK just before this frame is queued */ ath_tx_update_clrdmask(sc, tid, bf); + bf->bf_state.bfs_aggr = 0; /* Program descriptors + rate control */ ath_tx_do_ratelookup(sc, bf); ath_tx_calc_duration(sc, bf); Modified: soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c Sat Sep 14 03:39:02 2013 (r257290) @@ -68,8 +68,9 @@ static void amrr_rates(struct ieee80211_node *, struct ieee80211_rc_info *); static void amrr_tx_complete(const struct ieee80211vap *, const struct ieee80211_node *, struct ieee80211_rc_info *); -static void amrr_tx_update(const struct ieee80211vap *vap, +static void amrr_tx_update(const struct ieee80211vap *, const struct ieee80211_node *, void *, void *, void *); +static void amrr_stats(const struct ieee80211vap *); static void amrr_sysctlattach(struct ieee80211vap *, struct sysctl_ctx_list *, struct sysctl_oid *); @@ -89,6 +90,7 @@ .ir_tx_complete = amrr_tx_complete, .ir_tx_update = amrr_tx_update, .ir_setinterval = amrr_setinterval, + .ir_stats = amrr_stats, }; IEEE80211_RATECTL_MODULE(amrr, 1); IEEE80211_RATECTL_ALG(amrr, IEEE80211_RATECTL_AMRR, amrr); @@ -336,20 +338,20 @@ code = ieee80211_ratectl_node_is11n(ni)? MCS(rix) : RATE(rix); rc[1].rix = rt->rateCodeToIndex[code]; } else { - rc[1].rix = 0; + rc[1].rix = rt->rateCodeToIndex[0]; } if (--rix >= 0) { code = ieee80211_ratectl_node_is11n(ni)? MCS(rix) : RATE(rix); rc[2].rix = rt->rateCodeToIndex[code]; } else { - rc[2].rix = 0; + rc[2].rix = rt->rateCodeToIndex[0]; } - if (rix > 0) { + if (rix >= 0) { /* NB: only do this if we didn't already do it above */ code = ieee80211_ratectl_node_is11n(ni)? MCS(0) : RATE(0); rc[3].rix = rt->rateCodeToIndex[code]; } else { - rc[3].rix = 0; + rc[3].rix = rt->rateCodeToIndex[0]; } } else { rc[0].tries = IEEE80211_RATECTL_TXMAXTRY; @@ -357,9 +359,9 @@ rc[1].tries = 0; rc[2].tries = 0; rc[3].tries = 0; - rc[1].rix = 0; - rc[2].rix = 0; - rc[3].rix = 0; + rc[1].rix = rt->rateCodeToIndex[0]; + rc[2].rix = rt->rateCodeToIndex[0]; + rc[3].rix = rt->rateCodeToIndex[0]; } } IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, @@ -418,6 +420,16 @@ __func__, txcnt, success, retrycnt); } +static void +amrr_stats(const struct ieee80211vap *vap) +{ + struct ieee80211_rc_stat * irs = IEEE80211_RATECTL_STAT(vap); + printf("tx count: %d (ok count: %d, fail count: %d)\n" + "retry count: %d (short retry: %d, long retry: %d)\n", + irs->irs_txcnt, irs->irs_txcnt - irs->irs_failcnt, irs->irs_failcnt, + irs->irs_retrycnt, irs->irs_shortretry, irs->irs_longretry); +} + static int amrr_sysctl_interval(SYSCTL_HANDLER_ARGS) { Modified: soc2013/ccqin/head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_freebsd.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/net80211/ieee80211_freebsd.c Sat Sep 14 03:39:02 2013 (r257290) @@ -262,7 +262,7 @@ "driver_caps", CTLFLAG_RW, &vap->iv_caps, 0, "driver capabilities"); #ifdef IEEE80211_DEBUG - ieee80211_debug |= IEEE80211_MSG_RATECTL; + ieee80211_debug |= (IEEE80211_MSG_RATECTL|IEEE80211_MSG_NODE|IEEE80211_MSG_SCAN); vap->iv_debug = ieee80211_debug; if_printf(ifp, "%s: iv_debug=0x%08x\n", __func__, vap->iv_debug); SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, Modified: soc2013/ccqin/head/sys/net80211/ieee80211_node.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_node.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/net80211/ieee80211_node.c Sat Sep 14 03:39:02 2013 (r257290) @@ -1074,6 +1074,8 @@ ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); free(ni, M_80211_NODE); + IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_RATECTL, + "%s: after free(ni, M_80211_NODE).\n", __func__); } static void @@ -1733,7 +1735,7 @@ * to use ni_ic below to reclaim resources. */ #if 0 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_NODE, "%s %p<%s> in %s table\n", __func__, ni, ether_sprintf(ni->ni_macaddr), nt != NULL ? nt->nt_name : "<gone>"); Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c Sat Sep 14 03:39:02 2013 (r257290) @@ -100,12 +100,33 @@ ratectls[type] = NULL; } +static int +ratectl_sysctl_stats(SYSCTL_HANDLER_ARGS) +{ + struct ieee80211vap *vap = arg1; + int error, v; + + v = 0; + error = sysctl_handle_int(oidp, &v, 0, req); + if (error || !req->newptr) + return error; + + ieee80211_ratectl_stats(vap); + return 0; +} + void ieee80211_ratectl_init(struct ieee80211vap *vap, uint32_t capabilities) { if (vap->iv_rate == ratectls[IEEE80211_RATECTL_NONE]) ieee80211_ratectl_set(vap, IEEE80211_RATECTL_AMRR); vap->iv_rate->ir_init(vap, capabilities); + + SYSCTL_ADD_PROC(vap->iv_sysctl, SYSCTL_CHILDREN(vap->iv_oid), + OID_AUTO, "ratectl_stats", CTLTYPE_INT | CTLFLAG_RW, + vap, 0, ratectl_sysctl_stats, "I", + "per-vap net80211 ratectl statistics"); + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, "%s: ratectl initialized. caps=0x%08x\n", __func__, capabilities); Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Fri Sep 13 23:10:53 2013 (r257289) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Sat Sep 14 03:39:02 2013 (r257290) @@ -79,21 +79,23 @@ struct ieee80211_rc_info { struct ieee80211_rc_series iri_rc[IEEE80211_RATECTL_NUM]; uint32_t iri_framelen; - uint16_t iri_flags; /* for now, just records short preamble */ + uint16_t iri_flags; /* See below */ + uint16_t iri_maxaggrsize; /* Maximum aggregate size */ /* TX info */ - uint8_t iri_txcnt; /* TX count */ - uint8_t iri_okcnt; /* TX ok with or without retry */ - uint8_t iri_failcnt; /* TX retry-fail count */ - uint8_t iri_retrycnt; /* TX retry count */ + uint8_t iri_txcnt; /* TX count */ + uint8_t iri_failcnt; /* TX retry-fail count */ + uint8_t iri_okcnt; /* TX ok with or without retry */ + uint8_t iri_retrycnt; /* TX retry count */ uint8_t iri_shortretry; uint8_t iri_longretry; uint8_t iri_finaltsi; - uint8_t iri_txrate; /* hw tx rate */ + uint8_t iri_txrate; /* HW tx rate */ }; /* ieee80211_rc_info flags */ #define IEEE80211_RATECTL_INFO_SP 0x01 /* short preamble */ +#define IEEE80211_RATECTL_INFO_AGGR 0x02 /* aggregation scenario */ #define NET80211_TAG_RATECTL 1 /* net80211 ratectl state */ @@ -138,6 +140,7 @@ const struct ieee80211_node *, void *, void *, void *); void (*ir_setinterval)(const struct ieee80211vap *, int); + void (*ir_stats)(const struct ieee80211vap *); }; void ieee80211_ratectl_register(int, const struct ieee80211_ratectl *); @@ -161,7 +164,7 @@ const struct ieee80211vap *vap = ni->ni_vap; vap->iv_rate->ir_node_init(ni); - IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_RATECTL, + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, "%s: net80211 ratectl node inited.\n", __func__); } @@ -171,6 +174,8 @@ const struct ieee80211vap *vap = ni->ni_vap; vap->iv_rate->ir_node_deinit(ni); + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, + "%s: net80211 ratectl node deinited.\n", __func__); } static int __inline @@ -186,6 +191,13 @@ { const struct ieee80211vap *vap = ni->ni_vap; + if (rc_info->iri_flags & IEEE80211_RATECTL_INFO_AGGR) + rc_info->iri_framelen = 0; + + IEEE80211_DPRINTF(vap, IEEE80211_MSG_RATECTL, + "%s: find rate sets for %saggregation scenario.\n", __func__, + (rc_info->iri_flags & IEEE80211_RATECTL_INFO_AGGR)? "" : "non-"); + vap->iv_rate->ir_rates(ni, rc_info); ieee80211_ratectl_complete_rcflags(ni, rc_info); } @@ -214,6 +226,16 @@ vap->iv_rate->ir_setinterval(vap, msecs); } +static void __inline +ieee80211_ratectl_stats(const struct ieee80211vap *vap) +{ + printf("\n[%s]: net80211 ratectl statistics (%s)\n", + vap->iv_ifp->if_xname, vap->iv_rate->ir_name); + if (vap->iv_rate->ir_stats == NULL) + return; + vap->iv_rate->ir_stats(vap); +} + static int __inline ieee80211_ratectl_hascap_cw40(const struct ieee80211_node *ni) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309140339.r8E3d2b9024590>
