diff options
author | Javier Cardona <javier@cozybit.com> | 2011-08-29 16:23:05 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-13 15:42:32 -0400 |
commit | f5e50cd0757cc97cd1caded0d3f07ff09b5319e4 (patch) | |
tree | 6a223d09ae0a6122d7d6cd99da63d3251a8eabf1 /net/mac80211/mesh_pathtbl.c | |
parent | ece1a2e7e86078c8379937b546e32cb7f25fcb6c (diff) |
mac80211: Improve mpath state locking
No need to take the mpath state lock when an mpath is removed.
Also, no need checking the lock when reading mpath flags.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_pathtbl.c')
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index d07279911a0c..618f84148a75 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -776,18 +776,17 @@ void mesh_plink_broken(struct sta_info *sta) | |||
776 | tbl = rcu_dereference(mesh_paths); | 776 | tbl = rcu_dereference(mesh_paths); |
777 | for_each_mesh_entry(tbl, p, node, i) { | 777 | for_each_mesh_entry(tbl, p, node, i) { |
778 | mpath = node->mpath; | 778 | mpath = node->mpath; |
779 | spin_lock_bh(&mpath->state_lock); | ||
780 | if (rcu_dereference(mpath->next_hop) == sta && | 779 | if (rcu_dereference(mpath->next_hop) == sta && |
781 | mpath->flags & MESH_PATH_ACTIVE && | 780 | mpath->flags & MESH_PATH_ACTIVE && |
782 | !(mpath->flags & MESH_PATH_FIXED)) { | 781 | !(mpath->flags & MESH_PATH_FIXED)) { |
782 | spin_lock_bh(&mpath->state_lock); | ||
783 | mpath->flags &= ~MESH_PATH_ACTIVE; | 783 | mpath->flags &= ~MESH_PATH_ACTIVE; |
784 | ++mpath->sn; | 784 | ++mpath->sn; |
785 | spin_unlock_bh(&mpath->state_lock); | 785 | spin_unlock_bh(&mpath->state_lock); |
786 | mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, | 786 | mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, |
787 | mpath->dst, cpu_to_le32(mpath->sn), | 787 | mpath->dst, cpu_to_le32(mpath->sn), |
788 | reason, bcast, sdata); | 788 | reason, bcast, sdata); |
789 | } else | 789 | } |
790 | spin_unlock_bh(&mpath->state_lock); | ||
791 | } | 790 | } |
792 | rcu_read_unlock(); | 791 | rcu_read_unlock(); |
793 | } | 792 | } |
@@ -866,7 +865,7 @@ static void mpp_path_flush(struct ieee80211_sub_if_data *sdata) | |||
866 | if (mpath->sdata != sdata) | 865 | if (mpath->sdata != sdata) |
867 | continue; | 866 | continue; |
868 | spin_lock_bh(&tbl->hashwlock[i]); | 867 | spin_lock_bh(&tbl->hashwlock[i]); |
869 | spin_lock_bh(&mpath->state_lock); | 868 | hlist_del_rcu(&node->list); |
870 | call_rcu(&node->rcu, mesh_path_node_reclaim); | 869 | call_rcu(&node->rcu, mesh_path_node_reclaim); |
871 | atomic_dec(&tbl->entries); | 870 | atomic_dec(&tbl->entries); |
872 | spin_unlock_bh(&tbl->hashwlock[i]); | 871 | spin_unlock_bh(&tbl->hashwlock[i]); |
@@ -1160,15 +1159,10 @@ void mesh_path_expire(struct ieee80211_sub_if_data *sdata) | |||
1160 | if (node->mpath->sdata != sdata) | 1159 | if (node->mpath->sdata != sdata) |
1161 | continue; | 1160 | continue; |
1162 | mpath = node->mpath; | 1161 | mpath = node->mpath; |
1163 | spin_lock_bh(&mpath->state_lock); | ||
1164 | if ((!(mpath->flags & MESH_PATH_RESOLVING)) && | 1162 | if ((!(mpath->flags & MESH_PATH_RESOLVING)) && |
1165 | (!(mpath->flags & MESH_PATH_FIXED)) && | 1163 | (!(mpath->flags & MESH_PATH_FIXED)) && |
1166 | time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) { | 1164 | time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) |
1167 | spin_unlock_bh(&mpath->state_lock); | ||
1168 | mesh_path_del(mpath->dst, mpath->sdata); | 1165 | mesh_path_del(mpath->dst, mpath->sdata); |
1169 | } else | ||
1170 | spin_unlock_bh(&mpath->state_lock); | ||
1171 | } | ||
1172 | rcu_read_unlock(); | 1166 | rcu_read_unlock(); |
1173 | } | 1167 | } |
1174 | 1168 | ||