aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.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/cfg.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/cfg.c')
-rw-r--r--net/mac80211/cfg.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b1befac1736a..6ac49231efa9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -15,9 +15,7 @@
15#include "ieee80211_i.h" 15#include "ieee80211_i.h"
16#include "cfg.h" 16#include "cfg.h"
17#include "ieee80211_rate.h" 17#include "ieee80211_rate.h"
18#ifdef CONFIG_MAC80211_MESH
19#include "mesh.h" 18#include "mesh.h"
20#endif
21 19
22#define DEFAULT_RATES 0 20#define DEFAULT_RATES 0
23 21
@@ -119,14 +117,10 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
119 ieee80211_if_reinit(dev); 117 ieee80211_if_reinit(dev);
120 ieee80211_if_set_type(dev, itype); 118 ieee80211_if_set_type(dev, itype);
121 119
122#ifdef CONFIG_MAC80211_MESH 120 if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
123 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && 121 ieee80211_if_sta_set_mesh_id(&sdata->u.sta,
124 params->mesh_id_len) { 122 params->mesh_id_len,
125 sdata->u.sta.mesh_id_len = params->mesh_id_len; 123 params->mesh_id);
126 memcpy(sdata->u.sta.mesh_id, params->mesh_id,
127 params->mesh_id_len);
128 }
129#endif
130 124
131 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags) 125 if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags)
132 return 0; 126 return 0;
@@ -317,9 +311,7 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
317 311
318static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 312static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
319{ 313{
320#ifdef CONFIG_MAC80211_MESH
321 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 314 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
322#endif
323 315
324 sinfo->filled = STATION_INFO_INACTIVE_TIME | 316 sinfo->filled = STATION_INFO_INACTIVE_TIME |
325 STATION_INFO_RX_BYTES | 317 STATION_INFO_RX_BYTES |
@@ -329,8 +321,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
329 sinfo->rx_bytes = sta->rx_bytes; 321 sinfo->rx_bytes = sta->rx_bytes;
330 sinfo->tx_bytes = sta->tx_bytes; 322 sinfo->tx_bytes = sta->tx_bytes;
331 323
324 if (ieee80211_vif_is_mesh(&sdata->vif)) {
332#ifdef CONFIG_MAC80211_MESH 325#ifdef CONFIG_MAC80211_MESH
333 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) {
334 sinfo->filled |= STATION_INFO_LLID | 326 sinfo->filled |= STATION_INFO_LLID |
335 STATION_INFO_PLID | 327 STATION_INFO_PLID |
336 STATION_INFO_PLINK_STATE; 328 STATION_INFO_PLINK_STATE;
@@ -338,8 +330,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
338 sinfo->llid = le16_to_cpu(sta->llid); 330 sinfo->llid = le16_to_cpu(sta->llid);
339 sinfo->plid = le16_to_cpu(sta->plid); 331 sinfo->plid = le16_to_cpu(sta->plid);
340 sinfo->plink_state = sta->plink_state; 332 sinfo->plink_state = sta->plink_state;
341 }
342#endif 333#endif
334 }
343} 335}
344 336
345 337
@@ -580,9 +572,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
580 u32 rates; 572 u32 rates;
581 int i, j; 573 int i, j;
582 struct ieee80211_supported_band *sband; 574 struct ieee80211_supported_band *sband;
583#ifdef CONFIG_MAC80211_MESH
584 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 575 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
585#endif
586 576
587 if (params->station_flags & STATION_FLAG_CHANGED) { 577 if (params->station_flags & STATION_FLAG_CHANGED) {
588 sta->flags &= ~WLAN_STA_AUTHORIZED; 578 sta->flags &= ~WLAN_STA_AUTHORIZED;
@@ -621,9 +611,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
621 sta->supp_rates[local->oper_channel->band] = rates; 611 sta->supp_rates[local->oper_channel->band] = rates;
622 } 612 }
623 613
624#ifdef CONFIG_MAC80211_MESH 614 if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
625 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
626 params->plink_action)
627 switch (params->plink_action) { 615 switch (params->plink_action) {
628 case PLINK_ACTION_OPEN: 616 case PLINK_ACTION_OPEN:
629 mesh_plink_open(sta); 617 mesh_plink_open(sta);
@@ -632,7 +620,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
632 mesh_plink_block(sta); 620 mesh_plink_block(sta);
633 break; 621 break;
634 } 622 }
635#endif 623 }
636} 624}
637 625
638static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 626static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
@@ -655,11 +643,9 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
655 } else 643 } else
656 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 644 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
657 645
658#ifdef CONFIG_MAC80211_MESH 646 if (ieee80211_vif_is_mesh(&sdata->vif))
659 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
660 sta = mesh_plink_add(mac, DEFAULT_RATES, dev); 647 sta = mesh_plink_add(mac, DEFAULT_RATES, dev);
661 else 648 else
662#endif
663 sta = sta_info_add(local, dev, mac, GFP_KERNEL); 649 sta = sta_info_add(local, dev, mac, GFP_KERNEL);
664 650
665 if (IS_ERR(sta)) 651 if (IS_ERR(sta))