madwifi: clean up handling of various timings such as slot time, ack timeout, eifs...
[openwrt.git] / package / madwifi / patches / 392-remove_wds_nodetracking.patch
1 --- a/net80211/ieee80211_input.c
2 +++ b/net80211/ieee80211_input.c
3 @@ -568,36 +568,6 @@ ieee80211_input(struct ieee80211vap * va
4                                 }
5                         }
6  
7 -                       /* XXX: Useless node mgmt API; make better */
8 -                       if ((dir == IEEE80211_FC1_DIR_DSTODS) && !vap->iv_wdsnode &&
9 -                                       !ni_wds && !ni->ni_subif) {
10 -                               struct ieee80211_node_table *nt = &ic->ic_sta;
11 -                               struct ieee80211_frame_addr4 *wh4;
12 -
13 -                               if (!(vap->iv_flags_ext & IEEE80211_FEXT_WDS)) {
14 -                                       IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT,
15 -                                               wh, "data", "%s", "4 addr not allowed");
16 -                                       goto err;
17 -                               }
18 -                               wh4 = (struct ieee80211_frame_addr4 *)skb->data;
19 -                               ni_wds = ieee80211_find_wds_node(nt, wh4->i_addr4);
20 -                               /* Last call increments ref count if !NULL */
21 -                               if ((ni_wds != NULL) && (ni_wds != ni)) {
22 -                                       /*
23 -                                        * node with source address (addr4) moved
24 -                                        * to another WDS capable station. remove the
25 -                                        * reference to the previous station and add 
26 -                                        * reference to the new one
27 -                                        */
28 -                                        (void) ieee80211_remove_wds_addr(nt, wh4->i_addr4);
29 -                                        ieee80211_add_wds_addr(nt, ni, wh4->i_addr4, 0);
30 -                               }
31 -                               if (ni_wds == NULL)
32 -                                       ieee80211_add_wds_addr(nt, ni, wh4->i_addr4, 0);
33 -                               else
34 -                                       ieee80211_unref_node(&ni_wds);
35 -                       }
36 -
37                         /*
38                          * Check for power save state change.
39                          */
40 --- a/net80211/ieee80211_node.c
41 +++ b/net80211/ieee80211_node.c
42 @@ -122,7 +122,6 @@ static void ieee80211_node_table_init(st
43  static void ieee80211_node_table_cleanup(struct ieee80211_node_table *);
44  static void ieee80211_node_table_reset(struct ieee80211_node_table *,
45         struct ieee80211vap *);
46 -static void ieee80211_node_wds_ageout(unsigned long);
47  
48  MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
49  
50 @@ -785,10 +784,6 @@ ieee80211_node_table_init(struct ieee802
51         nt->nt_name = name;
52         nt->nt_scangen = 1;
53         nt->nt_inact_init = inact;
54 -       init_timer(&nt->nt_wds_aging_timer);
55 -       nt->nt_wds_aging_timer.function = ieee80211_node_wds_ageout;
56 -       nt->nt_wds_aging_timer.data = (unsigned long) nt;
57 -       mod_timer(&nt->nt_wds_aging_timer, jiffies + HZ * WDS_AGING_TIMER_VAL);
58  }
59  
60  static __inline 
61 @@ -1204,142 +1199,6 @@ void ieee80211_wds_addif(struct ieee8021
62         schedule_work(&ni->ni_create);
63  }
64  
65 -/* Add wds address to the node table */
66 -int
67 -#ifdef IEEE80211_DEBUG_REFCNT
68 -ieee80211_add_wds_addr_debug(struct ieee80211_node_table *nt,
69 -       struct ieee80211_node *ni, const u_int8_t *macaddr, u_int8_t wds_static,
70 -       const char* func, int line)
71 -#else
72 -ieee80211_add_wds_addr(struct ieee80211_node_table *nt,
73 -       struct ieee80211_node *ni, const u_int8_t *macaddr, u_int8_t wds_static)
74 -#endif
75 -{
76 -       int hash;
77 -       struct ieee80211_wds_addr *wds;
78 -
79 -       MALLOC(wds, struct ieee80211_wds_addr *, sizeof(struct ieee80211_wds_addr),
80 -               M_80211_WDS, M_NOWAIT | M_ZERO);
81 -       if (wds == NULL) {
82 -               /* XXX msg */
83 -               return 1;
84 -       }
85 -       if (wds_static)
86 -               wds->wds_agingcount = WDS_AGING_STATIC;
87 -       else
88 -               wds->wds_agingcount = WDS_AGING_COUNT;
89 -       hash = IEEE80211_NODE_HASH(macaddr);
90 -       IEEE80211_ADDR_COPY(wds->wds_macaddr, macaddr);
91 -
92 -       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
93 -#ifdef IEEE80211_DEBUG_REFCNT
94 -       wds->wds_ni = ieee80211_ref_node_debug(ni, func, line);
95 -#else
96 -       wds->wds_ni = ieee80211_ref_node(ni);
97 -#endif
98 -       LIST_INSERT_HEAD(&nt->nt_wds_hash[hash], wds, wds_hash);
99 -       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
100 -       return 0;
101 -}
102 -#ifdef IEEE80211_DEBUG_REFCNT
103 -EXPORT_SYMBOL(ieee80211_add_wds_addr_debug);
104 -#else
105 -EXPORT_SYMBOL(ieee80211_add_wds_addr);
106 -#endif
107 -
108 -/* remove wds address from the wds hash table */
109 -void
110 -#ifdef IEEE80211_DEBUG_REFCNT
111 -ieee80211_remove_wds_addr_debug(struct ieee80211_node_table *nt, const u_int8_t *macaddr, 
112 -                          const char* func, int line)
113 -#else
114 -ieee80211_remove_wds_addr(struct ieee80211_node_table *nt, const u_int8_t *macaddr)
115 -#endif
116 -{
117 -       int hash;
118 -       struct ieee80211_wds_addr *wds, *twds;
119 -
120 -       hash = IEEE80211_NODE_HASH(macaddr);
121 -       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
122 -       LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
123 -               if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
124 -                       LIST_REMOVE(wds, wds_hash);
125 -#ifdef IEEE80211_DEBUG_REFCNT
126 -                       ieee80211_unref_node_debug(&wds->wds_ni, func, line);
127 -#else
128 -                       ieee80211_unref_node(&wds->wds_ni);
129 -#endif
130 -                       FREE(wds, M_80211_WDS);
131 -                       break;
132 -               }
133 -       }
134 -       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
135 -}
136 -#ifdef IEEE80211_DEBUG_REFCNT
137 -EXPORT_SYMBOL(ieee80211_remove_wds_addr_debug);
138 -#else
139 -EXPORT_SYMBOL(ieee80211_remove_wds_addr);
140 -#endif
141 -
142 -/* Remove node references from wds table */
143 -void
144 -#ifdef IEEE80211_DEBUG_REFCNT
145 -ieee80211_del_wds_node_debug(struct ieee80211_node_table *nt, struct ieee80211_node *ni, 
146 -                       const char* func, int line)
147 -#else
148 -ieee80211_del_wds_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni)
149 -#endif
150 -{
151 -       int hash;
152 -       struct ieee80211_wds_addr *wds, *twds;
153 -
154 -       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
155 -       for (hash = 0; hash < IEEE80211_NODE_HASHSIZE; hash++) {
156 -               LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
157 -                       if (wds->wds_ni == ni) {
158 -                               LIST_REMOVE(wds, wds_hash);
159 -#ifdef IEEE80211_DEBUG_REFCNT
160 -                               ieee80211_unref_node_debug(&wds->wds_ni, func, line);
161 -#else
162 -                               ieee80211_unref_node(&wds->wds_ni);
163 -#endif
164 -                               FREE(wds, M_80211_WDS);
165 -                       }
166 -               }
167 -       }
168 -       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
169 -}
170 -#ifdef IEEE80211_DEBUG_REFCNT
171 -EXPORT_SYMBOL(ieee80211_del_wds_node_debug);
172 -#else
173 -EXPORT_SYMBOL(ieee80211_del_wds_node);
174 -#endif
175 -
176 -static void
177 -ieee80211_node_wds_ageout(unsigned long data)
178 -{
179 -       struct ieee80211_node_table *nt = (struct ieee80211_node_table *)data;
180 -       int hash;
181 -       struct ieee80211_wds_addr *wds, *twds;
182 -
183 -       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
184 -       for (hash = 0; hash < IEEE80211_NODE_HASHSIZE; hash++) {
185 -               LIST_FOREACH_SAFE(wds, &nt->nt_wds_hash[hash], wds_hash, twds) {
186 -                       if (wds->wds_agingcount != WDS_AGING_STATIC) {
187 -                               if (!wds->wds_agingcount) {
188 -                                       LIST_REMOVE(wds, wds_hash);
189 -                                       ieee80211_unref_node(&wds->wds_ni);
190 -                                       FREE(wds, M_80211_WDS);
191 -                               } else
192 -                                       wds->wds_agingcount--;
193 -                       }
194 -               }
195 -       }
196 -       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
197 -       mod_timer(&nt->nt_wds_aging_timer, jiffies + HZ * WDS_AGING_TIMER_VAL);
198 -}
199 -
200 -
201  /* Add the specified station to the station table.
202   * Allocates a new ieee80211_node* that has a reference count of one
203   * If tmp is 0, it is added to the node table and the reference is used.
204 @@ -1385,34 +1244,6 @@ ieee80211_dup_bss(struct ieee80211vap *v
205         return ni;
206  }
207  
208 -static struct ieee80211_node *
209 -#ifdef IEEE80211_DEBUG_REFCNT
210 -ieee80211_find_wds_node_locked_debug(struct ieee80211_node_table *nt, 
211 -                        const u_int8_t *macaddr, const char* func, int line)
212 -#else
213 -ieee80211_find_wds_node_locked(struct ieee80211_node_table *nt, 
214 -                        const u_int8_t *macaddr)
215 -#endif
216 -{
217 -       struct ieee80211_wds_addr *wds;
218 -       int hash;
219 -       IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
220 -
221 -       hash = IEEE80211_NODE_HASH(macaddr);
222 -       LIST_FOREACH(wds, &nt->nt_wds_hash[hash], wds_hash) {
223 -               if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
224 -                       if (wds->wds_agingcount != WDS_AGING_STATIC)
225 -                               wds->wds_agingcount = WDS_AGING_COUNT; /* reset the aging count */
226 -#ifdef IEEE80211_DEBUG_REFCNT
227 -                       return ieee80211_ref_node_debug(wds->wds_ni, func, line);
228 -#else
229 -                       return ieee80211_ref_node(wds->wds_ni);
230 -#endif
231 -               }
232 -       }
233 -       return NULL;
234 -}
235 -
236  /* NB: A node reference is acquired here; the caller MUST release it. */
237  #ifdef IEEE80211_DEBUG_REFCNT
238  #define        ieee80211_find_node_locked(nt, mac) \
239 @@ -1430,7 +1261,6 @@ ieee80211_find_node_locked(struct ieee80
240  {
241         struct ieee80211_node *ni;
242         int hash;
243 -       struct ieee80211_wds_addr *wds;
244  
245         IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
246  
247 @@ -1445,48 +1275,11 @@ ieee80211_find_node_locked(struct ieee80
248                         return ni;
249                 }
250         }
251 -
252 -       /* Now, we look for the desired mac address in the 4 address
253 -          nodes. */
254 -       LIST_FOREACH(wds, &nt->nt_wds_hash[hash], wds_hash) {
255 -               if (IEEE80211_ADDR_EQ(wds->wds_macaddr, macaddr)) {
256 -#ifdef IEEE80211_DEBUG_REFCNT
257 -                       return ieee80211_ref_node_debug(wds->wds_ni, func, line);
258 -#else
259 -                       return ieee80211_ref_node(wds->wds_ni);
260 -#endif 
261 -               }
262 -       }
263         return NULL;
264  }
265  
266  struct ieee80211_node *
267  #ifdef IEEE80211_DEBUG_REFCNT
268 -ieee80211_find_wds_node_debug(struct ieee80211_node_table *nt, const u_int8_t *macaddr, 
269 -                        const char* func, int line)
270 -#else
271 -ieee80211_find_wds_node(struct ieee80211_node_table *nt, const u_int8_t *macaddr)
272 -#endif
273 -{
274 -       struct ieee80211_node *ni;
275 -
276 -       IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
277 -#ifdef IEEE80211_DEBUG_REFCNT
278 -       ni = ieee80211_find_wds_node_locked_debug(nt, macaddr, func, line);
279 -#else
280 -       ni = ieee80211_find_wds_node_locked(nt, macaddr);
281 -#endif
282 -       IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
283 -       return ni;
284 -}
285 -#ifdef IEEE80211_DEBUG_REFCNT
286 -EXPORT_SYMBOL(ieee80211_find_wds_node_debug);
287 -#else
288 -EXPORT_SYMBOL(ieee80211_find_wds_node);
289 -#endif
290 -
291 -struct ieee80211_node *
292 -#ifdef IEEE80211_DEBUG_REFCNT
293  ieee80211_find_node_debug(struct ieee80211_node_table *nt,
294         const u_int8_t *macaddr, const char *func, int line)
295  #else
296 @@ -1838,7 +1631,6 @@ ieee80211_node_table_cleanup(struct ieee
297                 ic->ic_node_cleanup(ni);
298  #endif
299         }
300 -       del_timer(&nt->nt_wds_aging_timer);
301         IEEE80211_SCAN_LOCK_DESTROY(nt);
302         IEEE80211_NODE_TABLE_LOCK_DESTROY(nt);
303  }
304 @@ -2404,8 +2196,6 @@ ieee80211_node_leave(struct ieee80211_no
305          * so no more references are generated
306          */
307         if (nt) {
308 -               ieee80211_remove_wds_addr(nt, ni->ni_macaddr);
309 -               ieee80211_del_wds_node(nt, ni);
310                 IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
311                 node_table_leave_locked(nt, ni);
312                 IEEE80211_NODE_TABLE_UNLOCK_IRQ(nt);
313 --- a/net80211/ieee80211_node.h
314 +++ b/net80211/ieee80211_node.h
315 @@ -231,13 +231,6 @@ void ieee80211_sta_leave(struct ieee8021
316  #define WDS_AGING_STATIC       0xffff
317  #define WDS_AGING_TIMER_VAL    (WDS_AGING_TIME / 2)
318  
319 -struct ieee80211_wds_addr {
320 -       LIST_ENTRY(ieee80211_wds_addr) wds_hash;
321 -       u_int8_t        wds_macaddr[IEEE80211_ADDR_LEN];
322 -       struct ieee80211_node *wds_ni;
323 -       u_int16_t wds_agingcount;
324 -};
325 -
326  /*
327   * Table of ieee80211_node instances.  Each ieee80211com
328   * has at least one for holding the scan candidates.
329 @@ -250,11 +243,9 @@ struct ieee80211_node_table {
330         ieee80211_node_table_lock_t nt_nodelock;        /* on node table */
331         TAILQ_HEAD(, ieee80211_node) nt_node;   /* information of all nodes */
332         ATH_LIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];
333 -       ATH_LIST_HEAD(, ieee80211_wds_addr) nt_wds_hash[IEEE80211_NODE_HASHSIZE];
334         ieee80211_scan_lock_t nt_scanlock;      /* on nt_scangen */
335         u_int nt_scangen;                       /* gen# for timeout scan */
336         int nt_inact_init;                      /* initial node inact setting */
337 -       struct timer_list nt_wds_aging_timer;   /* timer to age out wds entries */
338  };
339  
340  /* Allocates a new ieee80211_node* that has a reference count of one, and 
341 @@ -363,47 +354,6 @@ void
342  ieee80211_unref_node(struct ieee80211_node **pni);
343  #endif /* #ifdef IEEE80211_DEBUG_REFCNT */
344  
345 -/* Increments reference count of ieee80211_node *ni */
346 -#ifdef IEEE80211_DEBUG_REFCNT
347 -#define ieee80211_add_wds_addr(_table, _node, _mac, _static) \
348 -       ieee80211_add_wds_addr_debug(_table, _node, _mac, _static, __func__, __LINE__)
349 -int ieee80211_add_wds_addr_debug(struct ieee80211_node_table *, struct ieee80211_node *,
350 -       const u_int8_t *, u_int8_t, const char* func, int line);
351 -#else
352 -int ieee80211_add_wds_addr(struct ieee80211_node_table *, struct ieee80211_node *,
353 -       const u_int8_t *, u_int8_t);
354 -#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
355 -
356 -/* Decrements reference count of ieee80211_node *ni */
357 -#ifdef IEEE80211_DEBUG_REFCNT
358 -#define ieee80211_remove_wds_addr(_table, _mac) \
359 -       ieee80211_remove_wds_addr_debug(_table, _mac, __func__, __LINE__)
360 -void ieee80211_remove_wds_addr_debug(struct ieee80211_node_table *, const u_int8_t *,
361 -                              const char* func, int line);
362 -#else
363 -void ieee80211_remove_wds_addr(struct ieee80211_node_table *, const u_int8_t *);
364 -#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
365 -
366 -/* Decrements reference count of node, if found */
367 -#ifdef IEEE80211_DEBUG_REFCNT
368 -#define ieee80211_del_wds_node(_table, _node) \
369 -       ieee80211_del_wds_node_debug(_table, _node, __func__, __LINE__)
370 -void ieee80211_del_wds_node_debug(struct ieee80211_node_table *, struct ieee80211_node *,
371 -                           const char* func, int line);
372 -#else
373 -void ieee80211_del_wds_node(struct ieee80211_node_table *, struct ieee80211_node *);
374 -#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
375 -
376 -/* Increments reference count of node, if found */
377 -#ifdef IEEE80211_DEBUG_REFCNT
378 -#define ieee80211_find_wds_node(_table, _mac) \
379 -       ieee80211_find_wds_node_debug(_table, _mac, __func__, __LINE__)
380 -struct ieee80211_node *ieee80211_find_wds_node_debug(struct ieee80211_node_table *,
381 -       const u_int8_t *, const char* func, int line);
382 -#else
383 -struct ieee80211_node *ieee80211_find_wds_node(struct ieee80211_node_table *,
384 -       const u_int8_t *);
385 -#endif /* #ifdef IEEE80211_DEBUG_REFCNT */
386  typedef void ieee80211_iter_func(void *, struct ieee80211_node *);
387  void ieee80211_iterate_nodes(struct ieee80211_node_table *,
388         ieee80211_iter_func *, void *);