aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorMarco Porsch <marco@cozybit.com>2013-01-07 10:04:49 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-01-16 16:40:56 -0500
commit1617bab8db81427392d424f2c7ffb5a3282c417c (patch)
tree6c94fa75f1d0d5498ab8743e6b0248de75ebae40 /net/mac80211
parentea54fba20985b7a0cb8e1c8e2760a0865ee47763 (diff)
mac80211: update mesh peer link counter during userspace peering
The established peer link count is indicated in mesh beacons and used for other internal tasks. Previously it was not updated when authenticated peering is performed in userspace. Signed-off-by: Marco Porsch <marco@cozybit.com> Acked-by: Thomas Pedersen <thomas@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/cfg.c22
-rw-r--r--net/mac80211/mesh.h14
-rw-r--r--net/mac80211/mesh_plink.c14
3 files changed, 33 insertions, 17 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 817992b51fe7..8a91dd22d571 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1243,18 +1243,33 @@ static int sta_apply_parameters(struct ieee80211_local *local,
1243 1243
1244 if (ieee80211_vif_is_mesh(&sdata->vif)) { 1244 if (ieee80211_vif_is_mesh(&sdata->vif)) {
1245#ifdef CONFIG_MAC80211_MESH 1245#ifdef CONFIG_MAC80211_MESH
1246 if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) 1246 if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) {
1247 u32 changed = 0;
1248
1247 switch (params->plink_state) { 1249 switch (params->plink_state) {
1248 case NL80211_PLINK_LISTEN:
1249 case NL80211_PLINK_ESTAB: 1250 case NL80211_PLINK_ESTAB:
1251 if (sta->plink_state != NL80211_PLINK_ESTAB)
1252 changed = mesh_plink_inc_estab_count(
1253 sdata);
1254 sta->plink_state = params->plink_state;
1255 break;
1256 case NL80211_PLINK_LISTEN:
1250 case NL80211_PLINK_BLOCKED: 1257 case NL80211_PLINK_BLOCKED:
1258 case NL80211_PLINK_OPN_SNT:
1259 case NL80211_PLINK_OPN_RCVD:
1260 case NL80211_PLINK_CNF_RCVD:
1261 case NL80211_PLINK_HOLDING:
1262 if (sta->plink_state == NL80211_PLINK_ESTAB)
1263 changed = mesh_plink_dec_estab_count(
1264 sdata);
1251 sta->plink_state = params->plink_state; 1265 sta->plink_state = params->plink_state;
1252 break; 1266 break;
1253 default: 1267 default:
1254 /* nothing */ 1268 /* nothing */
1255 break; 1269 break;
1256 } 1270 }
1257 else 1271 ieee80211_bss_info_change_notify(sdata, changed);
1272 } else {
1258 switch (params->plink_action) { 1273 switch (params->plink_action) {
1259 case PLINK_ACTION_OPEN: 1274 case PLINK_ACTION_OPEN:
1260 mesh_plink_open(sta); 1275 mesh_plink_open(sta);
@@ -1263,6 +1278,7 @@ static int sta_apply_parameters(struct ieee80211_local *local,
1263 mesh_plink_block(sta); 1278 mesh_plink_block(sta);
1264 break; 1279 break;
1265 } 1280 }
1281 }
1266#endif 1282#endif
1267 } 1283 }
1268 1284
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 84c28c6101cd..c07f6fc63dc6 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -307,6 +307,20 @@ extern int mesh_paths_generation;
307#ifdef CONFIG_MAC80211_MESH 307#ifdef CONFIG_MAC80211_MESH
308extern int mesh_allocated; 308extern int mesh_allocated;
309 309
310static inline
311u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
312{
313 atomic_inc(&sdata->u.mesh.estab_plinks);
314 return mesh_accept_plinks_update(sdata);
315}
316
317static inline
318u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
319{
320 atomic_dec(&sdata->u.mesh.estab_plinks);
321 return mesh_accept_plinks_update(sdata);
322}
323
310static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata) 324static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata)
311{ 325{
312 return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks - 326 return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks -
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 4b274e9c91a5..9e0416696a83 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -41,20 +41,6 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
41 enum ieee80211_self_protected_actioncode action, 41 enum ieee80211_self_protected_actioncode action,
42 u8 *da, __le16 llid, __le16 plid, __le16 reason); 42 u8 *da, __le16 llid, __le16 plid, __le16 reason);
43 43
44static inline
45u32 mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
46{
47 atomic_inc(&sdata->u.mesh.estab_plinks);
48 return mesh_accept_plinks_update(sdata);
49}
50
51static inline
52u32 mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
53{
54 atomic_dec(&sdata->u.mesh.estab_plinks);
55 return mesh_accept_plinks_update(sdata);
56}
57
58/** 44/**
59 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine 45 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
60 * 46 *