• Home
  • Raw
  • Download

Lines Matching refs:mpath

381 	struct mesh_path *mpath;  in hwmp_route_info_get()  local
435 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_route_info_get()
436 if (mpath) { in hwmp_route_info_get()
437 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
438 if (mpath->flags & MESH_PATH_FIXED) in hwmp_route_info_get()
440 else if ((mpath->flags & MESH_PATH_ACTIVE) && in hwmp_route_info_get()
441 (mpath->flags & MESH_PATH_SN_VALID)) { in hwmp_route_info_get()
442 if (SN_GT(mpath->sn, orig_sn) || in hwmp_route_info_get()
443 (mpath->sn == orig_sn && in hwmp_route_info_get()
444 new_metric >= mpath->metric)) { in hwmp_route_info_get()
448 } else if (!(mpath->flags & MESH_PATH_ACTIVE)) { in hwmp_route_info_get()
451 have_sn = mpath->flags & MESH_PATH_SN_VALID; in hwmp_route_info_get()
452 newer_sn = have_sn && SN_GT(orig_sn, mpath->sn); in hwmp_route_info_get()
454 (SN_DELTA(orig_sn, mpath->sn) > in hwmp_route_info_get()
470 mpath = mesh_path_add(sdata, orig_addr); in hwmp_route_info_get()
471 if (IS_ERR(mpath)) { in hwmp_route_info_get()
475 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
479 mesh_path_assign_nexthop(mpath, sta); in hwmp_route_info_get()
480 mpath->flags |= MESH_PATH_SN_VALID; in hwmp_route_info_get()
481 mpath->metric = new_metric; in hwmp_route_info_get()
482 mpath->sn = orig_sn; in hwmp_route_info_get()
483 mpath->exp_time = time_after(mpath->exp_time, exp_time) in hwmp_route_info_get()
484 ? mpath->exp_time : exp_time; in hwmp_route_info_get()
485 mesh_path_activate(mpath); in hwmp_route_info_get()
486 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
487 mesh_path_tx_pending(mpath); in hwmp_route_info_get()
492 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
502 mpath = mesh_path_lookup(sdata, ta); in hwmp_route_info_get()
503 if (mpath) { in hwmp_route_info_get()
504 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
505 if ((mpath->flags & MESH_PATH_FIXED) || in hwmp_route_info_get()
506 ((mpath->flags & MESH_PATH_ACTIVE) && in hwmp_route_info_get()
507 (last_hop_metric > mpath->metric))) in hwmp_route_info_get()
510 mpath = mesh_path_add(sdata, ta); in hwmp_route_info_get()
511 if (IS_ERR(mpath)) { in hwmp_route_info_get()
515 spin_lock_bh(&mpath->state_lock); in hwmp_route_info_get()
519 mesh_path_assign_nexthop(mpath, sta); in hwmp_route_info_get()
520 mpath->metric = last_hop_metric; in hwmp_route_info_get()
521 mpath->exp_time = time_after(mpath->exp_time, exp_time) in hwmp_route_info_get()
522 ? mpath->exp_time : exp_time; in hwmp_route_info_get()
523 mesh_path_activate(mpath); in hwmp_route_info_get()
524 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
525 mesh_path_tx_pending(mpath); in hwmp_route_info_get()
527 spin_unlock_bh(&mpath->state_lock); in hwmp_route_info_get()
540 struct mesh_path *mpath = NULL; in hwmp_preq_frame_process() local
576 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_preq_frame_process()
577 if (mpath) { in hwmp_preq_frame_process()
586 mesh_path_add_gate(mpath); in hwmp_preq_frame_process()
591 mpath = mesh_path_lookup(sdata, target_addr); in hwmp_preq_frame_process()
592 if (mpath) { in hwmp_preq_frame_process()
593 if ((!(mpath->flags & MESH_PATH_SN_VALID)) || in hwmp_preq_frame_process()
594 SN_LT(mpath->sn, target_sn)) { in hwmp_preq_frame_process()
595 mpath->sn = target_sn; in hwmp_preq_frame_process()
596 mpath->flags |= MESH_PATH_SN_VALID; in hwmp_preq_frame_process()
598 (mpath->flags & MESH_PATH_ACTIVE)) { in hwmp_preq_frame_process()
600 target_metric = mpath->metric; in hwmp_preq_frame_process()
601 target_sn = mpath->sn; in hwmp_preq_frame_process()
638 da = (mpath && mpath->is_root) ? in hwmp_preq_frame_process()
639 mpath->rann_snd_addr : broadcast_addr; in hwmp_preq_frame_process()
660 next_hop_deref_protected(struct mesh_path *mpath) in next_hop_deref_protected() argument
662 return rcu_dereference_protected(mpath->next_hop, in next_hop_deref_protected()
663 lockdep_is_held(&mpath->state_lock)); in next_hop_deref_protected()
672 struct mesh_path *mpath; in hwmp_prep_frame_process() local
696 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_prep_frame_process()
697 if (mpath) in hwmp_prep_frame_process()
698 spin_lock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
701 if (!(mpath->flags & MESH_PATH_ACTIVE)) { in hwmp_prep_frame_process()
702 spin_unlock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
705 memcpy(next_hop, next_hop_deref_protected(mpath)->sta.addr, ETH_ALEN); in hwmp_prep_frame_process()
706 spin_unlock_bh(&mpath->state_lock); in hwmp_prep_frame_process()
734 struct mesh_path *mpath; in hwmp_perr_frame_process() local
752 mpath = mesh_path_lookup(sdata, target_addr); in hwmp_perr_frame_process()
753 if (mpath) { in hwmp_perr_frame_process()
756 spin_lock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
757 sta = next_hop_deref_protected(mpath); in hwmp_perr_frame_process()
758 if (mpath->flags & MESH_PATH_ACTIVE && in hwmp_perr_frame_process()
760 !(mpath->flags & MESH_PATH_FIXED) && in hwmp_perr_frame_process()
761 (!(mpath->flags & MESH_PATH_SN_VALID) || in hwmp_perr_frame_process()
762 SN_GT(target_sn, mpath->sn) || target_sn == 0)) { in hwmp_perr_frame_process()
763 mpath->flags &= ~MESH_PATH_ACTIVE; in hwmp_perr_frame_process()
765 mpath->sn = target_sn; in hwmp_perr_frame_process()
767 mpath->sn += 1; in hwmp_perr_frame_process()
768 spin_unlock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
775 spin_unlock_bh(&mpath->state_lock); in hwmp_perr_frame_process()
788 struct mesh_path *mpath; in hwmp_rann_frame_process() local
824 mpath = mesh_path_lookup(sdata, orig_addr); in hwmp_rann_frame_process()
825 if (!mpath) { in hwmp_rann_frame_process()
826 mpath = mesh_path_add(sdata, orig_addr); in hwmp_rann_frame_process()
827 if (IS_ERR(mpath)) { in hwmp_rann_frame_process()
834 if (!(SN_LT(mpath->sn, orig_sn)) && in hwmp_rann_frame_process()
835 !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) { in hwmp_rann_frame_process()
840 if ((!(mpath->flags & (MESH_PATH_ACTIVE | MESH_PATH_RESOLVING)) || in hwmp_rann_frame_process()
841 (time_after(jiffies, mpath->last_preq_to_root + in hwmp_rann_frame_process()
843 time_before(jiffies, mpath->last_preq_to_root))) && in hwmp_rann_frame_process()
844 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) { in hwmp_rann_frame_process()
848 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); in hwmp_rann_frame_process()
849 mpath->last_preq_to_root = jiffies; in hwmp_rann_frame_process()
852 mpath->sn = orig_sn; in hwmp_rann_frame_process()
853 mpath->rann_metric = new_metric; in hwmp_rann_frame_process()
854 mpath->is_root = true; in hwmp_rann_frame_process()
857 memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN); in hwmp_rann_frame_process()
860 mesh_path_add_gate(mpath); in hwmp_rann_frame_process()
943 static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) in mesh_queue_preq() argument
945 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_queue_preq()
964 spin_lock(&mpath->state_lock); in mesh_queue_preq()
965 if (mpath->flags & MESH_PATH_REQ_QUEUED) { in mesh_queue_preq()
966 spin_unlock(&mpath->state_lock); in mesh_queue_preq()
972 memcpy(preq_node->dst, mpath->dst, ETH_ALEN); in mesh_queue_preq()
975 mpath->flags |= MESH_PATH_REQ_QUEUED; in mesh_queue_preq()
976 spin_unlock(&mpath->state_lock); in mesh_queue_preq()
1005 struct mesh_path *mpath; in mesh_path_start_discovery() local
1025 mpath = mesh_path_lookup(sdata, preq_node->dst); in mesh_path_start_discovery()
1026 if (!mpath) in mesh_path_start_discovery()
1029 spin_lock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1030 if (mpath->flags & (MESH_PATH_DELETED | MESH_PATH_FIXED)) { in mesh_path_start_discovery()
1031 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1034 mpath->flags &= ~MESH_PATH_REQ_QUEUED; in mesh_path_start_discovery()
1036 if (mpath->flags & MESH_PATH_RESOLVING) { in mesh_path_start_discovery()
1037 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1040 mpath->flags &= ~MESH_PATH_RESOLVED; in mesh_path_start_discovery()
1041 mpath->flags |= MESH_PATH_RESOLVING; in mesh_path_start_discovery()
1042 mpath->discovery_retries = 0; in mesh_path_start_discovery()
1043 mpath->discovery_timeout = disc_timeout_jiff(sdata); in mesh_path_start_discovery()
1045 } else if (!(mpath->flags & MESH_PATH_RESOLVING) || in mesh_path_start_discovery()
1046 mpath->flags & MESH_PATH_RESOLVED) { in mesh_path_start_discovery()
1047 mpath->flags &= ~MESH_PATH_RESOLVING; in mesh_path_start_discovery()
1048 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1064 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1073 spin_unlock_bh(&mpath->state_lock); in mesh_path_start_discovery()
1074 da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr; in mesh_path_start_discovery()
1076 target_flags, mpath->dst, mpath->sn, da, 0, in mesh_path_start_discovery()
1078 mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); in mesh_path_start_discovery()
1102 struct mesh_path *mpath; in mesh_nexthop_resolve() local
1117 mpath = mesh_path_lookup(sdata, target_addr); in mesh_nexthop_resolve()
1118 if (!mpath) { in mesh_nexthop_resolve()
1119 mpath = mesh_path_add(sdata, target_addr); in mesh_nexthop_resolve()
1120 if (IS_ERR(mpath)) { in mesh_nexthop_resolve()
1122 err = PTR_ERR(mpath); in mesh_nexthop_resolve()
1127 if (!(mpath->flags & MESH_PATH_RESOLVING)) in mesh_nexthop_resolve()
1128 mesh_queue_preq(mpath, PREQ_Q_F_START); in mesh_nexthop_resolve()
1130 if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) in mesh_nexthop_resolve()
1131 skb_to_free = skb_dequeue(&mpath->frame_queue); in mesh_nexthop_resolve()
1135 skb_queue_tail(&mpath->frame_queue, skb); in mesh_nexthop_resolve()
1158 struct mesh_path *mpath; in mesh_nexthop_lookup() local
1165 mpath = mesh_path_lookup(sdata, target_addr); in mesh_nexthop_lookup()
1167 if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) in mesh_nexthop_lookup()
1171 mpath->exp_time - in mesh_nexthop_lookup()
1174 !(mpath->flags & MESH_PATH_RESOLVING) && in mesh_nexthop_lookup()
1175 !(mpath->flags & MESH_PATH_FIXED)) in mesh_nexthop_lookup()
1176 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); in mesh_nexthop_lookup()
1178 next_hop = rcu_dereference(mpath->next_hop); in mesh_nexthop_lookup()
1193 struct mesh_path *mpath = (void *) data; in mesh_path_timer() local
1194 struct ieee80211_sub_if_data *sdata = mpath->sdata; in mesh_path_timer()
1200 spin_lock_bh(&mpath->state_lock); in mesh_path_timer()
1201 if (mpath->flags & MESH_PATH_RESOLVED || in mesh_path_timer()
1202 (!(mpath->flags & MESH_PATH_RESOLVING))) { in mesh_path_timer()
1203 mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); in mesh_path_timer()
1204 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1205 } else if (mpath->discovery_retries < max_preq_retries(sdata)) { in mesh_path_timer()
1206 ++mpath->discovery_retries; in mesh_path_timer()
1207 mpath->discovery_timeout *= 2; in mesh_path_timer()
1208 mpath->flags &= ~MESH_PATH_REQ_QUEUED; in mesh_path_timer()
1209 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1210 mesh_queue_preq(mpath, 0); in mesh_path_timer()
1212 mpath->flags &= ~(MESH_PATH_RESOLVING | in mesh_path_timer()
1215 mpath->exp_time = jiffies; in mesh_path_timer()
1216 spin_unlock_bh(&mpath->state_lock); in mesh_path_timer()
1217 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { in mesh_path_timer()
1218 ret = mesh_path_send_to_gates(mpath); in mesh_path_timer()
1222 mesh_path_flush_pending(mpath); in mesh_path_timer()