aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_iface.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_iface.c')
-rw-r--r--net/mac80211/ieee80211_iface.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c
index 9523aeb71032..c2f92b78bfc9 100644
--- a/net/mac80211/ieee80211_iface.c
+++ b/net/mac80211/ieee80211_iface.c
@@ -15,6 +15,9 @@
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"
20#endif
18 21
19void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata) 22void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata)
20{ 23{
@@ -39,7 +42,8 @@ static void ieee80211_if_sdata_deinit(struct ieee80211_sub_if_data *sdata)
39 42
40/* Must be called with rtnl lock held. */ 43/* Must be called with rtnl lock held. */
41int ieee80211_if_add(struct net_device *dev, const char *name, 44int ieee80211_if_add(struct net_device *dev, const char *name,
42 struct net_device **new_dev, int type) 45 struct net_device **new_dev, int type,
46 struct vif_params *params)
43{ 47{
44 struct net_device *ndev; 48 struct net_device *ndev;
45 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 49 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
@@ -78,6 +82,15 @@ int ieee80211_if_add(struct net_device *dev, const char *name,
78 ieee80211_debugfs_add_netdev(sdata); 82 ieee80211_debugfs_add_netdev(sdata);
79 ieee80211_if_set_type(ndev, type); 83 ieee80211_if_set_type(ndev, type);
80 84
85#ifdef CONFIG_MAC80211_MESH
86 if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT &&
87 params && params->mesh_id_len) {
88 sdata->u.sta.mesh_id_len = params->mesh_id_len;
89 memcpy(sdata->u.sta.mesh_id, params->mesh_id,
90 params->mesh_id_len);
91 }
92#endif
93
81 /* we're under RTNL so all this is fine */ 94 /* we're under RTNL so all this is fine */
82 if (unlikely(local->reg_state == IEEE80211_DEV_UNREGISTERED)) { 95 if (unlikely(local->reg_state == IEEE80211_DEV_UNREGISTERED)) {
83 __ieee80211_if_del(local, sdata); 96 __ieee80211_if_del(local, sdata);
@@ -134,6 +147,7 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
134 sdata->bss = &sdata->u.ap; 147 sdata->bss = &sdata->u.ap;
135 INIT_LIST_HEAD(&sdata->u.ap.vlans); 148 INIT_LIST_HEAD(&sdata->u.ap.vlans);
136 break; 149 break;
150 case IEEE80211_IF_TYPE_MESH_POINT:
137 case IEEE80211_IF_TYPE_STA: 151 case IEEE80211_IF_TYPE_STA:
138 case IEEE80211_IF_TYPE_IBSS: { 152 case IEEE80211_IF_TYPE_IBSS: {
139 struct ieee80211_sub_if_data *msdata; 153 struct ieee80211_sub_if_data *msdata;
@@ -155,6 +169,48 @@ void ieee80211_if_set_type(struct net_device *dev, int type)
155 169
156 msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev); 170 msdata = IEEE80211_DEV_TO_SUB_IF(sdata->local->mdev);
157 sdata->bss = &msdata->u.ap; 171 sdata->bss = &msdata->u.ap;
172
173#ifdef CONFIG_MAC80211_MESH
174 if (type == IEEE80211_IF_TYPE_MESH_POINT) {
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
158 break; 214 break;
159 } 215 }
160 case IEEE80211_IF_TYPE_MNTR: 216 case IEEE80211_IF_TYPE_MNTR:
@@ -236,6 +292,10 @@ void ieee80211_if_reinit(struct net_device *dev)
236 } 292 }
237 break; 293 break;
238 case IEEE80211_IF_TYPE_MESH_POINT: 294 case IEEE80211_IF_TYPE_MESH_POINT:
295#ifdef CONFIG_MAC80211_MESH
296 mesh_rmc_free(dev);
297#endif
298 /* fall through */
239 case IEEE80211_IF_TYPE_STA: 299 case IEEE80211_IF_TYPE_STA:
240 case IEEE80211_IF_TYPE_IBSS: 300 case IEEE80211_IF_TYPE_IBSS:
241 kfree(sdata->u.sta.extra_ie); 301 kfree(sdata->u.sta.extra_ie);