aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mesh_plink.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-02-23 09:17:19 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-03-06 15:30:42 -0500
commit902acc7896d7649fb30e4b22bd4e643c7f34b02c (patch)
tree8d8f2838fead8417e16e801383ddb2691a89719f /net/mac80211/mesh_plink.c
parentf7a921443740d7dafc65b17aa32531730d358f50 (diff)
mac80211: clean up mesh code
Various cleanups, reducing the #ifdef mess and other things. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh_plink.c')
-rw-r--r--net/mac80211/mesh_plink.c28
1 files changed, 21 insertions, 7 deletions
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 @@
6 * it under the terms of the GNU General Public License version 2 as 6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9 9#include <linux/kernel.h>
10#include <linux/random.h>
10#include "ieee80211_i.h" 11#include "ieee80211_i.h"
11#include "ieee80211_rate.h" 12#include "ieee80211_rate.h"
12#include "mesh.h" 13#include "mesh.h"
13#include <linux/random.h>
14 14
15#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG 15#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
16#define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args) 16#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)
131} 131}
132 132
133/** 133/**
134 * mesh_plink_deactivate - deactivate mesh peer link 134 * __mesh_plink_deactivate - deactivate mesh peer link
135 * 135 *
136 * @sta: mesh peer link to deactivate 136 * @sta: mesh peer link to deactivate
137 * 137 *
@@ -139,7 +139,7 @@ struct sta_info *mesh_plink_add(u8 *hw_addr, u64 rates, struct net_device *dev)
139 * 139 *
140 * Locking: the caller must hold sta->plink_lock 140 * Locking: the caller must hold sta->plink_lock
141 */ 141 */
142void mesh_plink_deactivate(struct sta_info *sta) 142static void __mesh_plink_deactivate(struct sta_info *sta)
143{ 143{
144 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 144 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
145 if (sta->plink_state == ESTAB) 145 if (sta->plink_state == ESTAB)
@@ -148,6 +148,20 @@ void mesh_plink_deactivate(struct sta_info *sta)
148 mesh_path_flush_by_nexthop(sta); 148 mesh_path_flush_by_nexthop(sta);
149} 149}
150 150
151/**
152 * __mesh_plink_deactivate - deactivate mesh peer link
153 *
154 * @sta: mesh peer link to deactivate
155 *
156 * All mesh paths with this peer as next hop will be flushed
157 */
158void mesh_plink_deactivate(struct sta_info *sta)
159{
160 spin_lock_bh(&sta->plink_lock);
161 __mesh_plink_deactivate(sta);
162 spin_unlock_bh(&sta->plink_lock);
163}
164
151static int mesh_plink_frame_tx(struct net_device *dev, 165static int mesh_plink_frame_tx(struct net_device *dev,
152 enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid, 166 enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid,
153 __le16 reason) { 167 __le16 reason) {
@@ -365,7 +379,7 @@ void mesh_plink_block(struct sta_info *sta)
365#endif 379#endif
366 380
367 spin_lock_bh(&sta->plink_lock); 381 spin_lock_bh(&sta->plink_lock);
368 mesh_plink_deactivate(sta); 382 __mesh_plink_deactivate(sta);
369 sta->plink_state = BLOCKED; 383 sta->plink_state = BLOCKED;
370 spin_unlock_bh(&sta->plink_lock); 384 spin_unlock_bh(&sta->plink_lock);
371} 385}
@@ -390,7 +404,7 @@ int mesh_plink_close(struct sta_info *sta)
390 sta_info_put(sta); 404 sta_info_put(sta);
391 return 0; 405 return 0;
392 } else if (sta->plink_state == ESTAB) { 406 } else if (sta->plink_state == ESTAB) {
393 mesh_plink_deactivate(sta); 407 __mesh_plink_deactivate(sta);
394 /* The timer should not be running */ 408 /* The timer should not be running */
395 if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata))) 409 if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)))
396 __sta_info_get(sta); 410 __sta_info_get(sta);
@@ -699,7 +713,7 @@ void mesh_rx_plink_frame(struct net_device *dev, struct ieee80211_mgmt *mgmt,
699 case CLS_ACPT: 713 case CLS_ACPT:
700 reason = cpu_to_le16(MESH_CLOSE_RCVD); 714 reason = cpu_to_le16(MESH_CLOSE_RCVD);
701 sta->reason = reason; 715 sta->reason = reason;
702 mesh_plink_deactivate(sta); 716 __mesh_plink_deactivate(sta);
703 sta->plink_state = HOLDING; 717 sta->plink_state = HOLDING;
704 llid = sta->llid; 718 llid = sta->llid;
705 if (!mod_plink_timer(sta, 719 if (!mod_plink_timer(sta,