Lines Matching refs:mpath
27 static inline bool mpath_expired(struct mesh_path *mpath) in mpath_expired() argument
29 return (mpath->flags & MESH_PATH_ACTIVE) && in mpath_expired()
30 time_after(jiffies, mpath->exp_time) && in mpath_expired()
31 !(mpath->flags & MESH_PATH_FIXED); in mpath_expired()
40 struct mesh_path *mpath; member
206 void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) in mesh_path_assign_nexthop() argument
212 rcu_assign_pointer(mpath->next_hop, sta); in mesh_path_assign_nexthop()
214 spin_lock_irqsave(&mpath->frame_queue.lock, flags); in mesh_path_assign_nexthop()
215 skb_queue_walk(&mpath->frame_queue, skb) { in mesh_path_assign_nexthop()
218 memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); in mesh_path_assign_nexthop()
222 spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); in mesh_path_assign_nexthop()
338 struct mesh_path *mpath; in mpath_lookup() local
344 mpath = node->mpath; in mpath_lookup()
345 if (mpath->sdata == sdata && in mpath_lookup()
346 ether_addr_equal(dst, mpath->dst)) { in mpath_lookup()
347 if (mpath_expired(mpath)) { in mpath_lookup()
348 spin_lock_bh(&mpath->state_lock); in mpath_lookup()
349 mpath->flags &= ~MESH_PATH_ACTIVE; in mpath_lookup()
350 spin_unlock_bh(&mpath->state_lock); in mpath_lookup()
352 return mpath; in mpath_lookup()
398 if (sdata && node->mpath->sdata != sdata) in mesh_path_lookup_by_idx()
401 if (mpath_expired(node->mpath)) { in mesh_path_lookup_by_idx()
402 spin_lock_bh(&node->mpath->state_lock); in mesh_path_lookup_by_idx()
403 node->mpath->flags &= ~MESH_PATH_ACTIVE; in mesh_path_lookup_by_idx()
404 spin_unlock_bh(&node->mpath->state_lock); in mesh_path_lookup_by_idx()
406 return node->mpath; in mesh_path_lookup_by_idx()
431 if (sdata && node->mpath->sdata != sdata) in mpp_path_lookup_by_idx()
434 return node->mpath; in mpp_path_lookup_by_idx()
444 int mesh_path_add_gate(struct mesh_path *mpath) in mesh_path_add_gate() argument
454 if (gate->mpath == mpath) { in mesh_path_add_gate()
465 mpath->is_gate = true; in mesh_path_add_gate()
466 mpath->sdata->u.mesh.num_gates++; in mesh_path_add_gate()
467 new_gate->mpath = mpath; in mesh_path_add_gate()
471 mpath_dbg(mpath->sdata, in mesh_path_add_gate()
473 mpath->dst, mpath->sdata->u.mesh.num_gates); in mesh_path_add_gate()
487 static void mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath) in mesh_gate_del() argument
493 if (gate->mpath != mpath) in mesh_gate_del()
499 mpath->sdata->u.mesh.num_gates--; in mesh_gate_del()
500 mpath->is_gate = false; in mesh_gate_del()
501 mpath_dbg(mpath->sdata, in mesh_gate_del()
503 mpath->dst, mpath->sdata->u.mesh.num_gates); in mesh_gate_del()
532 struct mesh_path *mpath, *new_mpath; in mesh_path_add() local
558 mpath = node->mpath; in mesh_path_add()
559 if (mpath->sdata == sdata && in mesh_path_add()
560 ether_addr_equal(dst, mpath->dst)) in mesh_path_add()
579 new_node->mpath = new_mpath; in mesh_path_add()
597 mpath = new_mpath; in mesh_path_add()
601 return mpath; in mesh_path_add()
666 struct mesh_path *mpath, *new_mpath; in mpp_path_add() local
695 new_node->mpath = new_mpath; in mpp_path_add()
709 mpath = node->mpath; in mpp_path_add()
710 if (mpath->sdata == sdata && in mpp_path_add()
711 ether_addr_equal(dst, mpath->dst)) in mpp_path_add()
754 struct mesh_path *mpath; in mesh_plink_broken() local
762 mpath = node->mpath; in mesh_plink_broken()
763 if (rcu_access_pointer(mpath->next_hop) == sta && in mesh_plink_broken()
764 mpath->flags & MESH_PATH_ACTIVE && in mesh_plink_broken()
765 !(mpath->flags & MESH_PATH_FIXED)) { in mesh_plink_broken()
766 spin_lock_bh(&mpath->state_lock); in mesh_plink_broken()
767 mpath->flags &= ~MESH_PATH_ACTIVE; in mesh_plink_broken()
768 ++mpath->sn; in mesh_plink_broken()
769 spin_unlock_bh(&mpath->state_lock); in mesh_plink_broken()
772 mpath->dst, mpath->sn, in mesh_plink_broken()
782 struct ieee80211_sub_if_data *sdata = node->mpath->sdata; in mesh_path_node_reclaim()
784 del_timer_sync(&node->mpath->timer); in mesh_path_node_reclaim()
786 kfree(node->mpath); in mesh_path_node_reclaim()
793 struct mesh_path *mpath; in __mesh_path_del() local
794 mpath = node->mpath; in __mesh_path_del()
795 spin_lock(&mpath->state_lock); in __mesh_path_del()
796 mpath->flags |= MESH_PATH_RESOLVING; in __mesh_path_del()
797 if (mpath->is_gate) in __mesh_path_del()
798 mesh_gate_del(tbl, mpath); in __mesh_path_del()
801 spin_unlock(&mpath->state_lock); in __mesh_path_del()
819 struct mesh_path *mpath; in mesh_path_flush_by_nexthop() local
827 mpath = node->mpath; in mesh_path_flush_by_nexthop()
828 if (rcu_access_pointer(mpath->next_hop) == sta) { in mesh_path_flush_by_nexthop()
841 struct mesh_path *mpath; in table_flush_by_iface() local
847 mpath = node->mpath; in table_flush_by_iface()
848 if (mpath->sdata != sdata) in table_flush_by_iface()
889 struct mesh_path *mpath; in mesh_path_del() local
902 mpath = node->mpath; in mesh_path_del()
903 if (mpath->sdata == sdata && in mesh_path_del()
904 ether_addr_equal(addr, mpath->dst)) { in mesh_path_del()
926 void mesh_path_tx_pending(struct mesh_path *mpath) in mesh_path_tx_pending() argument
928 if (mpath->flags & MESH_PATH_ACTIVE) in mesh_path_tx_pending()
929 ieee80211_add_pending_skbs(mpath->sdata->local, in mesh_path_tx_pending()
930 &mpath->frame_queue); in mesh_path_tx_pending()
943 int mesh_path_send_to_gates(struct mesh_path *mpath) in mesh_path_send_to_gates() argument
945 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_send_to_gates()
947 struct mesh_path *from_mpath = mpath; in mesh_path_send_to_gates()
961 if (gate->mpath->sdata != sdata) in mesh_path_send_to_gates()
964 if (gate->mpath->flags & MESH_PATH_ACTIVE) { in mesh_path_send_to_gates()
965 mpath_dbg(sdata, "Forwarding to %pM\n", gate->mpath->dst); in mesh_path_send_to_gates()
966 mesh_path_move_to_queue(gate->mpath, from_mpath, copy); in mesh_path_send_to_gates()
967 from_mpath = gate->mpath; in mesh_path_send_to_gates()
972 gate->mpath, gate->mpath->flags); in mesh_path_send_to_gates()
977 if (gate->mpath->sdata == sdata) { in mesh_path_send_to_gates()
978 mpath_dbg(sdata, "Sending to %pM\n", gate->mpath->dst); in mesh_path_send_to_gates()
979 mesh_path_tx_pending(gate->mpath); in mesh_path_send_to_gates()
982 return (from_mpath == mpath) ? -EHOSTUNREACH : 0; in mesh_path_send_to_gates()
1007 void mesh_path_flush_pending(struct mesh_path *mpath) in mesh_path_flush_pending() argument
1011 while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL) in mesh_path_flush_pending()
1012 mesh_path_discard_frame(mpath->sdata, skb); in mesh_path_flush_pending()
1023 void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop) in mesh_path_fix_nexthop() argument
1025 spin_lock_bh(&mpath->state_lock); in mesh_path_fix_nexthop()
1026 mesh_path_assign_nexthop(mpath, next_hop); in mesh_path_fix_nexthop()
1027 mpath->sn = 0xffff; in mesh_path_fix_nexthop()
1028 mpath->metric = 0; in mesh_path_fix_nexthop()
1029 mpath->hop_count = 0; in mesh_path_fix_nexthop()
1030 mpath->exp_time = 0; in mesh_path_fix_nexthop()
1031 mpath->flags |= MESH_PATH_FIXED; in mesh_path_fix_nexthop()
1032 mesh_path_activate(mpath); in mesh_path_fix_nexthop()
1033 spin_unlock_bh(&mpath->state_lock); in mesh_path_fix_nexthop()
1034 mesh_path_tx_pending(mpath); in mesh_path_fix_nexthop()
1039 struct mesh_path *mpath; in mesh_path_node_free() local
1041 mpath = node->mpath; in mesh_path_node_free()
1044 del_timer_sync(&mpath->timer); in mesh_path_node_free()
1045 kfree(mpath); in mesh_path_node_free()
1052 struct mesh_path *mpath; in mesh_path_node_copy() local
1061 mpath = node->mpath; in mesh_path_node_copy()
1062 new_node->mpath = mpath; in mesh_path_node_copy()
1063 hash_idx = mesh_table_hash(mpath->dst, mpath->sdata, newtbl); in mesh_path_node_copy()
1119 struct mesh_path *mpath; in mesh_path_expire() local
1126 if (node->mpath->sdata != sdata) in mesh_path_expire()
1128 mpath = node->mpath; in mesh_path_expire()
1129 if ((!(mpath->flags & MESH_PATH_RESOLVING)) && in mesh_path_expire()
1130 (!(mpath->flags & MESH_PATH_FIXED)) && in mesh_path_expire()
1131 time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) in mesh_path_expire()
1132 mesh_path_del(mpath->sdata, mpath->dst); in mesh_path_expire()