diff options
author | Marco Porsch <marco.porsch@etit.tu-chemnitz.de> | 2012-08-08 01:58:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-13 15:28:34 -0400 |
commit | df32381896f5f0c78a371df2e49ab7c776b1a5ba (patch) | |
tree | d0a5cd8f8a7a6bddfab28c4adc735a65c7b3e696 /net/mac80211/mesh.c | |
parent | faa97bd4a43ac69a55029e3b07708bdff0959c07 (diff) |
mac80211: fix unnecessary beacon update after peering status change
ieee80211_bss_info_change_notify is called everytime a peer link is established
or closed, because the accepting_plinks flag in the meshconf IE *might* have changed.
With this patch the corresponding functions return the BSS_CHANGED_BEACON flag when a beacon update is necessary.
Also it makes mesh_accept_plinks_update the common place to update the accepting_plinks flag.
mesh_accept_plinks_update is called upon plink change and also periodically from ieee80211_mesh_housekeeping.
Thus, it also picks up changes of local->num_sta.
Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de>
Acked-by: Thomas Pedersen <thomas@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mesh.c')
-rw-r--r-- | net/mac80211/mesh.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 6fac18c0423f..856dcf49ce75 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -136,10 +136,13 @@ bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) | |||
136 | * mesh_accept_plinks_update - update accepting_plink in local mesh beacons | 136 | * mesh_accept_plinks_update - update accepting_plink in local mesh beacons |
137 | * | 137 | * |
138 | * @sdata: mesh interface in which mesh beacons are going to be updated | 138 | * @sdata: mesh interface in which mesh beacons are going to be updated |
139 | * | ||
140 | * Returns: beacon changed flag if the beacon content changed. | ||
139 | */ | 141 | */ |
140 | void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) | 142 | u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) |
141 | { | 143 | { |
142 | bool free_plinks; | 144 | bool free_plinks; |
145 | u32 changed = 0; | ||
143 | 146 | ||
144 | /* In case mesh_plink_free_count > 0 and mesh_plinktbl_capacity == 0, | 147 | /* In case mesh_plink_free_count > 0 and mesh_plinktbl_capacity == 0, |
145 | * the mesh interface might be able to establish plinks with peers that | 148 | * the mesh interface might be able to establish plinks with peers that |
@@ -149,8 +152,12 @@ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) | |||
149 | */ | 152 | */ |
150 | free_plinks = mesh_plink_availables(sdata); | 153 | free_plinks = mesh_plink_availables(sdata); |
151 | 154 | ||
152 | if (free_plinks != sdata->u.mesh.accepting_plinks) | 155 | if (free_plinks != sdata->u.mesh.accepting_plinks) { |
153 | ieee80211_mesh_housekeeping_timer((unsigned long) sdata); | 156 | sdata->u.mesh.accepting_plinks = free_plinks; |
157 | changed = BSS_CHANGED_BEACON; | ||
158 | } | ||
159 | |||
160 | return changed; | ||
154 | } | 161 | } |
155 | 162 | ||
156 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) | 163 | int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) |
@@ -262,7 +269,6 @@ mesh_add_meshconf_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
262 | neighbors = (neighbors > 15) ? 15 : neighbors; | 269 | neighbors = (neighbors > 15) ? 15 : neighbors; |
263 | *pos++ = neighbors << 1; | 270 | *pos++ = neighbors << 1; |
264 | /* Mesh capability */ | 271 | /* Mesh capability */ |
265 | ifmsh->accepting_plinks = mesh_plink_availables(sdata); | ||
266 | *pos = MESHCONF_CAPAB_FORWARDING; | 272 | *pos = MESHCONF_CAPAB_FORWARDING; |
267 | *pos |= ifmsh->accepting_plinks ? | 273 | *pos |= ifmsh->accepting_plinks ? |
268 | MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00; | 274 | MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00; |
@@ -521,14 +527,13 @@ int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, | |||
521 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, | 527 | static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, |
522 | struct ieee80211_if_mesh *ifmsh) | 528 | struct ieee80211_if_mesh *ifmsh) |
523 | { | 529 | { |
524 | bool free_plinks; | 530 | u32 changed; |
525 | 531 | ||
526 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); | 532 | ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); |
527 | mesh_path_expire(sdata); | 533 | mesh_path_expire(sdata); |
528 | 534 | ||
529 | free_plinks = mesh_plink_availables(sdata); | 535 | changed = mesh_accept_plinks_update(sdata); |
530 | if (free_plinks != sdata->u.mesh.accepting_plinks) | 536 | ieee80211_bss_info_change_notify(sdata, changed); |
531 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); | ||
532 | 537 | ||
533 | mod_timer(&ifmsh->housekeeping_timer, | 538 | mod_timer(&ifmsh->housekeeping_timer, |
534 | round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); | 539 | round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); |