aboutsummaryrefslogtreecommitdiffstats
path: root/package/madwifi/patches/452-minstrel_no_timer.patch
blob: e7f2deac1c5a46461a4cd51be843aeb6bf2b3618 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--- a/ath_rate/minstrel/minstrel.c
+++ b/ath_rate/minstrel/minstrel.c
@@ -119,6 +119,7 @@
 #include "minstrel.h"
 
 #define ONE_SECOND (1000 * 1000)  /* 1 second, or 1000 milliseconds; eternity, in other words */
+#define TIMER_INTERVAL 100 /* msecs */
 
 #include "release.h"
 
@@ -128,9 +129,6 @@ static char *dev_info = "ath_rate_minstr
 #define STALE_FAILURE_TIMEOUT_MS 10000
 #define ENABLE_MRR 1
 
-static int ath_timer_interval = (1000 / 10); /* every 1/10 second, timer runs */
-static void ath_timer_function(unsigned long data);
-
 /* 10% of the time, send a packet at something other than the optimal rate, which fills
  * the statistics tables nicely. This percentage is applied to the first packet of the
  * multi rate retry chain. */
@@ -142,7 +140,7 @@ static void ath_rate_ctl_reset(struct at
 /* Calculate the throughput and probability of success for each node
  * we are talking on, based on the statistics collected during the
  * last timer period. */
-static void ath_rate_statistics(void *arg, struct ieee80211_node *ni);
+static void ath_rate_statistics(struct ieee80211_node *ni);
 
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
@@ -204,6 +202,11 @@ ath_rate_findrate(struct ath_softc *sc, 
 		unsigned int ndx, offset;
 		int mrr;
 
+
+		if (sn->last_update + msecs_to_jiffies(TIMER_INTERVAL) < jiffies) {
+			ath_rate_statistics(&an->an_node);
+			sn->last_update = jiffies;
+		}
 		if (sn->num_rates <= 0) {
 			    printk(KERN_WARNING "%s: no rates for " MAC_FMT "?\n",
 			           dev_info,
@@ -640,54 +643,11 @@ ath_rate_newstate(struct ieee80211vap *v
 		}
 }
 
-static void
-ath_timer_function(unsigned long data)
-{
-		struct minstrel_softc *ssc = (struct minstrel_softc *) data;
-		struct ath_softc *sc = ssc->sc;
-		struct ieee80211com *ic;
-		struct net_device *dev = ssc->sc_dev;
-		struct timer_list *timer;
-		unsigned int interval = ath_timer_interval;
-
-		if (dev == NULL)
-			DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'dev' is null in this timer \n", __func__);
-
-		if (sc == NULL)
-			DPRINTF(sc, ATH_DEBUG_RATE, "%s: 'sc' is null in this timer\n", __func__);
-
-		ic = &sc->sc_ic;
-
-		if (ssc->close_timer_now)
-			return;
-
-		if (dev->flags & IFF_RUNNING) {
-			sc->sc_stats.ast_rate_calls++;
-
-			if (ic->ic_opmode == IEEE80211_M_STA) {
-				struct ieee80211vap *tmpvap;
-				TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next) {
-					ath_rate_statistics(sc, tmpvap->iv_bss);/* NB: no reference */
-				}
-			} else
-			            ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_statistics, sc);
-		}
-
-		if (ic->ic_opmode == IEEE80211_M_STA)
-			interval = ath_timer_interval >> 1;
-
-		timer  = &(ssc->timer);
-		if (timer == NULL)
-			DPRINTF(sc, ATH_DEBUG_RATE, "%s: timer is null - leave it\n", __func__);
-
-		timer->expires = jiffies + ((HZ * interval) / 1000);
-		add_timer(timer);
-}
 
 static void
-ath_rate_statistics(void *arg, struct ieee80211_node *ni)
+ath_rate_statistics(struct ieee80211_node *ni)
 {
-		struct ath_node *an = (struct ath_node *) ni;
+		struct ath_node *an = ATH_NODE(ni);
 		struct ieee80211_rateset *rs = &ni->ni_rates;
 		struct minstrel_node *rn = ATH_NODE_MINSTREL(an);
 		unsigned int i;
@@ -786,15 +746,8 @@ ath_rate_attach(struct ath_softc *sc)
 		osc->arc.arc_space = sizeof(struct minstrel_node);
 		osc->arc.arc_vap_space = 0;
 
-		osc->close_timer_now = 0;
-		init_timer(&osc->timer);
  	osc->sc          = sc;
 		osc->sc_dev      = sc->sc_dev;
-		osc->timer.function = ath_timer_function;
-		osc->timer.data = (unsigned long)osc;
-
-		osc->timer.expires = jiffies + HZ;
-		add_timer(&osc->timer);
 
 		return &osc->arc;
 }
@@ -803,8 +756,6 @@ static void
 ath_rate_detach(struct ath_ratectrl *arc)
 {
  	struct minstrel_softc *osc = (struct minstrel_softc *) arc;
-		osc->close_timer_now = 1;
-		del_timer(&osc->timer);
 		kfree(osc);
 		_MOD_DEC_USE(THIS_MODULE);
 }
--- a/ath_rate/minstrel/minstrel.h
+++ b/ath_rate/minstrel/minstrel.h
@@ -167,6 +167,8 @@ struct minstrel_node {
 	       packet, or a packet at an optimal rate.*/
 	int random_n;
 	int a, b;          /**Coefficients of the random thing */
+
+	unsigned long last_update;
 };