Date: Sun, 25 Aug 2013 09:37:15 GMT From: ccqin@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r256474 - in soc2013/ccqin/head/sys: dev/bwi dev/bwn dev/iwn dev/ral dev/usb/wlan dev/wpi net80211 Message-ID: <201308250937.r7P9bF0v031600@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ccqin Date: Sun Aug 25 09:37:15 2013 New Revision: 256474 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256474 Log: Add per vap ratectl statistics api and put capabilities into it. * add struct ieee80211_rc_stat to track per vap ratectl statistics. * change the interface of __init__ and __node_init__. update the callers. * add ieee80211_ratectl_update_stat() to update the per vap rc statistics. it called by __complete__ of rc algo. * drop struct ieee80211_ratectl_node and port irn_capabilities to irs_capabilities in struct ieee80211_rc_stat. update the rc api and rc algorithms (amrr and sample), update micros that check cap using the capabilies field. Modified: soc2013/ccqin/head/sys/dev/bwi/if_bwi.c soc2013/ccqin/head/sys/dev/bwn/if_bwn.c soc2013/ccqin/head/sys/dev/iwn/if_iwn.c soc2013/ccqin/head/sys/dev/ral/rt2560.c soc2013/ccqin/head/sys/dev/ral/rt2661.c soc2013/ccqin/head/sys/dev/ral/rt2860.c soc2013/ccqin/head/sys/dev/usb/wlan/if_rum.c soc2013/ccqin/head/sys/dev/usb/wlan/if_run.c soc2013/ccqin/head/sys/dev/usb/wlan/if_ural.c soc2013/ccqin/head/sys/dev/usb/wlan/if_zyd.c soc2013/ccqin/head/sys/dev/wpi/if_wpi.c soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c soc2013/ccqin/head/sys/net80211/ieee80211_amrr.h soc2013/ccqin/head/sys/net80211/ieee80211_node.c soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.c soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.h soc2013/ccqin/head/sys/net80211/ieee80211_sta.c Modified: soc2013/ccqin/head/sys/dev/bwi/if_bwi.c ============================================================================== --- soc2013/ccqin/head/sys/dev/bwi/if_bwi.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/bwi/if_bwi.c Sun Aug 25 09:37:15 2013 (r256474) @@ -617,7 +617,8 @@ #if 0 vap->iv_update_beacon = bwi_beacon_update; #endif - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status); Modified: soc2013/ccqin/head/sys/dev/bwn/if_bwn.c ============================================================================== --- soc2013/ccqin/head/sys/dev/bwn/if_bwn.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/bwn/if_bwn.c Sun Aug 25 09:37:15 2013 (r256474) @@ -2970,7 +2970,8 @@ /* override max aid so sta's cannot assoc when we're out of sta id's */ vap->iv_max_aid = BWN_STAID_MAX; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, Modified: soc2013/ccqin/head/sys/dev/iwn/if_iwn.c ============================================================================== --- soc2013/ccqin/head/sys/dev/iwn/if_iwn.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/iwn/if_iwn.c Sun Aug 25 09:37:15 2013 (r256474) @@ -876,7 +876,8 @@ ivp->iv_newstate = vap->iv_newstate; vap->iv_newstate = iwn_newstate; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* Complete setup. */ ieee80211_vap_attach(vap, iwn_media_change, ieee80211_media_status); ic->ic_opmode = opmode; Modified: soc2013/ccqin/head/sys/dev/ral/rt2560.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ral/rt2560.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/ral/rt2560.c Sun Aug 25 09:37:15 2013 (r256474) @@ -426,7 +426,8 @@ vap->iv_newstate = rt2560_newstate; vap->iv_update_beacon = rt2560_beacon_update; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); if (TAILQ_FIRST(&ic->ic_vaps) == vap) Modified: soc2013/ccqin/head/sys/dev/ral/rt2661.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ral/rt2661.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/ral/rt2661.c Sun Aug 25 09:37:15 2013 (r256474) @@ -423,7 +423,8 @@ vap->iv_update_beacon = rt2661_beacon_update; #endif - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); if (TAILQ_FIRST(&ic->ic_vaps) == vap) Modified: soc2013/ccqin/head/sys/dev/ral/rt2860.c ============================================================================== --- soc2013/ccqin/head/sys/dev/ral/rt2860.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/ral/rt2860.c Sun Aug 25 09:37:15 2013 (r256474) @@ -484,7 +484,8 @@ /* HW supports up to 255 STAs (0-254) in HostAP and IBSS modes */ vap->iv_max_aid = min(IEEE80211_AID_MAX, RT2860_WCID_MAX); - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); if (TAILQ_FIRST(&ic->ic_vaps) == vap) Modified: soc2013/ccqin/head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- soc2013/ccqin/head/sys/dev/usb/wlan/if_rum.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/usb/wlan/if_rum.c Sun Aug 25 09:37:15 2013 (r256474) @@ -613,7 +613,8 @@ usb_callout_init_mtx(&rvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&rvp->ratectl_task, 0, rum_ratectl_task, rvp); - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); Modified: soc2013/ccqin/head/sys/dev/usb/wlan/if_run.c ============================================================================== --- soc2013/ccqin/head/sys/dev/usb/wlan/if_run.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/usb/wlan/if_run.c Sun Aug 25 09:37:15 2013 (r256474) @@ -820,7 +820,8 @@ rvp->newstate = vap->iv_newstate; vap->iv_newstate = run_newstate; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); /* complete setup */ Modified: soc2013/ccqin/head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- soc2013/ccqin/head/sys/dev/usb/wlan/if_ural.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/usb/wlan/if_ural.c Sun Aug 25 09:37:15 2013 (r256474) @@ -598,7 +598,8 @@ usb_callout_init_mtx(&uvp->ratectl_ch, &sc->sc_mtx, 0); TASK_INIT(&uvp->ratectl_task, 0, ural_ratectl_task, uvp); - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); /* complete setup */ Modified: soc2013/ccqin/head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- soc2013/ccqin/head/sys/dev/usb/wlan/if_zyd.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/usb/wlan/if_zyd.c Sun Aug 25 09:37:15 2013 (r256474) @@ -496,7 +496,8 @@ zvp->newstate = vap->iv_newstate; vap->iv_newstate = zyd_newstate; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); ieee80211_ratectl_setinterval(vap, 1000 /* 1 sec */); /* complete setup */ Modified: soc2013/ccqin/head/sys/dev/wpi/if_wpi.c ============================================================================== --- soc2013/ccqin/head/sys/dev/wpi/if_wpi.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/dev/wpi/if_wpi.c Sun Aug 25 09:37:15 2013 (r256474) @@ -782,7 +782,8 @@ wvp->newstate = vap->iv_newstate; vap->iv_newstate = wpi_newstate; - ieee80211_ratectl_init(vap); + /* XXX TODO fill the cap */ + ieee80211_ratectl_init(vap, 0); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); ic->ic_opmode = opmode; Modified: soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_amrr.c Sun Aug 25 09:37:15 2013 (r256474) @@ -58,9 +58,9 @@ ((amn)->amn_txcnt > 10) static void amrr_setinterval(const struct ieee80211vap *, int); -static void amrr_init(struct ieee80211vap *); +static void amrr_init(struct ieee80211vap *, uint32_t); static void amrr_deinit(struct ieee80211vap *); -static void amrr_node_init(struct ieee80211_node *, uint32_t); +static void amrr_node_init(struct ieee80211_node *); static void amrr_node_deinit(struct ieee80211_node *); static int amrr_update(struct ieee80211_amrr *, struct ieee80211_amrr_node *, struct ieee80211_node *); @@ -105,7 +105,7 @@ } static void -amrr_init(struct ieee80211vap *vap) +amrr_init(struct ieee80211vap *vap, uint32_t capabilities) { struct ieee80211_amrr *amrr; @@ -117,6 +117,10 @@ if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n"); return; } + + struct ieee80211_rc_stat * irs = IEEE80211_RATECTL_STAT(vap); + irs->irs_capabilities = capabilities; + amrr->amrr_min_success_threshold = IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD; amrr->amrr_max_success_threshold = IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD; amrr_setinterval(vap, 500 /* ms */); @@ -130,7 +134,7 @@ } static void -amrr_node_init(struct ieee80211_node *ni, uint32_t capabilities) +amrr_node_init(struct ieee80211_node *ni) { const struct ieee80211_rateset *rs = NULL; struct ieee80211vap *vap = ni->ni_vap; @@ -149,9 +153,6 @@ } else amn = ni->ni_rctls; - struct ieee80211_ratectl_node *irn = IEEE80211_RATECTL_NODE(ni); - irn->irn_capabilities = capabilities; - amn->amn_amrr = amrr; amn->amn_success = 0; amn->amn_recovery = 0; @@ -310,11 +311,17 @@ static void amrr_tx_complete(const struct ieee80211vap *vap, const struct ieee80211_node *ni, int ok, - void *arg1, void *arg2 __unused) + void *arg1, void *arg2) { struct ieee80211_amrr_node *amn = ni->ni_rctls; int retries = *(int *)arg1; + /* XXX need to change arg2 to pointer of ieee80211_rc_info */ + struct ieee80211_rc_info *rc_info = (struct ieee80211_rc_info*)arg2; + + /* update per vap statistics */ + ieee80211_ratectl_update_stat(vap, rc_info); + amn->amn_txcnt++; if (ok) amn->amn_success++; Modified: soc2013/ccqin/head/sys/net80211/ieee80211_amrr.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_amrr.h Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_amrr.h Sun Aug 25 09:37:15 2013 (r256474) @@ -36,6 +36,7 @@ struct ieee80211vap; struct ieee80211_amrr { + struct ieee80211_rc_stat amrr_stat; u_int amrr_min_success_threshold; u_int amrr_max_success_threshold; int amrr_interval; /* update interval (ticks) */ @@ -48,7 +49,6 @@ * Rate control state for a given node. */ struct ieee80211_amrr_node { - struct ieee80211_ratectl_node amn_node; struct ieee80211_amrr *amn_amrr;/* backpointer */ int amn_rix; /* current rate index */ int amn_ticks; /* time of last update */ Modified: soc2013/ccqin/head/sys/net80211/ieee80211_node.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_node.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_node.c Sun Aug 25 09:37:15 2013 (r256474) @@ -846,8 +846,7 @@ /* XXX QoS? Difficult given that WME config is specific to a master */ ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); return ieee80211_sta_join1(ieee80211_ref_node(ni)); } @@ -1189,8 +1188,7 @@ IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, "%s: inact_reload %u", __func__, ni->ni_inact_reload); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); return ni; } @@ -1230,8 +1228,7 @@ /* XXX optimize away */ ieee80211_psq_init(&ni->ni_psq, "unknown"); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); } else { /* XXX msg */ vap->iv_stats.is_rx_nodealloc++; @@ -1460,8 +1457,7 @@ #endif } ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -1535,8 +1531,7 @@ ieee80211_setup_basic_htrates(ni, ni->ni_ies.htinfo_ie); ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); } } @@ -1563,8 +1558,7 @@ if (ieee80211_iserp_rateset(&ni->ni_rates)) ni->ni_flags |= IEEE80211_NODE_ERP; ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, 1); /* XXX not right for 802.1x/WPA */ @@ -2534,8 +2528,7 @@ ); ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); /* give driver a chance to setup state like ni_txrate */ if (ic->ic_newassoc != NULL) ic->ic_newassoc(ni, newassoc); Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.c Sun Aug 25 09:37:15 2013 (r256474) @@ -50,6 +50,13 @@ MALLOC_DEFINE(M_80211_RATECTL, "80211ratectl", "802.11 rate control"); +enum { + MCS_HT20, + MCS_HT20_SGI, + MCS_HT40, + MCS_HT40_SGI, +}; + int max_4ms_framelen[4][32] = { [MCS_HT20] = { 3212, 6432, 9648, 12864, 19300, 25736, 28952, 32172, @@ -94,11 +101,11 @@ } void -ieee80211_ratectl_init(struct ieee80211vap *vap) +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); + vap->iv_rate->ir_init(vap, capabilities); } void @@ -123,8 +130,9 @@ ieee80211_ratectl_complete_rcflags(struct ieee80211_node *ni, struct ieee80211_rc_info *rc_info) { + struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_rate_table * rt = NULL; - struct ieee80211_rc_series *rc = rc_info->ri_rc; + struct ieee80211_rc_series *rc = rc_info->iri_rc; /* int shortPreamble = rc_info->ri_shortPreamble; */ uint8_t rate; int i; @@ -135,7 +143,7 @@ * If enable rts/cts and is pre-802.11n, blank tries 1, 2, 3 */ - if (! IEEE80211_RATECTL_HASCAP_MRRPROT(ni)) + if (! IEEE80211_RATECTL_HASCAP_MRRPROT(vap)) { for (i = 1; i < IEEE80211_RATECTL_NUM; i++) { Modified: soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_ratectl.h Sun Aug 25 09:37:15 2013 (r256474) @@ -63,13 +63,6 @@ #define HT_RC_2_MCS(_rc) ((_rc) & 0x7f) #define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) -enum { - MCS_HT20, - MCS_HT20_SGI, - MCS_HT40, - MCS_HT40_SGI, -}; - extern int max_4ms_framelen[4][32]; struct ieee80211_rc_series { @@ -81,31 +74,54 @@ uint16_t max4msframelen; }; -/* net80211 rate control infomation */ struct ieee80211_rc_info { - struct ieee80211_rc_series ri_rc[IEEE80211_RATECTL_NUM]; - int ri_framelen; - int ri_shortPreamble; + struct ieee80211_rc_series iri_rc[IEEE80211_RATECTL_NUM]; + int iri_framelen; + int iri_shortPreamble; /* TX info */ - int ri_success; /* TX success or not */ - int ri_okcnt; /* TX ok with or without retry */ - int ri_failcnt; /* TX retry-fail count */ - int ri_txcnt; /* TX count */ - int ri_retrycnt; /* TX retry count */ - int ri_shortretry; - int ri_longretry; - int ri_finaltsi; - int ri_txrate; /* hw tx rate */ + int iri_success; /* TX success or not */ + int iri_okcnt; /* TX ok with or without retry */ + int iri_failcnt; /* TX retry-fail count */ + int iri_txcnt; /* TX count */ + int iri_retrycnt; /* TX retry count */ + int iri_shortretry; + int iri_longretry; + int iri_finaltsi; + int iri_txrate; /* hw tx rate */ +}; + +/* net80211 ratectl statistics. + * per vap ratectl seeting must start with this common state + */ +struct ieee80211_rc_stat { + uint32_t irs_capabilities; /* hardware capabilities offered to rc */ + + /* ratectl statistics */ + uint32_t irs_txcnt; + uint32_t irs_failcnt + uint32_t irs_retrycnt; + uint32_t irs_shortretry; + uint32_t irs_longretry; }; +#define IEEE80211_RATECTL_STAT(_vap) \ + ((struct ieee80211_rc_stat *)((_vap)->iv_rs)) + +#define IEEE80211_RATECTL_HASCAP_MRR(_vap) \ + (IEEE80211_RATECTL_STAT(_vap)->irs_capabilities & IEEE80211_RATECTL_CAP_MRR) +#define IEEE80211_RATECTL_HASCAP_MRRPROT(_vap) \ + (IEEE80211_RATECTL_STAT(_vap)->irs_capabilities & IEEE80211_RATECTL_CAP_MRRPROT) +#define IEEE80211_RATECTL_HASCAP_MULTXCHAIN(_vap) \ + (IEEE80211_RATECTL_STAT(_vap)->irs_capabilities & IEEE80211_RATECTL_CAP_MULTXCHAIN) + struct ieee80211_ratectl { const char *ir_name; int (*ir_attach)(const struct ieee80211vap *); void (*ir_detach)(const struct ieee80211vap *); - void (*ir_init)(struct ieee80211vap *); + void (*ir_init)(struct ieee80211vap *, uint32_t); void (*ir_deinit)(struct ieee80211vap *); - void (*ir_node_init)(struct ieee80211_node *, uint32_t); + void (*ir_node_init)(struct ieee80211_node *); void (*ir_node_deinit)(struct ieee80211_node *); int (*ir_rate)(struct ieee80211_node *, void *, uint32_t); void (*ir_rates)(struct ieee80211_node *, struct ieee80211_rc_info *); @@ -118,27 +134,12 @@ void (*ir_setinterval)(const struct ieee80211vap *, int); }; -/* per ratectl node must start with this common state */ -struct ieee80211_ratectl_node { - uint32_t irn_capabilities; /* hardware capabilities offered to rc */ -}; - -#define IEEE80211_RATECTL_NODE(_ni) \ - ((struct ieee80211_ratectl_node *)((_ni)->ni_rctls)) - -#define IEEE80211_RATECTL_HASCAP_MRR(_ni) \ - (IEEE80211_RATECTL_NODE(_ni)->irn_capabilities & IEEE80211_RATECTL_CAP_MRR) -#define IEEE80211_RATECTL_HASCAP_MRRPROT(_ni) \ - (IEEE80211_RATECTL_NODE(_ni)->irn_capabilities & IEEE80211_RATECTL_CAP_MRRPROT) -#define IEEE80211_RATECTL_HASCAP_MULTXCHAIN(_ni) \ - (IEEE80211_RATECTL_NODE(_ni)->irn_capabilities & IEEE80211_RATECTL_CAP_MULTXCHAIN) - void ieee80211_ratectl_register(int, const struct ieee80211_ratectl *); void ieee80211_ratectl_unregister(int); -void ieee80211_ratectl_init(struct ieee80211vap *); +void ieee80211_ratectl_init(struct ieee80211vap *, uint32_t); void ieee80211_ratectl_set(struct ieee80211vap *, int); void ieee80211_ratectl_complete_rcflags(struct ieee80211_node *, - struct ieee80211_rc_info*); + struct ieee80211_rc_info*); MALLOC_DECLARE(M_80211_RATECTL); @@ -149,11 +150,11 @@ } static void __inline -ieee80211_ratectl_node_init(struct ieee80211_node *ni, uint32_t capabilities) +ieee80211_ratectl_node_init(struct ieee80211_node *ni) { const struct ieee80211vap *vap = ni->ni_vap; - vap->iv_rate->ir_node_init(ni, capabilities); + vap->iv_rate->ir_node_init(ni); } static void __inline @@ -238,7 +239,7 @@ { return IS_VAP_HT(vap) && (vap->iv_htcaps & IEEE80211_HTCAP_TXSTBC) && (ni->ni_htcap & IEEE80211_HTCAP_RXSTBC_1STREAM) && - IEEE80211_RATECTL_HASCAP_MULTXCHAIN(ni); + IEEE80211_RATECTL_HASCAP_MULTXCHAIN(vap); } static int __inline @@ -259,4 +260,16 @@ &ni->ni_rates; } +static void __inline +ieee80211_ratectl_update_stat(struct ieee80211vap *vap, + const struct ieee80211_rc_info *rc_info) +{ + struct ieee80211_rc_stat * irs = IEEE80211_RATECTL_STAT(vap); + irs->irs_txcnt += rc_info->iri_txcnt; + irs->irs_failcnt += rc_info->iri_failcnt; + irs->irs_retrycnt += rc_info->iri_retrycnt; + irs->irs_shortretry += rc_info->iri_shortretry; + irs->irs_longretry += rc_info->iri_longretry; +} + #endif Modified: soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.c Sun Aug 25 09:37:15 2013 (r256474) @@ -50,7 +50,7 @@ #include <net80211/ieee80211_rc_sample.h> #include <net80211/ieee80211_rc_sample_txsched.h> -static void sample_init(struct ieee80211vap *); +static void sample_init(struct ieee80211vap *, uint32_t); static void sample_deinit(struct ieee80211vap *); static void sample_node_init(struct ieee80211_node *); static void sample_node_deinit(struct ieee80211_node *); @@ -83,7 +83,7 @@ IEEE80211_RATECTL_ALG(sample, IEEE80211_RATECTL_SAMPLE, sample); static void -sample_init(struct ieee80211vap *vap) +sample_init(struct ieee80211vap *vap, uint32_t capabilities) { struct ieee80211_sample *sample; @@ -95,6 +95,10 @@ if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n"); return; } + + struct ieee80211_rc_stat * irs = IEEE80211_RATECTL_STAT(vap); + irs->irs_capabilities = capabilities; + sample->sample_smoothing_rate = 75; /* ewma percentage ([0..99]) */ sample->sample_smoothing_minpackets = 100 / (100 - sample->sample_smoothing_rate); sample->sample_rate = 10; /* %time to try diff tx rates */ @@ -127,7 +131,7 @@ }; static void -sample_node_init(struct ieee80211_node *ni, uint32_t capabilities) +sample_node_init(struct ieee80211_node *ni) { #define RATE(_ix) (ni->ni_rates.rs_rates[(_ix)] & IEEE80211_RATE_VAL) #define DOT11RATE(_ix) (rt->info[(_ix)].dot11Rate & IEEE80211_RATE_VAL) @@ -149,9 +153,6 @@ } } else san = ni->ni_rctls; - - struct ieee80211_ratectl_node *irn = IEEE80211_RATECTL_NODE(ni); - irn->irn_capabilities = capabilities; san->san_sample = sample; @@ -603,9 +604,9 @@ goto done; } - if (IEEE80211_RATECTL_HASCAP_MRR(ni)) + if (IEEE80211_RATECTL_HASCAP_MRR(vap)) mrr = 1; - if (! IEEE80211_RATECTL_HASCAP_MRRPROT(ni)) + if (! IEEE80211_RATECTL_HASCAP_MRRPROT(vap)) mrr = 0; best_rix = pick_best_rate(ni, rt, size_bin, !mrr); @@ -758,7 +759,7 @@ struct ieee80211_sample_node *san = ni->ni_rctls; uint8_t rix0 = sample_rate(ni, NULL, 0); const struct txschedule *sched = &san->sched[rix0]; - struct ieee80211_rc_series *rc = rc_info->ri_rc; + struct ieee80211_rc_series *rc = rc_info->iri_rc; KASSERT(rix0 == sched->r0, ("rix0 (%x) != sched->r0 (%x)!\n", rix0, sched->r0)); @@ -895,15 +896,18 @@ int nframes, nbad; int frame_size, mrr; - final_rix = rt->rateCodeToIndex[rc_info->ri_txrate]; - short_tries = rc_info->ri_shortretry; + /* update per vap statistics */ + ieee80211_ratectl_update_stat(vap, rc_info); + + final_rix = rt->rateCodeToIndex[rc_info->iri_txrate]; + short_tries = rc_info->iri_shortretry; /* XXX why plus 1 here? */ - long_tries = rc_info->ri_longretry + 1; + long_tries = rc_info->iri_longretry + 1; - nframes = rc_info->ri_txcnt; - nbad = rc_info->ri_failcnt; + nframes = rc_info->iri_txcnt; + nbad = rc_info->iri_failcnt; - frame_size = rc_info->ri_framelen; + frame_size = rc_info->iri_framelen; mrr = 0; if (nframes == 0) { @@ -917,13 +921,13 @@ return; } - if (IEEE80211_RATECTL_HASCAP_MRR(ni)) + if (IEEE80211_RATECTL_HASCAP_MRR(vap)) mrr = 1; /* XXX check HT protmode too */ - if (mrr && !IEEE80211_RATECTL_HASCAP_MRRPROT(ni)) + if (mrr && !IEEE80211_RATECTL_HASCAP_MRRPROT(vap)) mrr = 0; - if (!mrr || rc_info->ri_finaltsi == 0) { + if (!mrr || rc_info->iri_finaltsi == 0) { if (!IS_RATE_DEFINED(san, final_rix)) { return; } @@ -939,7 +943,7 @@ nframes, nbad); } else { - int finalTSIdx = rc_info->ri_finaltsi; + int finalTSIdx = rc_info->iri_finaltsi; int i; /* Modified: soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.h ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.h Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_rc_sample.h Sun Aug 25 09:37:15 2013 (r256474) @@ -53,6 +53,7 @@ * Rate control settings. */ struct ieee80211_sample { + struct ieee80211_rc_stat sample_stat; int sample_smoothing_rate; /* ewma percentage [0..99] */ int sample_smoothing_minpackets; int sample_rate; /* %time to try different tx rates */ @@ -85,7 +86,6 @@ */ /* XXX change naming conversion? */ struct ieee80211_sample_node { - struct ieee80211_ratectl_node san_node; /* common state */ struct ieee80211_sample *san_sample;/* backpointer */ int static_rix; /* rate index of fixed tx rate */ uint64_t ratemask; /* bit mask of valid rate indices */ Modified: soc2013/ccqin/head/sys/net80211/ieee80211_sta.c ============================================================================== --- soc2013/ccqin/head/sys/net80211/ieee80211_sta.c Sun Aug 25 08:56:09 2013 (r256473) +++ soc2013/ccqin/head/sys/net80211/ieee80211_sta.c Sun Aug 25 09:37:15 2013 (r256474) @@ -1636,8 +1636,7 @@ IEEE80211_F_JOIN | IEEE80211_F_DOBRS); ieee80211_setup_basic_htrates(ni, htinfo); ieee80211_node_setuptxparms(ni); - /* XXX TODO fill the cap field */ - ieee80211_ratectl_node_init(ni, 0); + ieee80211_ratectl_node_init(ni); } else { #ifdef IEEE80211_SUPPORT_SUPERG if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_ATH))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308250937.r7P9bF0v031600>