Lines Matching +full:pm +full:- +full:alive

1 // SPDX-License-Identifier: GPL-2.0-only
56 cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_deinit()
57 rhashtable_free_and_destroy(&cache->rht, in mesh_fast_tx_deinit()
65 cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_init()
66 rhashtable_init(&cache->rht, &fast_tx_rht_params); in mesh_fast_tx_init()
67 INIT_HLIST_HEAD(&cache->walk_head); in mesh_fast_tx_init()
68 spin_lock_init(&cache->walk_lock); in mesh_fast_tx_init()
73 return (mpath->flags & MESH_PATH_ACTIVE) && in mpath_expired()
74 time_after(jiffies, mpath->exp_time) && in mpath_expired()
75 !(mpath->flags & MESH_PATH_FIXED); in mpath_expired()
88 INIT_HLIST_HEAD(&tbl->known_gates); in mesh_table_init()
89 INIT_HLIST_HEAD(&tbl->walk_head); in mesh_table_init()
90 atomic_set(&tbl->entries, 0); in mesh_table_init()
91 spin_lock_init(&tbl->gates_lock); in mesh_table_init()
92 spin_lock_init(&tbl->walk_lock); in mesh_table_init()
97 WARN_ON(rhashtable_init(&tbl->rhead, &mesh_rht_params)); in mesh_table_init()
102 rhashtable_free_and_destroy(&tbl->rhead, in mesh_table_free()
107 * mesh_path_assign_nexthop - update mesh path next hop
112 * Locking: mpath->state_lock must be held when calling this function
120 rcu_assign_pointer(mpath->next_hop, sta); in mesh_path_assign_nexthop()
122 spin_lock_irqsave(&mpath->frame_queue.lock, flags); in mesh_path_assign_nexthop()
123 skb_queue_walk(&mpath->frame_queue, skb) { in mesh_path_assign_nexthop()
124 hdr = (struct ieee80211_hdr *) skb->data; in mesh_path_assign_nexthop()
125 memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); in mesh_path_assign_nexthop()
126 memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); in mesh_path_assign_nexthop()
127 ieee80211_mps_set_frame_flags(sta->sdata, sta, hdr); in mesh_path_assign_nexthop()
130 spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); in mesh_path_assign_nexthop()
141 hdr = (struct ieee80211_hdr *) skb->data; in prepare_for_gate()
142 hdrlen = ieee80211_hdrlen(hdr->frame_control); in prepare_for_gate()
143 mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); in prepare_for_gate()
145 if (!(mshdr->flags & MESH_FLAGS_AE)) { in prepare_for_gate()
151 memmove(skb->data, hdr, hdrlen + mesh_hdrlen); in prepare_for_gate()
153 hdr = (struct ieee80211_hdr *) skb->data; in prepare_for_gate()
157 mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); in prepare_for_gate()
158 mshdr->flags = MESH_FLAGS_AE_A5_A6; in prepare_for_gate()
159 memcpy(mshdr->eaddr1, hdr->addr3, ETH_ALEN); in prepare_for_gate()
160 memcpy(mshdr->eaddr2, hdr->addr4, ETH_ALEN); in prepare_for_gate()
164 hdr = (struct ieee80211_hdr *) skb->data; in prepare_for_gate()
166 next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr; in prepare_for_gate()
167 memcpy(hdr->addr1, next_hop, ETH_ALEN); in prepare_for_gate()
169 memcpy(hdr->addr2, gate_mpath->sdata->vif.addr, ETH_ALEN); in prepare_for_gate()
170 memcpy(hdr->addr3, dst_addr, ETH_ALEN); in prepare_for_gate()
174 * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another
183 * The gate mpath must be an active mpath with a valid mpath->next_hop.
200 if (WARN_ON(!gate_mpath->next_hop)) in mesh_path_move_to_queue()
205 spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); in mesh_path_move_to_queue()
206 skb_queue_splice_init(&from_mpath->frame_queue, &failq); in mesh_path_move_to_queue()
207 spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); in mesh_path_move_to_queue()
210 if (skb_queue_len(&gate_mpath->frame_queue) >= in mesh_path_move_to_queue()
212 mpath_dbg(gate_mpath->sdata, "mpath queue full!\n"); in mesh_path_move_to_queue()
220 prepare_for_gate(skb, gate_mpath->dst, gate_mpath); in mesh_path_move_to_queue()
221 skb_queue_tail(&gate_mpath->frame_queue, skb); in mesh_path_move_to_queue()
230 mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n", in mesh_path_move_to_queue()
231 gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue)); in mesh_path_move_to_queue()
236 spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); in mesh_path_move_to_queue()
237 skb_queue_splice(&failq, &from_mpath->frame_queue); in mesh_path_move_to_queue()
238 spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); in mesh_path_move_to_queue()
247 mpath = rhashtable_lookup(&tbl->rhead, dst, mesh_rht_params); in mpath_lookup()
250 spin_lock_bh(&mpath->state_lock); in mpath_lookup()
251 mpath->flags &= ~MESH_PATH_ACTIVE; in mpath_lookup()
252 spin_unlock_bh(&mpath->state_lock); in mpath_lookup()
258 * mesh_path_lookup - look up a path in the mesh path table
269 return mpath_lookup(&sdata->u.mesh.mesh_paths, dst, sdata); in mesh_path_lookup()
275 return mpath_lookup(&sdata->u.mesh.mpp_paths, dst, sdata); in mpp_path_lookup()
284 hlist_for_each_entry_rcu(mpath, &tbl->walk_head, walk_list) { in __mesh_path_lookup_by_idx()
293 spin_lock_bh(&mpath->state_lock); in __mesh_path_lookup_by_idx()
294 mpath->flags &= ~MESH_PATH_ACTIVE; in __mesh_path_lookup_by_idx()
295 spin_unlock_bh(&mpath->state_lock); in __mesh_path_lookup_by_idx()
301 * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
312 return __mesh_path_lookup_by_idx(&sdata->u.mesh.mesh_paths, idx); in mesh_path_lookup_by_idx()
316 * mpp_path_lookup_by_idx - look up a path in the proxy path table by its index
327 return __mesh_path_lookup_by_idx(&sdata->u.mesh.mpp_paths, idx); in mpp_path_lookup_by_idx()
331 * mesh_path_add_gate - add the given mpath to a mesh gate to our path table
340 tbl = &mpath->sdata->u.mesh.mesh_paths; in mesh_path_add_gate()
342 spin_lock_bh(&mpath->state_lock); in mesh_path_add_gate()
343 if (mpath->is_gate) { in mesh_path_add_gate()
344 err = -EEXIST; in mesh_path_add_gate()
345 spin_unlock_bh(&mpath->state_lock); in mesh_path_add_gate()
348 mpath->is_gate = true; in mesh_path_add_gate()
349 mpath->sdata->u.mesh.num_gates++; in mesh_path_add_gate()
351 spin_lock(&tbl->gates_lock); in mesh_path_add_gate()
352 hlist_add_head_rcu(&mpath->gate_list, &tbl->known_gates); in mesh_path_add_gate()
353 spin_unlock(&tbl->gates_lock); in mesh_path_add_gate()
355 spin_unlock_bh(&mpath->state_lock); in mesh_path_add_gate()
357 mpath_dbg(mpath->sdata, in mesh_path_add_gate()
358 "Mesh path: Recorded new gate: %pM. %d known gates\n", in mesh_path_add_gate()
359 mpath->dst, mpath->sdata->u.mesh.num_gates); in mesh_path_add_gate()
367 * mesh_gate_del - remove a mesh gate from the list of known gates
373 lockdep_assert_held(&mpath->state_lock); in mesh_gate_del()
374 if (!mpath->is_gate) in mesh_gate_del()
377 mpath->is_gate = false; in mesh_gate_del()
378 spin_lock_bh(&tbl->gates_lock); in mesh_gate_del()
379 hlist_del_rcu(&mpath->gate_list); in mesh_gate_del()
380 mpath->sdata->u.mesh.num_gates--; in mesh_gate_del()
381 spin_unlock_bh(&tbl->gates_lock); in mesh_gate_del()
383 mpath_dbg(mpath->sdata, in mesh_gate_del()
384 "Mesh path: Deleted gate: %pM. %d known gates\n", in mesh_gate_del()
385 mpath->dst, mpath->sdata->u.mesh.num_gates); in mesh_gate_del()
389 * mesh_gate_num - number of gates known to this interface
394 return sdata->u.mesh.num_gates; in mesh_gate_num()
407 memcpy(new_mpath->dst, dst, ETH_ALEN); in mesh_path_new()
408 eth_broadcast_addr(new_mpath->rann_snd_addr); in mesh_path_new()
409 new_mpath->is_root = false; in mesh_path_new()
410 new_mpath->sdata = sdata; in mesh_path_new()
411 new_mpath->flags = 0; in mesh_path_new()
412 skb_queue_head_init(&new_mpath->frame_queue); in mesh_path_new()
413 new_mpath->exp_time = jiffies; in mesh_path_new()
414 spin_lock_init(&new_mpath->state_lock); in mesh_path_new()
415 timer_setup(&new_mpath->timer, mesh_path_timer, 0); in mesh_path_new()
423 hlist_del_rcu(&entry->walk_list); in mesh_fast_tx_entry_free()
424 rhashtable_remove_fast(&cache->rht, &entry->rhash, fast_tx_rht_params); in mesh_fast_tx_entry_free()
435 cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_get()
436 entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params); in mesh_fast_tx_get()
440 if (!(entry->mpath->flags & MESH_PATH_ACTIVE) || in mesh_fast_tx_get()
441 mpath_expired(entry->mpath)) { in mesh_fast_tx_get()
442 spin_lock_bh(&cache->walk_lock); in mesh_fast_tx_get()
443 entry = rhashtable_lookup(&cache->rht, key, fast_tx_rht_params); in mesh_fast_tx_get()
446 spin_unlock_bh(&cache->walk_lock); in mesh_fast_tx_get()
450 mesh_path_refresh(sdata, entry->mpath, NULL); in mesh_fast_tx_get()
451 if (entry->mppath) in mesh_fast_tx_get()
452 entry->mppath->exp_time = jiffies; in mesh_fast_tx_get()
453 entry->timestamp = jiffies; in mesh_fast_tx_get()
461 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; in mesh_fast_tx_cache()
472 if (sdata->noack_map || in mesh_fast_tx_cache()
473 !ieee80211_is_data_qos(hdr->frame_control)) in mesh_fast_tx_cache()
476 build.fast_tx.hdr_len = ieee80211_hdrlen(hdr->frame_control); in mesh_fast_tx_cache()
477 meshhdr = (struct ieee80211s_hdr *)(skb->data + build.fast_tx.hdr_len); in mesh_fast_tx_cache()
480 cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_cache()
481 if (atomic_read(&cache->rht.nelems) >= MESH_FAST_TX_CACHE_MAX_SIZE) in mesh_fast_tx_cache()
484 sta = rcu_dereference(mpath->next_hop); in mesh_fast_tx_cache()
489 if ((meshhdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) { in mesh_fast_tx_cache()
490 /* This is required to keep the mppath alive */ in mesh_fast_tx_cache()
491 mppath = mpp_path_lookup(sdata, meshhdr->eaddr1); in mesh_fast_tx_cache()
495 if (!ether_addr_equal(meshhdr->eaddr2, sdata->vif.addr)) in mesh_fast_tx_cache()
497 } else if (ieee80211_has_a4(hdr->frame_control)) { in mesh_fast_tx_cache()
503 if (!ether_addr_equal(hdr->addr4, sdata->vif.addr)) in mesh_fast_tx_cache()
507 if (mppath->fast_tx_check == jiffies) in mesh_fast_tx_cache()
510 mppath->fast_tx_check = jiffies; in mesh_fast_tx_cache()
516 spin_lock_bh(&sta->lock); in mesh_fast_tx_cache()
517 key = rcu_access_pointer(sta->ptk[sta->ptk_idx]); in mesh_fast_tx_cache()
519 key = rcu_access_pointer(sdata->default_unicast_key); in mesh_fast_tx_cache()
525 gen_iv = key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV; in mesh_fast_tx_cache()
526 iv_spc = key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE; in mesh_fast_tx_cache()
528 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) || in mesh_fast_tx_cache()
529 (key->flags & KEY_FLAG_TAINTED)) in mesh_fast_tx_cache()
532 switch (key->conf.cipher) { in mesh_fast_tx_cache()
552 memcpy(build.key.addr, mppath->dst, ETH_ALEN); in mesh_fast_tx_cache()
554 build.fast_tx.band = info->band; in mesh_fast_tx_cache()
565 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); in mesh_fast_tx_cache()
574 spin_lock(&cache->walk_lock); in mesh_fast_tx_cache()
575 prev = rhashtable_lookup_get_insert_fast(&cache->rht, in mesh_fast_tx_cache()
576 &entry->rhash, in mesh_fast_tx_cache()
585 * replacing it with a different type (e.g. mpath -> mpp) in mesh_fast_tx_cache()
588 rhashtable_replace_fast(&cache->rht, &prev->rhash, in mesh_fast_tx_cache()
589 &entry->rhash, fast_tx_rht_params); in mesh_fast_tx_cache()
590 hlist_del_rcu(&prev->walk_list); in mesh_fast_tx_cache()
594 hlist_add_head(&entry->walk_list, &cache->walk_head); in mesh_fast_tx_cache()
597 spin_unlock(&cache->walk_lock); in mesh_fast_tx_cache()
599 spin_unlock_bh(&sta->lock); in mesh_fast_tx_cache()
605 struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_gc()
609 if (atomic_read(&cache->rht.nelems) < MESH_FAST_TX_CACHE_THRESHOLD_SIZE) in mesh_fast_tx_gc()
612 spin_lock_bh(&cache->walk_lock); in mesh_fast_tx_gc()
613 hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) in mesh_fast_tx_gc()
614 if (!time_is_after_jiffies(entry->timestamp + timeout)) in mesh_fast_tx_gc()
616 spin_unlock_bh(&cache->walk_lock); in mesh_fast_tx_gc()
621 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_fast_tx_flush_mpath()
622 struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_flush_mpath()
626 spin_lock_bh(&cache->walk_lock); in mesh_fast_tx_flush_mpath()
627 hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) in mesh_fast_tx_flush_mpath()
628 if (entry->mpath == mpath) in mesh_fast_tx_flush_mpath()
630 spin_unlock_bh(&cache->walk_lock); in mesh_fast_tx_flush_mpath()
636 struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_flush_sta()
640 spin_lock_bh(&cache->walk_lock); in mesh_fast_tx_flush_sta()
641 hlist_for_each_entry_safe(entry, n, &cache->walk_head, walk_list) in mesh_fast_tx_flush_sta()
642 if (rcu_access_pointer(entry->mpath->next_hop) == sta) in mesh_fast_tx_flush_sta()
644 spin_unlock_bh(&cache->walk_lock); in mesh_fast_tx_flush_sta()
650 struct mesh_tx_cache *cache = &sdata->u.mesh.tx_cache; in mesh_fast_tx_flush_addr()
656 spin_lock_bh(&cache->walk_lock); in mesh_fast_tx_flush_addr()
659 entry = rhashtable_lookup_fast(&cache->rht, &key, fast_tx_rht_params); in mesh_fast_tx_flush_addr()
663 spin_unlock_bh(&cache->walk_lock); in mesh_fast_tx_flush_addr()
667 * mesh_path_add - allocate and add a new path to the mesh path table
681 if (ether_addr_equal(dst, sdata->vif.addr)) in mesh_path_add()
683 return ERR_PTR(-ENOTSUPP); in mesh_path_add()
686 return ERR_PTR(-ENOTSUPP); in mesh_path_add()
688 if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0) in mesh_path_add()
689 return ERR_PTR(-ENOSPC); in mesh_path_add()
693 return ERR_PTR(-ENOMEM); in mesh_path_add()
695 tbl = &sdata->u.mesh.mesh_paths; in mesh_path_add()
696 spin_lock_bh(&tbl->walk_lock); in mesh_path_add()
697 mpath = rhashtable_lookup_get_insert_fast(&tbl->rhead, in mesh_path_add()
698 &new_mpath->rhash, in mesh_path_add()
701 hlist_add_head(&new_mpath->walk_list, &tbl->walk_head); in mesh_path_add()
702 spin_unlock_bh(&tbl->walk_lock); in mesh_path_add()
713 sdata->u.mesh.mesh_paths_generation++; in mesh_path_add()
724 if (ether_addr_equal(dst, sdata->vif.addr)) in mpp_path_add()
726 return -ENOTSUPP; in mpp_path_add()
729 return -ENOTSUPP; in mpp_path_add()
734 return -ENOMEM; in mpp_path_add()
736 memcpy(new_mpath->mpp, mpp, ETH_ALEN); in mpp_path_add()
737 tbl = &sdata->u.mesh.mpp_paths; in mpp_path_add()
739 spin_lock_bh(&tbl->walk_lock); in mpp_path_add()
740 ret = rhashtable_lookup_insert_fast(&tbl->rhead, in mpp_path_add()
741 &new_mpath->rhash, in mpp_path_add()
744 hlist_add_head_rcu(&new_mpath->walk_list, &tbl->walk_head); in mpp_path_add()
745 spin_unlock_bh(&tbl->walk_lock); in mpp_path_add()
752 sdata->u.mesh.mpp_paths_generation++; in mpp_path_add()
758 * mesh_plink_broken - deactivates paths and sends perr when a link breaks
767 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_broken()
768 struct mesh_table *tbl = &sdata->u.mesh.mesh_paths; in mesh_plink_broken()
773 hlist_for_each_entry_rcu(mpath, &tbl->walk_head, walk_list) { in mesh_plink_broken()
774 if (rcu_access_pointer(mpath->next_hop) == sta && in mesh_plink_broken()
775 mpath->flags & MESH_PATH_ACTIVE && in mesh_plink_broken()
776 !(mpath->flags & MESH_PATH_FIXED)) { in mesh_plink_broken()
777 spin_lock_bh(&mpath->state_lock); in mesh_plink_broken()
778 mpath->flags &= ~MESH_PATH_ACTIVE; in mesh_plink_broken()
779 ++mpath->sn; in mesh_plink_broken()
780 spin_unlock_bh(&mpath->state_lock); in mesh_plink_broken()
782 sdata->u.mesh.mshcfg.element_ttl, in mesh_plink_broken()
783 mpath->dst, mpath->sn, in mesh_plink_broken()
793 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_free_rcu()
795 spin_lock_bh(&mpath->state_lock); in mesh_path_free_rcu()
796 mpath->flags |= MESH_PATH_RESOLVING | MESH_PATH_DELETED; in mesh_path_free_rcu()
798 spin_unlock_bh(&mpath->state_lock); in mesh_path_free_rcu()
799 timer_shutdown_sync(&mpath->timer); in mesh_path_free_rcu()
800 atomic_dec(&sdata->u.mesh.mpaths); in mesh_path_free_rcu()
801 atomic_dec(&tbl->entries); in mesh_path_free_rcu()
808 hlist_del_rcu(&mpath->walk_list); in __mesh_path_del()
809 rhashtable_remove_fast(&tbl->rhead, &mpath->rhash, mesh_rht_params); in __mesh_path_del()
810 if (tbl == &mpath->sdata->u.mesh.mpp_paths) in __mesh_path_del()
811 mesh_fast_tx_flush_addr(mpath->sdata, mpath->dst); in __mesh_path_del()
818 * mesh_path_flush_by_nexthop - Deletes mesh paths if their next hop matches
830 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_path_flush_by_nexthop()
831 struct mesh_table *tbl = &sdata->u.mesh.mesh_paths; in mesh_path_flush_by_nexthop()
835 spin_lock_bh(&tbl->walk_lock); in mesh_path_flush_by_nexthop()
836 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) { in mesh_path_flush_by_nexthop()
837 if (rcu_access_pointer(mpath->next_hop) == sta) in mesh_path_flush_by_nexthop()
840 spin_unlock_bh(&tbl->walk_lock); in mesh_path_flush_by_nexthop()
846 struct mesh_table *tbl = &sdata->u.mesh.mpp_paths; in mpp_flush_by_proxy()
850 spin_lock_bh(&tbl->walk_lock); in mpp_flush_by_proxy()
851 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) { in mpp_flush_by_proxy()
852 if (ether_addr_equal(mpath->mpp, proxy)) in mpp_flush_by_proxy()
855 spin_unlock_bh(&tbl->walk_lock); in mpp_flush_by_proxy()
863 spin_lock_bh(&tbl->walk_lock); in table_flush_by_iface()
864 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) { in table_flush_by_iface()
867 spin_unlock_bh(&tbl->walk_lock); in table_flush_by_iface()
871 * mesh_path_flush_by_iface - Deletes all mesh paths associated with a given iface
880 table_flush_by_iface(&sdata->u.mesh.mesh_paths); in mesh_path_flush_by_iface()
881 table_flush_by_iface(&sdata->u.mesh.mpp_paths); in mesh_path_flush_by_iface()
885 * table_path_del - delete a path from the mesh or mpp table
899 spin_lock_bh(&tbl->walk_lock); in table_path_del()
900 mpath = rhashtable_lookup_fast(&tbl->rhead, addr, mesh_rht_params); in table_path_del()
902 spin_unlock_bh(&tbl->walk_lock); in table_path_del()
903 return -ENXIO; in table_path_del()
907 spin_unlock_bh(&tbl->walk_lock); in table_path_del()
913 * mesh_path_del - delete a mesh path from the table
927 err = table_path_del(&sdata->u.mesh.mesh_paths, sdata, addr); in mesh_path_del()
928 sdata->u.mesh.mesh_paths_generation++; in mesh_path_del()
933 * mesh_path_tx_pending - sends pending frames in a mesh path queue
942 if (mpath->flags & MESH_PATH_ACTIVE) in mesh_path_tx_pending()
943 ieee80211_add_pending_skbs(mpath->sdata->local, in mesh_path_tx_pending()
944 &mpath->frame_queue); in mesh_path_tx_pending()
948 * mesh_path_send_to_gates - sends pending frames to all known mesh gates
959 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_send_to_gates()
965 tbl = &sdata->u.mesh.mesh_paths; in mesh_path_send_to_gates()
968 hlist_for_each_entry_rcu(gate, &tbl->known_gates, gate_list) { in mesh_path_send_to_gates()
969 if (gate->flags & MESH_PATH_ACTIVE) { in mesh_path_send_to_gates()
970 mpath_dbg(sdata, "Forwarding to %pM\n", gate->dst); in mesh_path_send_to_gates()
976 "Not forwarding to %pM (flags %#x)\n", in mesh_path_send_to_gates()
977 gate->dst, gate->flags); in mesh_path_send_to_gates()
981 hlist_for_each_entry_rcu(gate, &tbl->known_gates, gate_list) { in mesh_path_send_to_gates()
982 mpath_dbg(sdata, "Sending to %pM\n", gate->dst); in mesh_path_send_to_gates()
987 return (from_mpath == mpath) ? -EHOSTUNREACH : 0; in mesh_path_send_to_gates()
991 * mesh_path_discard_frame - discard a frame whose path could not be resolved
1001 ieee80211_free_txskb(&sdata->local->hw, skb); in mesh_path_discard_frame()
1002 sdata->u.mesh.mshstats.dropped_frames_no_route++; in mesh_path_discard_frame()
1006 * mesh_path_flush_pending - free the pending queue of a mesh path
1014 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_flush_pending()
1015 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; in mesh_path_flush_pending()
1019 while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL) in mesh_path_flush_pending()
1020 mesh_path_discard_frame(mpath->sdata, skb); in mesh_path_flush_pending()
1022 spin_lock_bh(&ifmsh->mesh_preq_queue_lock); in mesh_path_flush_pending()
1023 list_for_each_entry_safe(preq, tmp, &ifmsh->preq_queue.list, list) { in mesh_path_flush_pending()
1024 if (ether_addr_equal(mpath->dst, preq->dst)) { in mesh_path_flush_pending()
1025 list_del(&preq->list); in mesh_path_flush_pending()
1027 --ifmsh->preq_queue_len; in mesh_path_flush_pending()
1030 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); in mesh_path_flush_pending()
1034 * mesh_path_fix_nexthop - force a specific next hop for a mesh path
1039 * Locking: this function must be called holding mpath->state_lock
1043 spin_lock_bh(&mpath->state_lock); in mesh_path_fix_nexthop()
1045 mpath->sn = 0xffff; in mesh_path_fix_nexthop()
1046 mpath->metric = 0; in mesh_path_fix_nexthop()
1047 mpath->hop_count = 0; in mesh_path_fix_nexthop()
1048 mpath->exp_time = 0; in mesh_path_fix_nexthop()
1049 mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; in mesh_path_fix_nexthop()
1052 spin_unlock_bh(&mpath->state_lock); in mesh_path_fix_nexthop()
1053 ewma_mesh_fail_avg_init(&next_hop->mesh->fail_avg); in mesh_path_fix_nexthop()
1054 /* init it at a low value - 0 start is tricky */ in mesh_path_fix_nexthop()
1055 ewma_mesh_fail_avg_add(&next_hop->mesh->fail_avg, 1); in mesh_path_fix_nexthop()
1061 mesh_table_init(&sdata->u.mesh.mesh_paths); in mesh_pathtbl_init()
1062 mesh_table_init(&sdata->u.mesh.mpp_paths); in mesh_pathtbl_init()
1073 spin_lock_bh(&tbl->walk_lock); in mesh_path_tbl_expire()
1074 hlist_for_each_entry_safe(mpath, n, &tbl->walk_head, walk_list) { in mesh_path_tbl_expire()
1075 if ((!(mpath->flags & MESH_PATH_RESOLVING)) && in mesh_path_tbl_expire()
1076 (!(mpath->flags & MESH_PATH_FIXED)) && in mesh_path_tbl_expire()
1077 time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) in mesh_path_tbl_expire()
1080 spin_unlock_bh(&tbl->walk_lock); in mesh_path_tbl_expire()
1085 mesh_path_tbl_expire(sdata, &sdata->u.mesh.mesh_paths); in mesh_path_expire()
1086 mesh_path_tbl_expire(sdata, &sdata->u.mesh.mpp_paths); in mesh_path_expire()
1092 mesh_table_free(&sdata->u.mesh.mesh_paths); in mesh_pathtbl_unregister()
1093 mesh_table_free(&sdata->u.mesh.mpp_paths); in mesh_pathtbl_unregister()