Lines Matching refs:mpath
377 struct mesh_path *mpath; in hwmp_route_info_get() local
431 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_route_info_get()
432 if (mpath) { in hwmp_route_info_get()
433 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
434 if (mpath->flags & MESH_PATH_FIXED) in hwmp_route_info_get()
436 else if ((mpath->flags & MESH_PATH_ACTIVE) && in hwmp_route_info_get()
437 (mpath->flags & MESH_PATH_SN_VALID)) { in hwmp_route_info_get()
438 if (SN_GT(mpath->sn, orig_sn) || in hwmp_route_info_get()
439 (mpath->sn == orig_sn && in hwmp_route_info_get()
440 new_metric >= mpath->metric)) { in hwmp_route_info_get()
446 mpath = mesh_path_add(sdata, orig_addr); in hwmp_route_info_get()
447 if (IS_ERR(mpath)) { in hwmp_route_info_get()
451 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
455 mesh_path_assign_nexthop(mpath, sta); in hwmp_route_info_get()
456 mpath->flags |= MESH_PATH_SN_VALID; in hwmp_route_info_get()
457 mpath->metric = new_metric; in hwmp_route_info_get()
458 mpath->sn = orig_sn; in hwmp_route_info_get()
459 mpath->exp_time = time_after(mpath->exp_time, exp_time) in hwmp_route_info_get()
460 ? mpath->exp_time : exp_time; in hwmp_route_info_get()
461 mesh_path_activate(mpath); in hwmp_route_info_get()
462 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
463 mesh_path_tx_pending(mpath); in hwmp_route_info_get()
468 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
478 mpath = mesh_path_lookup(sdata, ta); in hwmp_route_info_get()
479 if (mpath) { in hwmp_route_info_get()
480 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
481 if ((mpath->flags & MESH_PATH_FIXED) || in hwmp_route_info_get()
482 ((mpath->flags & MESH_PATH_ACTIVE) && in hwmp_route_info_get()
483 (last_hop_metric > mpath->metric))) in hwmp_route_info_get()
486 mpath = mesh_path_add(sdata, ta); in hwmp_route_info_get()
487 if (IS_ERR(mpath)) { in hwmp_route_info_get()
491 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
495 mesh_path_assign_nexthop(mpath, sta); in hwmp_route_info_get()
496 mpath->metric = last_hop_metric; in hwmp_route_info_get()
497 mpath->exp_time = time_after(mpath->exp_time, exp_time) in hwmp_route_info_get()
498 ? mpath->exp_time : exp_time; in hwmp_route_info_get()
499 mesh_path_activate(mpath); in hwmp_route_info_get()
500 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
501 mesh_path_tx_pending(mpath); in hwmp_route_info_get()
503 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
516 struct mesh_path *mpath = NULL; in hwmp_preq_frame_process() local
553 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_preq_frame_process()
554 if (mpath) { in hwmp_preq_frame_process()
563 mesh_path_add_gate(mpath); in hwmp_preq_frame_process()
568 mpath = mesh_path_lookup(sdata, target_addr); in hwmp_preq_frame_process()
569 if (mpath) { in hwmp_preq_frame_process()
570 if ((!(mpath->flags & MESH_PATH_SN_VALID)) || in hwmp_preq_frame_process()
571 SN_LT(mpath->sn, target_sn)) { in hwmp_preq_frame_process()
572 mpath->sn = target_sn; in hwmp_preq_frame_process()
573 mpath->flags |= MESH_PATH_SN_VALID; in hwmp_preq_frame_process()
575 (mpath->flags & MESH_PATH_ACTIVE)) { in hwmp_preq_frame_process()
577 metric = mpath->metric; in hwmp_preq_frame_process()
578 target_sn = mpath->sn; in hwmp_preq_frame_process()
616 da = (mpath && mpath->is_root) ? in hwmp_preq_frame_process()
617 mpath->rann_snd_addr : broadcast_addr; in hwmp_preq_frame_process()
639 next_hop_deref_protected(struct mesh_path *mpath) in next_hop_deref_protected() argument
641 return rcu_dereference_protected(mpath->next_hop, in next_hop_deref_protected()
642 lockdep_is_held(&mpath->state_lock)); in next_hop_deref_protected()
651 struct mesh_path *mpath; in hwmp_prep_frame_process() local
675 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_prep_frame_process()
676 if (mpath) in hwmp_prep_frame_process()
677 spin_lock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
680 if (!(mpath->flags & MESH_PATH_ACTIVE)) { in hwmp_prep_frame_process()
681 spin_unlock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
684 memcpy(next_hop, next_hop_deref_protected(mpath)->sta.addr, ETH_ALEN); in hwmp_prep_frame_process()
685 spin_unlock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
713 struct mesh_path *mpath; in hwmp_perr_frame_process() local
731 mpath = mesh_path_lookup(sdata, target_addr); in hwmp_perr_frame_process()
732 if (mpath) { in hwmp_perr_frame_process()
735 spin_lock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
736 sta = next_hop_deref_protected(mpath); in hwmp_perr_frame_process()
737 if (mpath->flags & MESH_PATH_ACTIVE && in hwmp_perr_frame_process()
739 (!(mpath->flags & MESH_PATH_SN_VALID) || in hwmp_perr_frame_process()
740 SN_GT(target_sn, mpath->sn))) { in hwmp_perr_frame_process()
741 mpath->flags &= ~MESH_PATH_ACTIVE; in hwmp_perr_frame_process()
742 mpath->sn = target_sn; in hwmp_perr_frame_process()
743 spin_unlock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
750 spin_unlock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
763 struct mesh_path *mpath; in hwmp_rann_frame_process() local
796 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_rann_frame_process()
797 if (!mpath) { in hwmp_rann_frame_process()
798 mpath = mesh_path_add(sdata, orig_addr); in hwmp_rann_frame_process()
799 if (IS_ERR(mpath)) { in hwmp_rann_frame_process()
806 if (!(SN_LT(mpath->sn, orig_sn)) && in hwmp_rann_frame_process()
807 !(mpath->sn == orig_sn && metric < mpath->rann_metric)) { in hwmp_rann_frame_process()
812 if ((!(mpath->flags & (MESH_PATH_ACTIVE | MESH_PATH_RESOLVING)) || in hwmp_rann_frame_process()
813 (time_after(jiffies, mpath->last_preq_to_root + in hwmp_rann_frame_process()
815 time_before(jiffies, mpath->last_preq_to_root))) && in hwmp_rann_frame_process()
816 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) { in hwmp_rann_frame_process()
820 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); in hwmp_rann_frame_process()
821 mpath->last_preq_to_root = jiffies; in hwmp_rann_frame_process()
824 mpath->sn = orig_sn; in hwmp_rann_frame_process()
825 mpath->rann_metric = metric + metric_txsta; in hwmp_rann_frame_process()
826 mpath->is_root = true; in hwmp_rann_frame_process()
829 memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN); in hwmp_rann_frame_process()
832 mesh_path_add_gate(mpath); in hwmp_rann_frame_process()
915 static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) in mesh_queue_preq() argument
917 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_queue_preq()
936 spin_lock(&mpath->state_lock); in mesh_queue_preq()
937 if (mpath->flags & MESH_PATH_REQ_QUEUED) { in mesh_queue_preq()
938 spin_unlock(&mpath->state_lock); in mesh_queue_preq()
944 memcpy(preq_node->dst, mpath->dst, ETH_ALEN); in mesh_queue_preq()
947 mpath->flags |= MESH_PATH_REQ_QUEUED; in mesh_queue_preq()
948 spin_unlock(&mpath->state_lock); in mesh_queue_preq()
977 struct mesh_path *mpath; in mesh_path_start_discovery() local
997 mpath = mesh_path_lookup(sdata, preq_node->dst); in mesh_path_start_discovery()
998 if (!mpath) in mesh_path_start_discovery()
1001 spin_lock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1002 mpath->flags &= ~MESH_PATH_REQ_QUEUED; in mesh_path_start_discovery()
1004 if (mpath->flags & MESH_PATH_RESOLVING) { in mesh_path_start_discovery()
1005 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1008 mpath->flags &= ~MESH_PATH_RESOLVED; in mesh_path_start_discovery()
1009 mpath->flags |= MESH_PATH_RESOLVING; in mesh_path_start_discovery()
1010 mpath->discovery_retries = 0; in mesh_path_start_discovery()
1011 mpath->discovery_timeout = disc_timeout_jiff(sdata); in mesh_path_start_discovery()
1013 } else if (!(mpath->flags & MESH_PATH_RESOLVING) || in mesh_path_start_discovery()
1014 mpath->flags & MESH_PATH_RESOLVED) { in mesh_path_start_discovery()
1015 mpath->flags &= ~MESH_PATH_RESOLVING; in mesh_path_start_discovery()
1016 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1032 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1041 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1042 da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr; in mesh_path_start_discovery()
1044 target_flags, mpath->dst, mpath->sn, da, 0, in mesh_path_start_discovery()
1046 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); in mesh_path_start_discovery()
1070 struct mesh_path *mpath; in mesh_nexthop_resolve() local
1085 mpath = mesh_path_lookup(sdata, target_addr); in mesh_nexthop_resolve()
1086 if (!mpath) { in mesh_nexthop_resolve()
1087 mpath = mesh_path_add(sdata, target_addr); in mesh_nexthop_resolve()
1088 if (IS_ERR(mpath)) { in mesh_nexthop_resolve()
1090 err = PTR_ERR(mpath); in mesh_nexthop_resolve()
1095 if (!(mpath->flags & MESH_PATH_RESOLVING)) in mesh_nexthop_resolve()
1096 mesh_queue_preq(mpath, PREQ_Q_F_START); in mesh_nexthop_resolve()
1098 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) in mesh_nexthop_resolve()
1099 skb_to_free = skb_dequeue(&mpath->frame_queue); in mesh_nexthop_resolve()
1103 skb_queue_tail(&mpath->frame_queue, skb); in mesh_nexthop_resolve()
1126 struct mesh_path *mpath; in mesh_nexthop_lookup() local
1133 mpath = mesh_path_lookup(sdata, target_addr); in mesh_nexthop_lookup()
1135 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) in mesh_nexthop_lookup()
1139 mpath->exp_time - in mesh_nexthop_lookup()
1142 !(mpath->flags & MESH_PATH_RESOLVING) && in mesh_nexthop_lookup()
1143 !(mpath->flags & MESH_PATH_FIXED)) in mesh_nexthop_lookup()
1144 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); in mesh_nexthop_lookup()
1146 next_hop = rcu_dereference(mpath->next_hop); in mesh_nexthop_lookup()
1161 struct mesh_path *mpath = (void *) data; in mesh_path_timer() local
1162 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_timer()
1168 spin_lock_bh(&mpath->state_lock); in mesh_path_timer()
1169 if (mpath->flags & MESH_PATH_RESOLVED || in mesh_path_timer()
1170 (!(mpath->flags & MESH_PATH_RESOLVING))) { in mesh_path_timer()
1171 mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); in mesh_path_timer()
1172 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1173 } else if (mpath->discovery_retries < max_preq_retries(sdata)) { in mesh_path_timer()
1174 ++mpath->discovery_retries; in mesh_path_timer()
1175 mpath->discovery_timeout *= 2; in mesh_path_timer()
1176 mpath->flags &= ~MESH_PATH_REQ_QUEUED; in mesh_path_timer()
1177 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1178 mesh_queue_preq(mpath, 0); in mesh_path_timer()
1180 mpath->flags = 0; in mesh_path_timer()
1181 mpath->exp_time = jiffies; in mesh_path_timer()
1182 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1183 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { in mesh_path_timer()
1184 ret = mesh_path_send_to_gates(mpath); in mesh_path_timer()
1188 mesh_path_flush_pending(mpath); in mesh_path_timer()