mac80211: use 16 bit alignment for the if_ibss bssid field
[deliverable/linux.git] / net / mac80211 / mesh_pathtbl.c
CommitLineData
eb2b9311 1/*
264d9b7d 2 * Copyright (c) 2008, 2009 open80211s Ltd.
eb2b9311
LCC
3 * Author: Luis Carlos Cobo <luisca@cozybit.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/etherdevice.h>
11#include <linux/list.h>
eb2b9311 12#include <linux/random.h>
5a0e3ad6 13#include <linux/slab.h>
eb2b9311
LCC
14#include <linux/spinlock.h>
15#include <linux/string.h>
16#include <net/mac80211.h>
4777be41 17#include "wme.h"
eb2b9311
LCC
18#include "ieee80211_i.h"
19#include "mesh.h"
20
7646887a
JC
21#ifdef CONFIG_MAC80211_VERBOSE_MPATH_DEBUG
22#define mpath_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args)
23#else
24#define mpath_dbg(fmt, args...) do { (void)(0); } while (0)
25#endif
26
eb2b9311
LCC
27/* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */
28#define INIT_PATHS_SIZE_ORDER 2
29
30/* Keep the mean chain length below this constant */
31#define MEAN_CHAIN_LEN 2
32
33#define MPATH_EXPIRED(mpath) ((mpath->flags & MESH_PATH_ACTIVE) && \
34 time_after(jiffies, mpath->exp_time) && \
35 !(mpath->flags & MESH_PATH_FIXED))
36
37struct mpath_node {
38 struct hlist_node list;
39 struct rcu_head rcu;
40 /* This indirection allows two different tables to point to the same
41 * mesh_path structure, useful when resizing
42 */
43 struct mesh_path *mpath;
44};
45
349eb8cf
JB
46static struct mesh_table __rcu *mesh_paths;
47static struct mesh_table __rcu *mpp_paths; /* Store paths for MPP&MAP */
eb2b9311 48
f5ea9120 49int mesh_paths_generation;
6b86bd62
JB
50
51/* This lock will have the grow table function as writer and add / delete nodes
239289e4
JC
52 * as readers. RCU provides sufficient protection only when reading the table
53 * (i.e. doing lookups). Adding or adding or removing nodes requires we take
54 * the read lock or we risk operating on an old table. The write lock is only
55 * needed when modifying the number of buckets a table.
6b86bd62
JB
56 */
57static DEFINE_RWLOCK(pathtbl_resize_lock);
58
59
349eb8cf
JB
60static inline struct mesh_table *resize_dereference_mesh_paths(void)
61{
62 return rcu_dereference_protected(mesh_paths,
63 lockdep_is_held(&pathtbl_resize_lock));
64}
65
66static inline struct mesh_table *resize_dereference_mpp_paths(void)
67{
68 return rcu_dereference_protected(mpp_paths,
69 lockdep_is_held(&pathtbl_resize_lock));
70}
71
72/*
73 * CAREFUL -- "tbl" must not be an expression,
74 * in particular not an rcu_dereference(), since
75 * it's used twice. So it is illegal to do
76 * for_each_mesh_entry(rcu_dereference(...), ...)
77 */
78#define for_each_mesh_entry(tbl, p, node, i) \
79 for (i = 0; i <= tbl->hash_mask; i++) \
80 hlist_for_each_entry_rcu(node, p, &tbl->hash_buckets[i], list)
81
82
6b86bd62
JB
83static struct mesh_table *mesh_table_alloc(int size_order)
84{
85 int i;
86 struct mesh_table *newtbl;
87
d676ff49 88 newtbl = kmalloc(sizeof(struct mesh_table), GFP_ATOMIC);
6b86bd62
JB
89 if (!newtbl)
90 return NULL;
91
92 newtbl->hash_buckets = kzalloc(sizeof(struct hlist_head) *
d676ff49 93 (1 << size_order), GFP_ATOMIC);
6b86bd62
JB
94
95 if (!newtbl->hash_buckets) {
96 kfree(newtbl);
97 return NULL;
98 }
99
100 newtbl->hashwlock = kmalloc(sizeof(spinlock_t) *
d676ff49 101 (1 << size_order), GFP_ATOMIC);
6b86bd62
JB
102 if (!newtbl->hashwlock) {
103 kfree(newtbl->hash_buckets);
104 kfree(newtbl);
105 return NULL;
106 }
107
108 newtbl->size_order = size_order;
109 newtbl->hash_mask = (1 << size_order) - 1;
110 atomic_set(&newtbl->entries, 0);
111 get_random_bytes(&newtbl->hash_rnd,
112 sizeof(newtbl->hash_rnd));
113 for (i = 0; i <= newtbl->hash_mask; i++)
114 spin_lock_init(&newtbl->hashwlock[i]);
5ee68e5b 115 spin_lock_init(&newtbl->gates_lock);
6b86bd62
JB
116
117 return newtbl;
118}
119
18889231
JC
120static void __mesh_table_free(struct mesh_table *tbl)
121{
122 kfree(tbl->hash_buckets);
123 kfree(tbl->hashwlock);
124 kfree(tbl);
125}
126
6b86bd62 127static void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
18889231
JC
128{
129 struct hlist_head *mesh_hash;
130 struct hlist_node *p, *q;
5ee68e5b 131 struct mpath_node *gate;
18889231
JC
132 int i;
133
134 mesh_hash = tbl->hash_buckets;
135 for (i = 0; i <= tbl->hash_mask; i++) {
9b84b808 136 spin_lock_bh(&tbl->hashwlock[i]);
18889231
JC
137 hlist_for_each_safe(p, q, &mesh_hash[i]) {
138 tbl->free_node(p, free_leafs);
139 atomic_dec(&tbl->entries);
140 }
9b84b808 141 spin_unlock_bh(&tbl->hashwlock[i]);
18889231 142 }
5ee68e5b
JC
143 if (free_leafs) {
144 spin_lock_bh(&tbl->gates_lock);
145 hlist_for_each_entry_safe(gate, p, q,
146 tbl->known_gates, list) {
147 hlist_del(&gate->list);
148 kfree(gate);
149 }
150 kfree(tbl->known_gates);
151 spin_unlock_bh(&tbl->gates_lock);
152 }
153
18889231
JC
154 __mesh_table_free(tbl);
155}
156
a3e6b12c 157static int mesh_table_grow(struct mesh_table *oldtbl,
6b86bd62 158 struct mesh_table *newtbl)
18889231 159{
18889231
JC
160 struct hlist_head *oldhash;
161 struct hlist_node *p, *q;
162 int i;
163
a3e6b12c
I
164 if (atomic_read(&oldtbl->entries)
165 < oldtbl->mean_chain_len * (oldtbl->hash_mask + 1))
166 return -EAGAIN;
18889231 167
a3e6b12c
I
168 newtbl->free_node = oldtbl->free_node;
169 newtbl->mean_chain_len = oldtbl->mean_chain_len;
170 newtbl->copy_node = oldtbl->copy_node;
5ee68e5b 171 newtbl->known_gates = oldtbl->known_gates;
a3e6b12c 172 atomic_set(&newtbl->entries, atomic_read(&oldtbl->entries));
18889231 173
a3e6b12c
I
174 oldhash = oldtbl->hash_buckets;
175 for (i = 0; i <= oldtbl->hash_mask; i++)
18889231 176 hlist_for_each(p, &oldhash[i])
a3e6b12c 177 if (oldtbl->copy_node(p, newtbl) < 0)
18889231
JC
178 goto errcopy;
179
a3e6b12c 180 return 0;
18889231
JC
181
182errcopy:
183 for (i = 0; i <= newtbl->hash_mask; i++) {
184 hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
a3e6b12c 185 oldtbl->free_node(p, 0);
18889231 186 }
a3e6b12c 187 return -ENOMEM;
18889231
JC
188}
189
6b86bd62
JB
190static u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata,
191 struct mesh_table *tbl)
192{
193 /* Use last four bytes of hw addr and interface index as hash index */
194 return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, tbl->hash_rnd)
195 & tbl->hash_mask;
196}
f5ea9120 197
eb2b9311
LCC
198
199/**
200 *
201 * mesh_path_assign_nexthop - update mesh path next hop
202 *
203 * @mpath: mesh path to update
204 * @sta: next hop to assign
205 *
206 * Locking: mpath->state_lock must be held when calling this function
207 */
208void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta)
209{
10c836d7
JC
210 struct sk_buff *skb;
211 struct ieee80211_hdr *hdr;
212 struct sk_buff_head tmpq;
213 unsigned long flags;
214
d0709a65 215 rcu_assign_pointer(mpath->next_hop, sta);
10c836d7
JC
216
217 __skb_queue_head_init(&tmpq);
218
219 spin_lock_irqsave(&mpath->frame_queue.lock, flags);
220
221 while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) {
222 hdr = (struct ieee80211_hdr *) skb->data;
223 memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN);
7e3c8866 224 memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN);
10c836d7
JC
225 __skb_queue_tail(&tmpq, skb);
226 }
227
228 skb_queue_splice(&tmpq, &mpath->frame_queue);
229 spin_unlock_irqrestore(&mpath->frame_queue.lock, flags);
eb2b9311
LCC
230}
231
5ee68e5b
JC
232static void prepare_for_gate(struct sk_buff *skb, char *dst_addr,
233 struct mesh_path *gate_mpath)
234{
235 struct ieee80211_hdr *hdr;
236 struct ieee80211s_hdr *mshdr;
237 int mesh_hdrlen, hdrlen;
238 char *next_hop;
239
240 hdr = (struct ieee80211_hdr *) skb->data;
241 hdrlen = ieee80211_hdrlen(hdr->frame_control);
242 mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
243
244 if (!(mshdr->flags & MESH_FLAGS_AE)) {
245 /* size of the fixed part of the mesh header */
246 mesh_hdrlen = 6;
247
248 /* make room for the two extended addresses */
249 skb_push(skb, 2 * ETH_ALEN);
250 memmove(skb->data, hdr, hdrlen + mesh_hdrlen);
251
252 hdr = (struct ieee80211_hdr *) skb->data;
253
254 /* we preserve the previous mesh header and only add
255 * the new addreses */
256 mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
257 mshdr->flags = MESH_FLAGS_AE_A5_A6;
258 memcpy(mshdr->eaddr1, hdr->addr3, ETH_ALEN);
259 memcpy(mshdr->eaddr2, hdr->addr4, ETH_ALEN);
260 }
261
262 /* update next hop */
263 hdr = (struct ieee80211_hdr *) skb->data;
264 rcu_read_lock();
265 next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr;
266 memcpy(hdr->addr1, next_hop, ETH_ALEN);
267 rcu_read_unlock();
7e3c8866 268 memcpy(hdr->addr2, gate_mpath->sdata->vif.addr, ETH_ALEN);
5ee68e5b
JC
269 memcpy(hdr->addr3, dst_addr, ETH_ALEN);
270}
271
272/**
273 *
274 * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another
275 *
276 * This function is used to transfer or copy frames from an unresolved mpath to
277 * a gate mpath. The function also adds the Address Extension field and
278 * updates the next hop.
279 *
280 * If a frame already has an Address Extension field, only the next hop and
281 * destination addresses are updated.
282 *
283 * The gate mpath must be an active mpath with a valid mpath->next_hop.
284 *
285 * @mpath: An active mpath the frames will be sent to (i.e. the gate)
286 * @from_mpath: The failed mpath
287 * @copy: When true, copy all the frames to the new mpath queue. When false,
288 * move them.
289 */
290static void mesh_path_move_to_queue(struct mesh_path *gate_mpath,
291 struct mesh_path *from_mpath,
292 bool copy)
293{
c6133661 294 struct sk_buff *skb, *cp_skb = NULL;
5ee68e5b
JC
295 struct sk_buff_head gateq, failq;
296 unsigned long flags;
297 int num_skbs;
298
299 BUG_ON(gate_mpath == from_mpath);
300 BUG_ON(!gate_mpath->next_hop);
301
302 __skb_queue_head_init(&gateq);
303 __skb_queue_head_init(&failq);
304
305 spin_lock_irqsave(&from_mpath->frame_queue.lock, flags);
306 skb_queue_splice_init(&from_mpath->frame_queue, &failq);
307 spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags);
308
309 num_skbs = skb_queue_len(&failq);
310
311 while (num_skbs--) {
312 skb = __skb_dequeue(&failq);
817a53d9 313 if (copy) {
5ee68e5b 314 cp_skb = skb_copy(skb, GFP_ATOMIC);
817a53d9
JL
315 if (cp_skb)
316 __skb_queue_tail(&failq, cp_skb);
317 }
5ee68e5b
JC
318
319 prepare_for_gate(skb, gate_mpath->dst, gate_mpath);
320 __skb_queue_tail(&gateq, skb);
5ee68e5b
JC
321 }
322
323 spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags);
324 skb_queue_splice(&gateq, &gate_mpath->frame_queue);
325 mpath_dbg("Mpath queue for gate %pM has %d frames\n",
326 gate_mpath->dst,
327 skb_queue_len(&gate_mpath->frame_queue));
328 spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags);
329
330 if (!copy)
331 return;
332
333 spin_lock_irqsave(&from_mpath->frame_queue.lock, flags);
334 skb_queue_splice(&failq, &from_mpath->frame_queue);
335 spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags);
336}
337
eb2b9311 338
5ad20dd1 339static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst,
239289e4 340 struct ieee80211_sub_if_data *sdata)
eb2b9311
LCC
341{
342 struct mesh_path *mpath;
343 struct hlist_node *n;
344 struct hlist_head *bucket;
eb2b9311
LCC
345 struct mpath_node *node;
346
f698d856 347 bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)];
eb2b9311
LCC
348 hlist_for_each_entry_rcu(node, n, bucket, list) {
349 mpath = node->mpath;
f698d856 350 if (mpath->sdata == sdata &&
eb2b9311
LCC
351 memcmp(dst, mpath->dst, ETH_ALEN) == 0) {
352 if (MPATH_EXPIRED(mpath)) {
353 spin_lock_bh(&mpath->state_lock);
ad99d141 354 mpath->flags &= ~MESH_PATH_ACTIVE;
eb2b9311
LCC
355 spin_unlock_bh(&mpath->state_lock);
356 }
357 return mpath;
358 }
359 }
360 return NULL;
361}
362
239289e4
JC
363/**
364 * mesh_path_lookup - look up a path in the mesh path table
365 * @dst: hardware address (ETH_ALEN length) of destination
366 * @sdata: local subif
367 *
368 * Returns: pointer to the mesh path structure, or NULL if not found
369 *
370 * Locking: must be called within a read rcu section.
371 */
372struct mesh_path *mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
79617dee 373{
5ad20dd1 374 return mpath_lookup(rcu_dereference(mesh_paths), dst, sdata);
239289e4 375}
79617dee 376
239289e4
JC
377struct mesh_path *mpp_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata)
378{
5ad20dd1 379 return mpath_lookup(rcu_dereference(mpp_paths), dst, sdata);
79617dee
Y
380}
381
382
eb2b9311
LCC
383/**
384 * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
385 * @idx: index
f698d856 386 * @sdata: local subif, or NULL for all entries
eb2b9311
LCC
387 *
388 * Returns: pointer to the mesh path structure, or NULL if not found.
389 *
390 * Locking: must be called within a read rcu section.
391 */
f698d856 392struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data *sdata)
eb2b9311 393{
349eb8cf 394 struct mesh_table *tbl = rcu_dereference(mesh_paths);
eb2b9311
LCC
395 struct mpath_node *node;
396 struct hlist_node *p;
397 int i;
398 int j = 0;
399
349eb8cf 400 for_each_mesh_entry(tbl, p, node, i) {
f698d856 401 if (sdata && node->mpath->sdata != sdata)
2a8ca29a 402 continue;
eb2b9311
LCC
403 if (j++ == idx) {
404 if (MPATH_EXPIRED(node->mpath)) {
405 spin_lock_bh(&node->mpath->state_lock);
ad99d141 406 node->mpath->flags &= ~MESH_PATH_ACTIVE;
eb2b9311
LCC
407 spin_unlock_bh(&node->mpath->state_lock);
408 }
409 return node->mpath;
410 }
2a8ca29a 411 }
eb2b9311
LCC
412
413 return NULL;
414}
415
5ee68e5b
JC
416static void mesh_gate_node_reclaim(struct rcu_head *rp)
417{
418 struct mpath_node *node = container_of(rp, struct mpath_node, rcu);
419 kfree(node);
420}
421
422/**
30be52e4
JB
423 * mesh_path_add_gate - add the given mpath to a mesh gate to our path table
424 * @mpath: gate path to add to table
5ee68e5b 425 */
30be52e4 426int mesh_path_add_gate(struct mesh_path *mpath)
5ee68e5b 427{
30be52e4 428 struct mesh_table *tbl;
5ee68e5b
JC
429 struct mpath_node *gate, *new_gate;
430 struct hlist_node *n;
431 int err;
432
433 rcu_read_lock();
30be52e4 434 tbl = rcu_dereference(mesh_paths);
5ee68e5b
JC
435
436 hlist_for_each_entry_rcu(gate, n, tbl->known_gates, list)
437 if (gate->mpath == mpath) {
438 err = -EEXIST;
439 goto err_rcu;
440 }
441
442 new_gate = kzalloc(sizeof(struct mpath_node), GFP_ATOMIC);
443 if (!new_gate) {
444 err = -ENOMEM;
445 goto err_rcu;
446 }
447
448 mpath->is_gate = true;
449 mpath->sdata->u.mesh.num_gates++;
450 new_gate->mpath = mpath;
451 spin_lock_bh(&tbl->gates_lock);
452 hlist_add_head_rcu(&new_gate->list, tbl->known_gates);
453 spin_unlock_bh(&tbl->gates_lock);
454 rcu_read_unlock();
455 mpath_dbg("Mesh path (%s): Recorded new gate: %pM. %d known gates\n",
456 mpath->sdata->name, mpath->dst,
457 mpath->sdata->u.mesh.num_gates);
458 return 0;
459err_rcu:
460 rcu_read_unlock();
461 return err;
462}
463
464/**
465 * mesh_gate_del - remove a mesh gate from the list of known gates
466 * @tbl: table which holds our list of known gates
467 * @mpath: gate mpath
468 *
469 * Returns: 0 on success
470 *
471 * Locking: must be called inside rcu_read_lock() section
472 */
473static int mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath)
474{
475 struct mpath_node *gate;
476 struct hlist_node *p, *q;
477
5ee68e5b
JC
478 hlist_for_each_entry_safe(gate, p, q, tbl->known_gates, list)
479 if (gate->mpath == mpath) {
480 spin_lock_bh(&tbl->gates_lock);
481 hlist_del_rcu(&gate->list);
482 call_rcu(&gate->rcu, mesh_gate_node_reclaim);
483 spin_unlock_bh(&tbl->gates_lock);
484 mpath->sdata->u.mesh.num_gates--;
485 mpath->is_gate = false;
486 mpath_dbg("Mesh path (%s): Deleted gate: %pM. "
487 "%d known gates\n", mpath->sdata->name,
488 mpath->dst, mpath->sdata->u.mesh.num_gates);
489 break;
490 }
491
492 return 0;
493}
494
5ee68e5b
JC
495/**
496 * mesh_gate_num - number of gates known to this interface
497 * @sdata: subif data
498 */
499int mesh_gate_num(struct ieee80211_sub_if_data *sdata)
500{
501 return sdata->u.mesh.num_gates;
502}
503
eb2b9311
LCC
504/**
505 * mesh_path_add - allocate and add a new path to the mesh path table
506 * @addr: destination address of the path (ETH_ALEN length)
f698d856 507 * @sdata: local subif
eb2b9311 508 *
af901ca1 509 * Returns: 0 on success
eb2b9311
LCC
510 *
511 * State: the initial state of the new path is set to 0
512 */
f698d856 513int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
eb2b9311 514{
18889231
JC
515 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
516 struct ieee80211_local *local = sdata->local;
349eb8cf 517 struct mesh_table *tbl;
eb2b9311
LCC
518 struct mesh_path *mpath, *new_mpath;
519 struct mpath_node *node, *new_node;
520 struct hlist_head *bucket;
521 struct hlist_node *n;
522 int grow = 0;
523 int err = 0;
524 u32 hash_idx;
525
47846c9b 526 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
eb2b9311
LCC
527 /* never add ourselves as neighbours */
528 return -ENOTSUPP;
529
530 if (is_multicast_ether_addr(dst))
531 return -ENOTSUPP;
532
472dbc45 533 if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0)
eb2b9311
LCC
534 return -ENOSPC;
535
402d7752 536 err = -ENOMEM;
18889231 537 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC);
402d7752
PE
538 if (!new_mpath)
539 goto err_path_alloc;
540
18889231 541 new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
402d7752
PE
542 if (!new_node)
543 goto err_node_alloc;
f84e71a9 544
9b84b808 545 read_lock_bh(&pathtbl_resize_lock);
eb2b9311 546 memcpy(new_mpath->dst, dst, ETH_ALEN);
f698d856 547 new_mpath->sdata = sdata;
eb2b9311
LCC
548 new_mpath->flags = 0;
549 skb_queue_head_init(&new_mpath->frame_queue);
eb2b9311
LCC
550 new_node->mpath = new_mpath;
551 new_mpath->timer.data = (unsigned long) new_mpath;
552 new_mpath->timer.function = mesh_path_timer;
553 new_mpath->exp_time = jiffies;
554 spin_lock_init(&new_mpath->state_lock);
555 init_timer(&new_mpath->timer);
556
349eb8cf 557 tbl = resize_dereference_mesh_paths();
eb2b9311 558
349eb8cf
JB
559 hash_idx = mesh_table_hash(dst, sdata, tbl);
560 bucket = &tbl->hash_buckets[hash_idx];
eb2b9311 561
349eb8cf 562 spin_lock_bh(&tbl->hashwlock[hash_idx]);
eb2b9311 563
402d7752 564 err = -EEXIST;
eb2b9311
LCC
565 hlist_for_each_entry(node, n, bucket, list) {
566 mpath = node->mpath;
f698d856 567 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
402d7752 568 goto err_exists;
eb2b9311
LCC
569 }
570
571 hlist_add_head_rcu(&new_node->list, bucket);
349eb8cf
JB
572 if (atomic_inc_return(&tbl->entries) >=
573 tbl->mean_chain_len * (tbl->hash_mask + 1))
eb2b9311
LCC
574 grow = 1;
575
f5ea9120
JB
576 mesh_paths_generation++;
577
349eb8cf 578 spin_unlock_bh(&tbl->hashwlock[hash_idx]);
9b84b808 579 read_unlock_bh(&pathtbl_resize_lock);
402d7752 580 if (grow) {
18889231 581 set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags);
64592c8f 582 ieee80211_queue_work(&local->hw, &sdata->work);
eb2b9311 583 }
402d7752
PE
584 return 0;
585
586err_exists:
349eb8cf 587 spin_unlock_bh(&tbl->hashwlock[hash_idx]);
9b84b808 588 read_unlock_bh(&pathtbl_resize_lock);
402d7752
PE
589 kfree(new_node);
590err_node_alloc:
591 kfree(new_mpath);
592err_path_alloc:
472dbc45 593 atomic_dec(&sdata->u.mesh.mpaths);
eb2b9311
LCC
594 return err;
595}
596
1928ecab
JB
597static void mesh_table_free_rcu(struct rcu_head *rcu)
598{
599 struct mesh_table *tbl = container_of(rcu, struct mesh_table, rcu_head);
600
601 mesh_table_free(tbl, false);
602}
603
18889231
JC
604void mesh_mpath_table_grow(void)
605{
606 struct mesh_table *oldtbl, *newtbl;
607
9b84b808 608 write_lock_bh(&pathtbl_resize_lock);
349eb8cf
JB
609 oldtbl = resize_dereference_mesh_paths();
610 newtbl = mesh_table_alloc(oldtbl->size_order + 1);
1928ecab
JB
611 if (!newtbl)
612 goto out;
349eb8cf 613 if (mesh_table_grow(oldtbl, newtbl) < 0) {
a3e6b12c 614 __mesh_table_free(newtbl);
1928ecab 615 goto out;
18889231
JC
616 }
617 rcu_assign_pointer(mesh_paths, newtbl);
18889231 618
1928ecab
JB
619 call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu);
620
621 out:
622 write_unlock_bh(&pathtbl_resize_lock);
18889231
JC
623}
624
625void mesh_mpp_table_grow(void)
626{
627 struct mesh_table *oldtbl, *newtbl;
628
9b84b808 629 write_lock_bh(&pathtbl_resize_lock);
349eb8cf
JB
630 oldtbl = resize_dereference_mpp_paths();
631 newtbl = mesh_table_alloc(oldtbl->size_order + 1);
1928ecab
JB
632 if (!newtbl)
633 goto out;
349eb8cf 634 if (mesh_table_grow(oldtbl, newtbl) < 0) {
a3e6b12c 635 __mesh_table_free(newtbl);
1928ecab 636 goto out;
18889231
JC
637 }
638 rcu_assign_pointer(mpp_paths, newtbl);
1928ecab 639 call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu);
18889231 640
1928ecab
JB
641 out:
642 write_unlock_bh(&pathtbl_resize_lock);
18889231 643}
eb2b9311 644
79617dee
Y
645int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
646{
18889231
JC
647 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
648 struct ieee80211_local *local = sdata->local;
349eb8cf 649 struct mesh_table *tbl;
79617dee
Y
650 struct mesh_path *mpath, *new_mpath;
651 struct mpath_node *node, *new_node;
652 struct hlist_head *bucket;
653 struct hlist_node *n;
654 int grow = 0;
655 int err = 0;
656 u32 hash_idx;
657
47846c9b 658 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0)
79617dee
Y
659 /* never add ourselves as neighbours */
660 return -ENOTSUPP;
661
662 if (is_multicast_ether_addr(dst))
663 return -ENOTSUPP;
664
665 err = -ENOMEM;
18889231 666 new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC);
79617dee
Y
667 if (!new_mpath)
668 goto err_path_alloc;
669
18889231 670 new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
79617dee
Y
671 if (!new_node)
672 goto err_node_alloc;
673
9b84b808 674 read_lock_bh(&pathtbl_resize_lock);
79617dee
Y
675 memcpy(new_mpath->dst, dst, ETH_ALEN);
676 memcpy(new_mpath->mpp, mpp, ETH_ALEN);
677 new_mpath->sdata = sdata;
678 new_mpath->flags = 0;
679 skb_queue_head_init(&new_mpath->frame_queue);
680 new_node->mpath = new_mpath;
c6133661 681 init_timer(&new_mpath->timer);
79617dee
Y
682 new_mpath->exp_time = jiffies;
683 spin_lock_init(&new_mpath->state_lock);
684
349eb8cf 685 tbl = resize_dereference_mpp_paths();
79617dee 686
349eb8cf
JB
687 hash_idx = mesh_table_hash(dst, sdata, tbl);
688 bucket = &tbl->hash_buckets[hash_idx];
689
690 spin_lock_bh(&tbl->hashwlock[hash_idx]);
79617dee
Y
691
692 err = -EEXIST;
693 hlist_for_each_entry(node, n, bucket, list) {
694 mpath = node->mpath;
695 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0)
696 goto err_exists;
697 }
698
699 hlist_add_head_rcu(&new_node->list, bucket);
349eb8cf
JB
700 if (atomic_inc_return(&tbl->entries) >=
701 tbl->mean_chain_len * (tbl->hash_mask + 1))
79617dee
Y
702 grow = 1;
703
349eb8cf 704 spin_unlock_bh(&tbl->hashwlock[hash_idx]);
9b84b808 705 read_unlock_bh(&pathtbl_resize_lock);
79617dee 706 if (grow) {
18889231 707 set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags);
64592c8f 708 ieee80211_queue_work(&local->hw, &sdata->work);
79617dee
Y
709 }
710 return 0;
711
712err_exists:
349eb8cf 713 spin_unlock_bh(&tbl->hashwlock[hash_idx]);
9b84b808 714 read_unlock_bh(&pathtbl_resize_lock);
79617dee
Y
715 kfree(new_node);
716err_node_alloc:
717 kfree(new_mpath);
718err_path_alloc:
719 return err;
720}
721
722
eb2b9311
LCC
723/**
724 * mesh_plink_broken - deactivates paths and sends perr when a link breaks
725 *
726 * @sta: broken peer link
727 *
728 * This function must be called from the rate control algorithm if enough
729 * delivery errors suggest that a peer link is no longer usable.
730 */
731void mesh_plink_broken(struct sta_info *sta)
732{
349eb8cf 733 struct mesh_table *tbl;
15ff6365 734 static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
eb2b9311
LCC
735 struct mesh_path *mpath;
736 struct mpath_node *node;
737 struct hlist_node *p;
f698d856 738 struct ieee80211_sub_if_data *sdata = sta->sdata;
eb2b9311 739 int i;
25d49e4d 740 __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_DEST_UNREACHABLE);
eb2b9311
LCC
741
742 rcu_read_lock();
349eb8cf
JB
743 tbl = rcu_dereference(mesh_paths);
744 for_each_mesh_entry(tbl, p, node, i) {
eb2b9311 745 mpath = node->mpath;
349eb8cf 746 if (rcu_dereference(mpath->next_hop) == sta &&
eb2b9311
LCC
747 mpath->flags & MESH_PATH_ACTIVE &&
748 !(mpath->flags & MESH_PATH_FIXED)) {
f5e50cd0 749 spin_lock_bh(&mpath->state_lock);
eb2b9311 750 mpath->flags &= ~MESH_PATH_ACTIVE;
d19b3bf6 751 ++mpath->sn;
eb2b9311 752 spin_unlock_bh(&mpath->state_lock);
45904f21
JC
753 mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl,
754 mpath->dst, cpu_to_le32(mpath->sn),
25d49e4d 755 reason, bcast, sdata);
f5e50cd0 756 }
eb2b9311
LCC
757 }
758 rcu_read_unlock();
759}
760
19c50b3d
JC
761static void mesh_path_node_reclaim(struct rcu_head *rp)
762{
763 struct mpath_node *node = container_of(rp, struct mpath_node, rcu);
764 struct ieee80211_sub_if_data *sdata = node->mpath->sdata;
765
766 del_timer_sync(&node->mpath->timer);
767 atomic_dec(&sdata->u.mesh.mpaths);
768 kfree(node->mpath);
769 kfree(node);
770}
771
772/* needs to be called with the corresponding hashwlock taken */
773static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node)
774{
775 struct mesh_path *mpath;
776 mpath = node->mpath;
777 spin_lock(&mpath->state_lock);
778 mpath->flags |= MESH_PATH_RESOLVING;
779 if (mpath->is_gate)
780 mesh_gate_del(tbl, mpath);
781 hlist_del_rcu(&node->list);
782 call_rcu(&node->rcu, mesh_path_node_reclaim);
783 spin_unlock(&mpath->state_lock);
784 atomic_dec(&tbl->entries);
785}
786
eb2b9311
LCC
787/**
788 * mesh_path_flush_by_nexthop - Deletes mesh paths if their next hop matches
789 *
790 * @sta - mesh peer to match
791 *
b4e08ea1
LCC
792 * RCU notes: this function is called when a mesh plink transitions from
793 * PLINK_ESTAB to any other state, since PLINK_ESTAB state is the only one that
794 * allows path creation. This will happen before the sta can be freed (because
d0709a65
JB
795 * sta_info_destroy() calls this) so any reader in a rcu read block will be
796 * protected against the plink disappearing.
eb2b9311
LCC
797 */
798void mesh_path_flush_by_nexthop(struct sta_info *sta)
799{
349eb8cf 800 struct mesh_table *tbl;
eb2b9311
LCC
801 struct mesh_path *mpath;
802 struct mpath_node *node;
803 struct hlist_node *p;
804 int i;
805
349eb8cf 806 rcu_read_lock();
239289e4
JC
807 read_lock_bh(&pathtbl_resize_lock);
808 tbl = resize_dereference_mesh_paths();
349eb8cf 809 for_each_mesh_entry(tbl, p, node, i) {
eb2b9311 810 mpath = node->mpath;
cd72e817 811 if (rcu_dereference(mpath->next_hop) == sta) {
19c50b3d
JC
812 spin_lock_bh(&tbl->hashwlock[i]);
813 __mesh_path_del(tbl, node);
814 spin_unlock_bh(&tbl->hashwlock[i]);
815 }
eb2b9311 816 }
239289e4 817 read_unlock_bh(&pathtbl_resize_lock);
349eb8cf 818 rcu_read_unlock();
eb2b9311
LCC
819}
820
cd72e817
JC
821static void table_flush_by_iface(struct mesh_table *tbl,
822 struct ieee80211_sub_if_data *sdata)
eb2b9311
LCC
823{
824 struct mesh_path *mpath;
825 struct mpath_node *node;
826 struct hlist_node *p;
827 int i;
828
cd72e817 829 WARN_ON(!rcu_read_lock_held());
349eb8cf 830 for_each_mesh_entry(tbl, p, node, i) {
eb2b9311 831 mpath = node->mpath;
cd72e817
JC
832 if (mpath->sdata != sdata)
833 continue;
ece1a2e7 834 spin_lock_bh(&tbl->hashwlock[i]);
19c50b3d 835 __mesh_path_del(tbl, node);
ece1a2e7 836 spin_unlock_bh(&tbl->hashwlock[i]);
eb2b9311
LCC
837 }
838}
839
ece1a2e7
JC
840/**
841 * mesh_path_flush_by_iface - Deletes all mesh paths associated with a given iface
842 *
843 * This function deletes both mesh paths as well as mesh portal paths.
844 *
845 * @sdata - interface data to match
846 *
847 */
848void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata)
eb2b9311 849{
cd72e817 850 struct mesh_table *tbl;
d0709a65 851
cd72e817 852 rcu_read_lock();
239289e4
JC
853 read_lock_bh(&pathtbl_resize_lock);
854 tbl = resize_dereference_mesh_paths();
cd72e817 855 table_flush_by_iface(tbl, sdata);
239289e4 856 tbl = resize_dereference_mpp_paths();
cd72e817 857 table_flush_by_iface(tbl, sdata);
239289e4 858 read_unlock_bh(&pathtbl_resize_lock);
cd72e817 859 rcu_read_unlock();
eb2b9311
LCC
860}
861
862/**
863 * mesh_path_del - delete a mesh path from the table
864 *
865 * @addr: dst address (ETH_ALEN length)
f698d856 866 * @sdata: local subif
eb2b9311 867 *
af901ca1 868 * Returns: 0 if successful
eb2b9311 869 */
f698d856 870int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
eb2b9311 871{
349eb8cf 872 struct mesh_table *tbl;
eb2b9311
LCC
873 struct mesh_path *mpath;
874 struct mpath_node *node;
875 struct hlist_head *bucket;
876 struct hlist_node *n;
877 int hash_idx;
878 int err = 0;
879
9b84b808 880 read_lock_bh(&pathtbl_resize_lock);
349eb8cf
JB
881 tbl = resize_dereference_mesh_paths();
882 hash_idx = mesh_table_hash(addr, sdata, tbl);
883 bucket = &tbl->hash_buckets[hash_idx];
eb2b9311 884
349eb8cf 885 spin_lock_bh(&tbl->hashwlock[hash_idx]);
eb2b9311
LCC
886 hlist_for_each_entry(node, n, bucket, list) {
887 mpath = node->mpath;
f698d856 888 if (mpath->sdata == sdata &&
349eb8cf 889 memcmp(addr, mpath->dst, ETH_ALEN) == 0) {
19c50b3d 890 __mesh_path_del(tbl, node);
eb2b9311
LCC
891 goto enddel;
892 }
893 }
894
895 err = -ENXIO;
896enddel:
f5ea9120 897 mesh_paths_generation++;
349eb8cf 898 spin_unlock_bh(&tbl->hashwlock[hash_idx]);
9b84b808 899 read_unlock_bh(&pathtbl_resize_lock);
eb2b9311
LCC
900 return err;
901}
902
903/**
904 * mesh_path_tx_pending - sends pending frames in a mesh path queue
905 *
906 * @mpath: mesh path to activate
907 *
908 * Locking: the state_lock of the mpath structure must NOT be held when calling
909 * this function.
910 */
911void mesh_path_tx_pending(struct mesh_path *mpath)
912{
249b405c
JC
913 if (mpath->flags & MESH_PATH_ACTIVE)
914 ieee80211_add_pending_skbs(mpath->sdata->local,
915 &mpath->frame_queue);
eb2b9311
LCC
916}
917
5ee68e5b
JC
918/**
919 * mesh_path_send_to_gates - sends pending frames to all known mesh gates
920 *
921 * @mpath: mesh path whose queue will be emptied
922 *
923 * If there is only one gate, the frames are transferred from the failed mpath
924 * queue to that gate's queue. If there are more than one gates, the frames
925 * are copied from each gate to the next. After frames are copied, the
926 * mpath queues are emptied onto the transmission queue.
927 */
928int mesh_path_send_to_gates(struct mesh_path *mpath)
929{
930 struct ieee80211_sub_if_data *sdata = mpath->sdata;
931 struct hlist_node *n;
932 struct mesh_table *tbl;
933 struct mesh_path *from_mpath = mpath;
934 struct mpath_node *gate = NULL;
935 bool copy = false;
936 struct hlist_head *known_gates;
937
938 rcu_read_lock();
939 tbl = rcu_dereference(mesh_paths);
940 known_gates = tbl->known_gates;
941 rcu_read_unlock();
942
943 if (!known_gates)
944 return -EHOSTUNREACH;
945
946 hlist_for_each_entry_rcu(gate, n, known_gates, list) {
947 if (gate->mpath->sdata != sdata)
948 continue;
949
950 if (gate->mpath->flags & MESH_PATH_ACTIVE) {
951 mpath_dbg("Forwarding to %pM\n", gate->mpath->dst);
952 mesh_path_move_to_queue(gate->mpath, from_mpath, copy);
953 from_mpath = gate->mpath;
954 copy = true;
955 } else {
956 mpath_dbg("Not forwarding %p\n", gate->mpath);
957 mpath_dbg("flags %x\n", gate->mpath->flags);
958 }
959 }
960
961 hlist_for_each_entry_rcu(gate, n, known_gates, list)
962 if (gate->mpath->sdata == sdata) {
963 mpath_dbg("Sending to %pM\n", gate->mpath->dst);
964 mesh_path_tx_pending(gate->mpath);
965 }
966
967 return (from_mpath == mpath) ? -EHOSTUNREACH : 0;
968}
969
eb2b9311
LCC
970/**
971 * mesh_path_discard_frame - discard a frame whose path could not be resolved
972 *
973 * @skb: frame to discard
f698d856 974 * @sdata: network subif the frame was to be sent through
eb2b9311 975 *
eb2b9311
LCC
976 * Locking: the function must me called within a rcu_read_lock region
977 */
f698d856
JBG
978void mesh_path_discard_frame(struct sk_buff *skb,
979 struct ieee80211_sub_if_data *sdata)
eb2b9311 980{
eb2b9311 981 kfree_skb(skb);
472dbc45 982 sdata->u.mesh.mshstats.dropped_frames_no_route++;
eb2b9311
LCC
983}
984
985/**
986 * mesh_path_flush_pending - free the pending queue of a mesh path
987 *
988 * @mpath: mesh path whose queue has to be freed
989 *
25985edc 990 * Locking: the function must me called within a rcu_read_lock region
eb2b9311
LCC
991 */
992void mesh_path_flush_pending(struct mesh_path *mpath)
993{
eb2b9311
LCC
994 struct sk_buff *skb;
995
00e3f25c 996 while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL)
f698d856 997 mesh_path_discard_frame(skb, mpath->sdata);
eb2b9311
LCC
998}
999
1000/**
1001 * mesh_path_fix_nexthop - force a specific next hop for a mesh path
1002 *
1003 * @mpath: the mesh path to modify
1004 * @next_hop: the next hop to force
1005 *
1006 * Locking: this function must be called holding mpath->state_lock
1007 */
1008void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop)
1009{
1010 spin_lock_bh(&mpath->state_lock);
1011 mesh_path_assign_nexthop(mpath, next_hop);
d19b3bf6 1012 mpath->sn = 0xffff;
eb2b9311
LCC
1013 mpath->metric = 0;
1014 mpath->hop_count = 0;
1015 mpath->exp_time = 0;
1016 mpath->flags |= MESH_PATH_FIXED;
1017 mesh_path_activate(mpath);
1018 spin_unlock_bh(&mpath->state_lock);
1019 mesh_path_tx_pending(mpath);
1020}
1021
1022static void mesh_path_node_free(struct hlist_node *p, bool free_leafs)
1023{
1024 struct mesh_path *mpath;
1025 struct mpath_node *node = hlist_entry(p, struct mpath_node, list);
1026 mpath = node->mpath;
1027 hlist_del_rcu(p);
d0df9eec
JC
1028 if (free_leafs) {
1029 del_timer_sync(&mpath->timer);
eb2b9311 1030 kfree(mpath);
d0df9eec 1031 }
eb2b9311
LCC
1032 kfree(node);
1033}
1034
4caf86c6 1035static int mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl)
eb2b9311
LCC
1036{
1037 struct mesh_path *mpath;
1038 struct mpath_node *node, *new_node;
1039 u32 hash_idx;
1040
8566dc3f 1041 new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC);
00242c40
PE
1042 if (new_node == NULL)
1043 return -ENOMEM;
1044
eb2b9311
LCC
1045 node = hlist_entry(p, struct mpath_node, list);
1046 mpath = node->mpath;
eb2b9311 1047 new_node->mpath = mpath;
f698d856 1048 hash_idx = mesh_table_hash(mpath->dst, mpath->sdata, newtbl);
eb2b9311
LCC
1049 hlist_add_head(&new_node->list,
1050 &newtbl->hash_buckets[hash_idx]);
4caf86c6 1051 return 0;
eb2b9311
LCC
1052}
1053
1054int mesh_pathtbl_init(void)
1055{
349eb8cf 1056 struct mesh_table *tbl_path, *tbl_mpp;
4c5ade41 1057 int ret;
349eb8cf
JB
1058
1059 tbl_path = mesh_table_alloc(INIT_PATHS_SIZE_ORDER);
1060 if (!tbl_path)
79617dee 1061 return -ENOMEM;
349eb8cf
JB
1062 tbl_path->free_node = &mesh_path_node_free;
1063 tbl_path->copy_node = &mesh_path_node_copy;
1064 tbl_path->mean_chain_len = MEAN_CHAIN_LEN;
5ee68e5b 1065 tbl_path->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC);
4c5ade41
DC
1066 if (!tbl_path->known_gates) {
1067 ret = -ENOMEM;
1068 goto free_path;
1069 }
5ee68e5b
JC
1070 INIT_HLIST_HEAD(tbl_path->known_gates);
1071
79617dee 1072
349eb8cf
JB
1073 tbl_mpp = mesh_table_alloc(INIT_PATHS_SIZE_ORDER);
1074 if (!tbl_mpp) {
4c5ade41
DC
1075 ret = -ENOMEM;
1076 goto free_path;
79617dee 1077 }
349eb8cf
JB
1078 tbl_mpp->free_node = &mesh_path_node_free;
1079 tbl_mpp->copy_node = &mesh_path_node_copy;
1080 tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN;
5ee68e5b 1081 tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC);
4c5ade41
DC
1082 if (!tbl_mpp->known_gates) {
1083 ret = -ENOMEM;
1084 goto free_mpp;
1085 }
5ee68e5b 1086 INIT_HLIST_HEAD(tbl_mpp->known_gates);
349eb8cf
JB
1087
1088 /* Need no locking since this is during init */
1089 RCU_INIT_POINTER(mesh_paths, tbl_path);
1090 RCU_INIT_POINTER(mpp_paths, tbl_mpp);
79617dee 1091
eb2b9311 1092 return 0;
4c5ade41
DC
1093
1094free_mpp:
1095 mesh_table_free(tbl_mpp, true);
1096free_path:
1097 mesh_table_free(tbl_path, true);
1098 return ret;
eb2b9311
LCC
1099}
1100
f698d856 1101void mesh_path_expire(struct ieee80211_sub_if_data *sdata)
eb2b9311 1102{
349eb8cf 1103 struct mesh_table *tbl;
eb2b9311
LCC
1104 struct mesh_path *mpath;
1105 struct mpath_node *node;
1106 struct hlist_node *p;
1107 int i;
1108
349eb8cf
JB
1109 rcu_read_lock();
1110 tbl = rcu_dereference(mesh_paths);
1111 for_each_mesh_entry(tbl, p, node, i) {
f698d856 1112 if (node->mpath->sdata != sdata)
eb2b9311
LCC
1113 continue;
1114 mpath = node->mpath;
eb2b9311
LCC
1115 if ((!(mpath->flags & MESH_PATH_RESOLVING)) &&
1116 (!(mpath->flags & MESH_PATH_FIXED)) &&
f5e50cd0 1117 time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE))
f698d856 1118 mesh_path_del(mpath->dst, mpath->sdata);
eb2b9311 1119 }
349eb8cf 1120 rcu_read_unlock();
eb2b9311
LCC
1121}
1122
1123void mesh_pathtbl_unregister(void)
1124{
349eb8cf 1125 /* no need for locking during exit path */
33d480ce
ED
1126 mesh_table_free(rcu_dereference_protected(mesh_paths, 1), true);
1127 mesh_table_free(rcu_dereference_protected(mpp_paths, 1), true);
eb2b9311 1128}
This page took 0.361836 seconds and 5 git commands to generate.