aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-02-23 15:17:19 +0100
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 b1befac1736..6ac49231efa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -15,9 +15,7 @@
#include "ieee80211_i.h"
#include "cfg.h"
#include "ieee80211_rate.h"
-#ifdef CONFIG_MAC80211_MESH
#include "mesh.h"
-#endif
#define DEFAULT_RATES 0
@@ -119,14 +117,10 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
ieee80211_if_reinit(dev);
ieee80211_if_set_type(dev, itype);
-#ifdef CONFIG_MAC80211_MESH
- if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
- params->mesh_id_len) {
- sdata->u.sta.mesh_id_len = params->mesh_id_len;
- memcpy(sdata->u.sta.mesh_id, params->mesh_id,
- params->mesh_id_len);
- }
-#endif
+ if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
+ ieee80211_if_sta_set_mesh_id(&sdata->u.sta,
+ params->mesh_id_len,
+ params->mesh_id);
if (sdata->vif.type != IEEE80211_IF_TYPE_MNTR || !flags)
return 0;
@@ -317,9 +311,7 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
{
-#ifdef CONFIG_MAC80211_MESH
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-#endif
sinfo->filled = STATION_INFO_INACTIVE_TIME |
STATION_INFO_RX_BYTES |
@@ -329,8 +321,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
sinfo->rx_bytes = sta->rx_bytes;
sinfo->tx_bytes = sta->tx_bytes;
+ if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
- if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) {
sinfo->filled |= STATION_INFO_LLID |
STATION_INFO_PLID |
STATION_INFO_PLINK_STATE;
@@ -338,8 +330,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
sinfo->llid = le16_to_cpu(sta->llid);
sinfo->plid = le16_to_cpu(sta->plid);
sinfo->plink_state = sta->plink_state;
- }
#endif
+ }
}
@@ -580,9 +572,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
u32 rates;
int i, j;
struct ieee80211_supported_band *sband;
-#ifdef CONFIG_MAC80211_MESH
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
-#endif
if (params->station_flags & STATION_FLAG_CHANGED) {
sta->flags &= ~WLAN_STA_AUTHORIZED;
@@ -621,9 +611,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
sta->supp_rates[local->oper_channel->band] = rates;
}
-#ifdef CONFIG_MAC80211_MESH
- if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
- params->plink_action)
+ if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) {
switch (params->plink_action) {
case PLINK_ACTION_OPEN:
mesh_plink_open(sta);
@@ -632,7 +620,7 @@ static void sta_apply_parameters(struct ieee80211_local *local,
mesh_plink_block(sta);
break;
}
-#endif
+ }
}
static 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,
} else
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-#ifdef CONFIG_MAC80211_MESH
- if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
+ if (ieee80211_vif_is_mesh(&sdata->vif))
sta = mesh_plink_add(mac, DEFAULT_RATES, dev);
else
-#endif
sta = sta_info_add(local, dev, mac, GFP_KERNEL);
if (IS_ERR(sta))