aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_iface.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/ieee80211_iface.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/ieee80211_iface.c')
-rw-r--r--net/mac80211/ieee80211_iface.c66
1 files changed, 11 insertions, 55 deletions
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index c2f92b78bfc9..b0f17a2b1a42 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -15,9 +15,7 @@
15#include "ieee80211_i.h" 15#include "ieee80211_i.h"
16#include "sta_info.h" 16#include "sta_info.h"
17#include "debugfs_netdev.h" 17#include "debugfs_netdev.h"
18#ifdef CONFIG_MAC80211_MESH
19#include "mesh.h" 18#include "mesh.h"
20#endif
21 19
22void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata) 20void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata)
23{ 21{
@@ -82,14 +80,11 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
82 ieee80211_debugfs_add_netdev(sdata); 80 ieee80211_debugfs_add_netdev(sdata);
83 ieee80211_if_set_type(ndev, type); 81 ieee80211_if_set_type(ndev, type);
84 82
85#ifdef CONFIG_MAC80211_MESH 83 if (ieee80211_vif_is_mesh(&sdata->vif) &&
86 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && 84 params && params->mesh_id_len)
87 params && params->mesh_id_len) { 85 ieee80211_if_sta_set_mesh_id(&sdata->u.sta,
88 sdata->u.sta.mesh_id_len = params->mesh_id_len; 86 params->mesh_id_len,
89 memcpy(sdata->u.sta.mesh_id, params->mesh_id, 87 params->mesh_id);
90 params->mesh_id_len);
91 }
92#endif
93 88
94 /* we're under RTNL so all this is fine */ 89 /* we're under RTNL so all this is fine */
95 if (unlikely(local->reg_state == IEEE80211_DEV_UNREGISTERED)) { 90 if (unlikely(local->reg_state == IEEE80211_DEV_UNREGISTERED)) {
@@ -170,47 +165,8 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
170 msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); 165 msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev);
171 sdata->bss = &msdata->u.ap; 166 sdata->bss = &msdata->u.ap;
172 167
173#ifdef CONFIG_MAC80211_MESH 168 if (ieee80211_vif_is_mesh(&sdata->vif))
174 if (type == IEEE80211_IF_TYPE_MESH_POINT) { 169 ieee80211_mesh_init_sdata(sdata);
175 ifsta->mshcfg.dot11MeshRetryTimeout = MESH_RET_T;
176 ifsta->mshcfg.dot11MeshConfirmTimeout = MESH_CONF_T;
177 ifsta->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T;
178 ifsta->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR;
179 ifsta->mshcfg.dot11MeshTTL = MESH_TTL;
180 ifsta->mshcfg.auto_open_plinks = true;
181 ifsta->mshcfg.dot11MeshMaxPeerLinks =
182 MESH_MAX_ESTAB_PLINKS;
183 ifsta->mshcfg.dot11MeshHWMPactivePathTimeout =
184 MESH_PATH_TIMEOUT;
185 ifsta->mshcfg.dot11MeshHWMPpreqMinInterval =
186 MESH_PREQ_MIN_INT;
187 ifsta->mshcfg.dot11MeshHWMPnetDiameterTraversalTime =
188 MESH_DIAM_TRAVERSAL_TIME;
189 ifsta->mshcfg.dot11MeshHWMPmaxPREQretries =
190 MESH_MAX_PREQ_RETRIES;
191 ifsta->mshcfg.path_refresh_time =
192 MESH_PATH_REFRESH_TIME;
193 ifsta->mshcfg.min_discovery_timeout =
194 MESH_MIN_DISCOVERY_TIMEOUT;
195 ifsta->accepting_plinks = true;
196 ifsta->preq_id = 0;
197 ifsta->dsn = 0;
198 atomic_set(&ifsta->mpaths, 0);
199 mesh_rmc_init(dev);
200 ifsta->last_preq = jiffies;
201 /* Allocate all mesh structures when creating the first
202 * mesh interface.
203 */
204 if (!mesh_allocated)
205 ieee80211s_init();
206 mesh_ids_set_default(ifsta);
207 setup_timer(&ifsta->mesh_path_timer,
208 ieee80211_mesh_path_timer,
209 (unsigned long) sdata);
210 INIT_LIST_HEAD(&ifsta->preq_queue.list);
211 spin_lock_init(&ifsta->mesh_preq_queue_lock);
212 }
213#endif
214 break; 170 break;
215 } 171 }
216 case IEEE80211_IF_TYPE_MNTR: 172 case IEEE80211_IF_TYPE_MNTR:
@@ -240,6 +196,10 @@ void ieee80211_if_reinit(struct net_device *dev)
240 196
241 ieee80211_if_sdata_deinit(sdata); 197 ieee80211_if_sdata_deinit(sdata);
242 198
199 /* Need to handle mesh specially to allow eliding the function call */
200 if (ieee80211_vif_is_mesh(&sdata->vif))
201 mesh_rmc_free(dev);
202
243 switch (sdata->vif.type) { 203 switch (sdata->vif.type) {
244 case IEEE80211_IF_TYPE_INVALID: 204 case IEEE80211_IF_TYPE_INVALID:
245 /* cannot happen */ 205 /* cannot happen */
@@ -292,10 +252,6 @@ void ieee80211_if_reinit(struct net_device *dev)
292 } 252 }
293 break; 253 break;
294 case IEEE80211_IF_TYPE_MESH_POINT: 254 case IEEE80211_IF_TYPE_MESH_POINT:
295#ifdef CONFIG_MAC80211_MESH
296 mesh_rmc_free(dev);
297#endif
298 /* fall through */
299 case IEEE80211_IF_TYPE_STA: 255 case IEEE80211_IF_TYPE_STA:
300 case IEEE80211_IF_TYPE_IBSS: 256 case IEEE80211_IF_TYPE_IBSS:
301 kfree(sdata->u.sta.extra_ie); 257 kfree(sdata->u.sta.extra_ie);