diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-02-23 09:17:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-06 15:30:42 -0500 |
commit | 902acc7896d7649fb30e4b22bd4e643c7f34b02c (patch) | |
tree | 8d8f2838fead8417e16e801383ddb2691a89719f /net/mac80211/mesh.c | |
parent | f7a921443740d7dafc65b17aa32531730d358f50 (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.c')
-rw-r--r-- | net/mac80211/mesh.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 8ff533005d92..ebe1a7a80bad 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -381,3 +381,70 @@ endgrow: | |||
381 | else | 381 | else |
382 | return newtbl; | 382 | return newtbl; |
383 | } | 383 | } |
384 | |||
385 | /** | ||
386 | * ieee80211_new_mesh_header - create a new mesh header | ||
387 | * @meshhdr: uninitialized mesh header | ||
388 | * @sdata: mesh interface to be used | ||
389 | * | ||
390 | * Return the header length. | ||
391 | */ | ||
392 | int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, | ||
393 | struct ieee80211_sub_if_data *sdata) | ||
394 | { | ||
395 | meshhdr->flags = 0; | ||
396 | meshhdr->ttl = sdata->u.sta.mshcfg.dot11MeshTTL; | ||
397 | |||
398 | meshhdr->seqnum[0] = sdata->u.sta.mesh_seqnum[0]++; | ||
399 | meshhdr->seqnum[1] = sdata->u.sta.mesh_seqnum[1]; | ||
400 | meshhdr->seqnum[2] = sdata->u.sta.mesh_seqnum[2]; | ||
401 | |||
402 | if (sdata->u.sta.mesh_seqnum[0] == 0) { | ||
403 | sdata->u.sta.mesh_seqnum[1]++; | ||
404 | if (sdata->u.sta.mesh_seqnum[1] == 0) | ||
405 | sdata->u.sta.mesh_seqnum[2]++; | ||
406 | } | ||
407 | |||
408 | return 5; | ||
409 | } | ||
410 | |||
411 | void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) | ||
412 | { | ||
413 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | ||
414 | |||
415 | ifsta->mshcfg.dot11MeshRetryTimeout = MESH_RET_T; | ||
416 | ifsta->mshcfg.dot11MeshConfirmTimeout = MESH_CONF_T; | ||
417 | ifsta->mshcfg.dot11MeshHoldingTimeout = MESH_HOLD_T; | ||
418 | ifsta->mshcfg.dot11MeshMaxRetries = MESH_MAX_RETR; | ||
419 | ifsta->mshcfg.dot11MeshTTL = MESH_TTL; | ||
420 | ifsta->mshcfg.auto_open_plinks = true; | ||
421 | ifsta->mshcfg.dot11MeshMaxPeerLinks = | ||
422 | MESH_MAX_ESTAB_PLINKS; | ||
423 | ifsta->mshcfg.dot11MeshHWMPactivePathTimeout = | ||
424 | MESH_PATH_TIMEOUT; | ||
425 | ifsta->mshcfg.dot11MeshHWMPpreqMinInterval = | ||
426 | MESH_PREQ_MIN_INT; | ||
427 | ifsta->mshcfg.dot11MeshHWMPnetDiameterTraversalTime = | ||
428 | MESH_DIAM_TRAVERSAL_TIME; | ||
429 | ifsta->mshcfg.dot11MeshHWMPmaxPREQretries = | ||
430 | MESH_MAX_PREQ_RETRIES; | ||
431 | ifsta->mshcfg.path_refresh_time = | ||
432 | MESH_PATH_REFRESH_TIME; | ||
433 | ifsta->mshcfg.min_discovery_timeout = | ||
434 | MESH_MIN_DISCOVERY_TIMEOUT; | ||
435 | ifsta->accepting_plinks = true; | ||
436 | ifsta->preq_id = 0; | ||
437 | ifsta->dsn = 0; | ||
438 | atomic_set(&ifsta->mpaths, 0); | ||
439 | mesh_rmc_init(sdata->dev); | ||
440 | ifsta->last_preq = jiffies; | ||
441 | /* Allocate all mesh structures when creating the first mesh interface. */ | ||
442 | if (!mesh_allocated) | ||
443 | ieee80211s_init(); | ||
444 | mesh_ids_set_default(ifsta); | ||
445 | setup_timer(&ifsta->mesh_path_timer, | ||
446 | ieee80211_mesh_path_timer, | ||
447 | (unsigned long) sdata); | ||
448 | INIT_LIST_HEAD(&ifsta->preq_queue.list); | ||
449 | spin_lock_init(&ifsta->mesh_preq_queue_lock); | ||
450 | } | ||