1 --- a/ath_rate/minstrel/minstrel.c
2 +++ b/ath_rate/minstrel/minstrel.c
6 #define ONE_SECOND (1000 * 1000) /* 1 second, or 1000 milliseconds; eternity, in other words */
7 +#define TIMER_INTERVAL 100 /* msecs */
11 @@ -128,9 +129,6 @@ static char *dev_info = "ath_rate_minstr
12 #define STALE_FAILURE_TIMEOUT_MS 10000
15 -static int ath_timer_interval = (1000 / 10); /* every 1/10 second, timer runs */
16 -static void ath_timer_function(unsigned long data);
18 /* 10% of the time, send a packet at something other than the optimal rate, which fills
19 * the statistics tables nicely. This percentage is applied to the first packet of the
20 * multi rate retry chain. */
21 @@ -142,7 +140,7 @@ static void ath_rate_ctl_reset(struct at
22 /* Calculate the throughput and probability of success for each node
23 * we are talking on, based on the statistics collected during the
24 * last timer period. */
25 -static void ath_rate_statistics(void *arg, struct ieee80211_node *ni);
26 +static void ath_rate_statistics(struct ieee80211_node *ni);
29 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
30 @@ -204,6 +202,11 @@ ath_rate_findrate(struct ath_softc *sc,
31 unsigned int ndx, offset;
35 + if (abs(jiffies - sn->last_update) > msecs_to_jiffies(TIMER_INTERVAL)) {
36 + ath_rate_statistics(&an->an_node);
37 + sn->last_update = jiffies;
39 if (sn->num_rates <= 0) {
40 printk(KERN_WARNING "%s: no rates for " MAC_FMT "?\n",
42 @@ -640,54 +643,11 @@ ath_rate_newstate(struct ieee80211vap *v
47 -ath_timer_function(unsigned long data)
49 - struct minstrel_softc *ssc = (struct minstrel_softc *) data;
50 - struct ath_softc *sc = ssc->sc;
51 - struct ieee80211com *ic;
52 - struct net_device *dev = ssc->sc_dev;
53 - struct timer_list *timer;
54 - unsigned int interval = ath_timer_interval;
57 - DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'dev' is null in this timer \n", __func__);
60 - DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'sc' is null in this timer\n", __func__);
64 - if (ssc->close_timer_now)
67 - if (dev->flags & IFF_RUNNING) {
68 - sc->sc_stats.ast_rate_calls++;
70 - if (ic->ic_opmode == IEEE80211_M_STA) {
71 - struct ieee80211vap *tmpvap;
72 - TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
73 - ath_rate_statistics(sc, tmpvap->iv_bss);/* NB: no reference */
76 - ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_statistics, sc);
79 - if (ic->ic_opmode == IEEE80211_M_STA)
80 - interval = ath_timer_interval >> 1;
82 - timer = &(ssc->timer);
84 - DPRINTF(sc, ATH_DEBUG_RATE, "%s: timer is null - leave it\n", __func__);
86 - timer->expires = jiffies + ((HZ * interval) / 1000);
91 -ath_rate_statistics(void *arg, struct ieee80211_node *ni)
92 +ath_rate_statistics(struct ieee80211_node *ni)
94 - struct ath_node *an = (struct ath_node *) ni;
95 + struct ath_node *an = ATH_NODE(ni);
96 struct ieee80211_rateset *rs = &ni->ni_rates;
97 struct minstrel_node *rn = ATH_NODE_MINSTREL(an);
99 @@ -786,15 +746,8 @@ ath_rate_attach(struct ath_softc *sc)
100 osc->arc.arc_space = sizeof(struct minstrel_node);
101 osc->arc.arc_vap_space = 0;
103 - osc->close_timer_now = 0;
104 - init_timer(&osc->timer);
106 osc->sc_dev = sc->sc_dev;
107 - osc->timer.function = ath_timer_function;
108 - osc->timer.data = (unsigned long)osc;
110 - osc->timer.expires = jiffies + HZ;
111 - add_timer(&osc->timer);
115 @@ -803,8 +756,6 @@ static void
116 ath_rate_detach(struct ath_ratectrl *arc)
118 struct minstrel_softc *osc = (struct minstrel_softc *) arc;
119 - osc->close_timer_now = 1;
120 - del_timer(&osc->timer);
122 _MOD_DEC_USE(THIS_MODULE);
124 --- a/ath_rate/minstrel/minstrel.h
125 +++ b/ath_rate/minstrel/minstrel.h
126 @@ -167,6 +167,8 @@ struct minstrel_node {
127 packet, or a packet at an optimal rate.*/
129 int a, b; /**Coefficients of the random thing */
131 + unsigned long last_update;