From 902acc7896d7649fb30e4b22bd4e643c7f34b02c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 23 Feb 2008 15:17:19 +0100 Subject: mac80211: clean up mesh code Various cleanups, reducing the #ifdef mess and other things. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- net/mac80211/mesh_plink.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'net/mac80211/mesh_plink.c') diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 5cd97e99be62..0b0e8d7eb9c7 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -6,11 +6,11 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ - +#include +#include #include "ieee80211_i.h" #include "ieee80211_rate.h" #include "mesh.h" -#include #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG #define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args) @@ -131,7 +131,7 @@ struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev) } /** - * mesh_plink_deactivate - deactivate mesh peer link + * __mesh_plink_deactivate - deactivate mesh peer link * * @sta: mesh peer link to deactivate * @@ -139,7 +139,7 @@ struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev) * * Locking: the caller must hold sta->plink_lock */ -void mesh_plink_deactivate(struct sta_info *sta) +static void __mesh_plink_deactivate(struct sta_info *sta) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); if (sta->plink_state == ESTAB) @@ -148,6 +148,20 @@ void mesh_plink_deactivate(struct sta_info *sta) mesh_path_flush_by_nexthop(sta); } +/** + * __mesh_plink_deactivate - deactivate mesh peer link + * + * @sta: mesh peer link to deactivate + * + * All mesh paths with this peer as next hop will be flushed + */ +void mesh_plink_deactivate(struct sta_info *sta) +{ + spin_lock_bh(&sta->plink_lock); + __mesh_plink_deactivate(sta); + spin_unlock_bh(&sta->plink_lock); +} + static int mesh_plink_frame_tx(struct net_device *dev, enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid, __le16 reason) { @@ -365,7 +379,7 @@ void mesh_plink_block(struct sta_info *sta) #endif spin_lock_bh(&sta->plink_lock); - mesh_plink_deactivate(sta); + __mesh_plink_deactivate(sta); sta->plink_state = BLOCKED; spin_unlock_bh(&sta->plink_lock); } @@ -390,7 +404,7 @@ int mesh_plink_close(struct sta_info *sta) sta_info_put(sta); return 0; } else if (sta->plink_state == ESTAB) { - mesh_plink_deactivate(sta); + __mesh_plink_deactivate(sta); /* The timer should not be running */ if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata))) __sta_info_get(sta); @@ -699,7 +713,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt, case CLS_ACPT: reason = cpu_to_le16(MESH_CLOSE_RCVD); sta->reason = reason; - mesh_plink_deactivate(sta); + __mesh_plink_deactivate(sta); sta->plink_state = HOLDING; llid = sta->llid; if (!mod_plink_timer(sta, -- cgit v1.2.3