diff options
author | Thomas Pedersen <thomas@cozybit.com> | 2011-08-25 13:36:14 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-26 10:39:23 -0400 |
commit | c613366113c8956ee869e12558099927586785bb (patch) | |
tree | 0336b039c694ca19b9e5ce42608aebd0ec0b92fe | |
parent | 25232490af96f899f7e17de2c136e03d2c9ded62 (diff) |
mac80211: mesh gate fixes
Since a v1 of the mesh gate series was accidentally applied, this patch
contains the changes in v2.
These are:
- automatically make mesh gate a root node.
- use TU_TO_EXP_TIME macro.
- initialize timer instead of checking for NULL timer function.
- cleanups.
Signed-off-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/cfg.c | 8 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 4 | ||||
-rw-r--r-- | net/mac80211/mesh_pathtbl.c | 10 |
3 files changed, 14 insertions, 8 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7d17a9183b8a..6ab67ab34b5c 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1138,6 +1138,14 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, | |||
1138 | ieee80211_mesh_root_setup(ifmsh); | 1138 | ieee80211_mesh_root_setup(ifmsh); |
1139 | } | 1139 | } |
1140 | if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS, mask)) { | 1140 | if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS, mask)) { |
1141 | /* our current gate announcement implementation rides on root | ||
1142 | * announcements, so require this ifmsh to also be a root node | ||
1143 | * */ | ||
1144 | if (nconf->dot11MeshGateAnnouncementProtocol && | ||
1145 | !conf->dot11MeshHWMPRootMode) { | ||
1146 | conf->dot11MeshHWMPRootMode = 1; | ||
1147 | ieee80211_mesh_root_setup(ifmsh); | ||
1148 | } | ||
1141 | conf->dot11MeshGateAnnouncementProtocol = | 1149 | conf->dot11MeshGateAnnouncementProtocol = |
1142 | nconf->dot11MeshGateAnnouncementProtocol; | 1150 | nconf->dot11MeshGateAnnouncementProtocol; |
1143 | } | 1151 | } |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 1c4f53c31ae5..28ab510e621a 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -537,8 +537,8 @@ static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata) | |||
537 | 537 | ||
538 | mesh_path_tx_root_frame(sdata); | 538 | mesh_path_tx_root_frame(sdata); |
539 | mod_timer(&ifmsh->mesh_path_root_timer, | 539 | mod_timer(&ifmsh->mesh_path_root_timer, |
540 | round_jiffies(jiffies + | 540 | round_jiffies(TU_TO_EXP_TIME( |
541 | usecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPRannInterval * 1024))); | 541 | ifmsh->mshcfg.dot11MeshHWMPRannInterval))); |
542 | } | 542 | } |
543 | 543 | ||
544 | #ifdef CONFIG_PM | 544 | #ifdef CONFIG_PM |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 75e4b6022b86..3c2bcb2de844 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -288,7 +288,7 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, | |||
288 | struct mesh_path *from_mpath, | 288 | struct mesh_path *from_mpath, |
289 | bool copy) | 289 | bool copy) |
290 | { | 290 | { |
291 | struct sk_buff *skb, *cp_skb; | 291 | struct sk_buff *skb, *cp_skb = NULL; |
292 | struct sk_buff_head gateq, failq; | 292 | struct sk_buff_head gateq, failq; |
293 | unsigned long flags; | 293 | unsigned long flags; |
294 | int num_skbs; | 294 | int num_skbs; |
@@ -711,6 +711,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) | |||
711 | new_mpath->flags = 0; | 711 | new_mpath->flags = 0; |
712 | skb_queue_head_init(&new_mpath->frame_queue); | 712 | skb_queue_head_init(&new_mpath->frame_queue); |
713 | new_node->mpath = new_mpath; | 713 | new_node->mpath = new_mpath; |
714 | init_timer(&new_mpath->timer); | ||
714 | new_mpath->exp_time = jiffies; | 715 | new_mpath->exp_time = jiffies; |
715 | spin_lock_init(&new_mpath->state_lock); | 716 | spin_lock_init(&new_mpath->state_lock); |
716 | 717 | ||
@@ -843,8 +844,7 @@ static void mesh_path_node_reclaim(struct rcu_head *rp) | |||
843 | struct mpath_node *node = container_of(rp, struct mpath_node, rcu); | 844 | struct mpath_node *node = container_of(rp, struct mpath_node, rcu); |
844 | struct ieee80211_sub_if_data *sdata = node->mpath->sdata; | 845 | struct ieee80211_sub_if_data *sdata = node->mpath->sdata; |
845 | 846 | ||
846 | if (node->mpath->timer.function) | 847 | del_timer_sync(&node->mpath->timer); |
847 | del_timer_sync(&node->mpath->timer); | ||
848 | atomic_dec(&sdata->u.mesh.mpaths); | 848 | atomic_dec(&sdata->u.mesh.mpaths); |
849 | kfree(node->mpath); | 849 | kfree(node->mpath); |
850 | kfree(node); | 850 | kfree(node); |
@@ -1046,8 +1046,7 @@ static void mesh_path_node_free(struct hlist_node *p, bool free_leafs) | |||
1046 | mpath = node->mpath; | 1046 | mpath = node->mpath; |
1047 | hlist_del_rcu(p); | 1047 | hlist_del_rcu(p); |
1048 | if (free_leafs) { | 1048 | if (free_leafs) { |
1049 | if (mpath->timer.function) | 1049 | del_timer_sync(&mpath->timer); |
1050 | del_timer_sync(&mpath->timer); | ||
1051 | kfree(mpath); | 1050 | kfree(mpath); |
1052 | } | 1051 | } |
1053 | kfree(node); | 1052 | kfree(node); |
@@ -1094,7 +1093,6 @@ int mesh_pathtbl_init(void) | |||
1094 | tbl_mpp->free_node = &mesh_path_node_free; | 1093 | tbl_mpp->free_node = &mesh_path_node_free; |
1095 | tbl_mpp->copy_node = &mesh_path_node_copy; | 1094 | tbl_mpp->copy_node = &mesh_path_node_copy; |
1096 | tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; | 1095 | tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; |
1097 | /* XXX: not needed */ | ||
1098 | tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); | 1096 | tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); |
1099 | INIT_HLIST_HEAD(tbl_mpp->known_gates); | 1097 | INIT_HLIST_HEAD(tbl_mpp->known_gates); |
1100 | 1098 | ||