diff options
author | Javier Cardona <javier@cozybit.com> | 2011-05-03 19:57:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-11 14:44:46 -0400 |
commit | 9c3990aaec0ad9f686ef6480f6861f2df89b2a7a (patch) | |
tree | 5e073ffce0ce0aed45e9dfeb9f41efc140c770f7 | |
parent | 0a35d36d6f019bde6c98812456798275b02e5aee (diff) |
nl80211: Let userspace drive the peer link management states.
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/linux/nl80211.h | 4 | ||||
-rw-r--r-- | include/net/cfg80211.h | 29 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 30 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 23 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 6 |
5 files changed, 60 insertions, 32 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index c53b916036c5..de96783954a1 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -913,6 +913,9 @@ enum nl80211_commands { | |||
913 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver | 913 | * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver |
914 | * allows auth frames in a mesh to be passed to userspace for processing via | 914 | * allows auth frames in a mesh to be passed to userspace for processing via |
915 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. | 915 | * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. |
916 | * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link. Used when | ||
917 | * userspace is driving the peer link management state machine. | ||
918 | * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. | ||
916 | * | 919 | * |
917 | * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities, | 920 | * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities, |
918 | * the supported WoWLAN triggers | 921 | * the supported WoWLAN triggers |
@@ -1109,6 +1112,7 @@ enum nl80211_attrs { | |||
1109 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, | 1112 | NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, |
1110 | 1113 | ||
1111 | NL80211_ATTR_SUPPORT_MESH_AUTH, | 1114 | NL80211_ATTR_SUPPORT_MESH_AUTH, |
1115 | NL80211_ATTR_STA_PLINK_STATE, | ||
1112 | 1116 | ||
1113 | NL80211_ATTR_WOWLAN_TRIGGERS, | 1117 | NL80211_ATTR_WOWLAN_TRIGGERS, |
1114 | NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, | 1118 | NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 10c17d68059f..4b0d035be64f 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -372,6 +372,33 @@ enum plink_actions { | |||
372 | }; | 372 | }; |
373 | 373 | ||
374 | /** | 374 | /** |
375 | * enum plink_states - state of a mesh peer link finite state machine | ||
376 | * | ||
377 | * @PLINK_LISTEN: initial state, considered the implicit state of non | ||
378 | * existant mesh peer links | ||
379 | * @PLINK_OPN_SNT: mesh plink open frame has been sent to this mesh | ||
380 | * peer @PLINK_OPN_RCVD: mesh plink open frame has been received from | ||
381 | * this mesh peer | ||
382 | * @PLINK_CNF_RCVD: mesh plink confirm frame has been received from | ||
383 | * this mesh peer | ||
384 | * @PLINK_ESTAB: mesh peer link is established | ||
385 | * @PLINK_HOLDING: mesh peer link is being closed or cancelled | ||
386 | * @PLINK_BLOCKED: all frames transmitted from this mesh plink are | ||
387 | * discarded | ||
388 | * @PLINK_INVALID: reserved | ||
389 | */ | ||
390 | enum plink_state { | ||
391 | PLINK_LISTEN, | ||
392 | PLINK_OPN_SNT, | ||
393 | PLINK_OPN_RCVD, | ||
394 | PLINK_CNF_RCVD, | ||
395 | PLINK_ESTAB, | ||
396 | PLINK_HOLDING, | ||
397 | PLINK_BLOCKED, | ||
398 | PLINK_INVALID, | ||
399 | }; | ||
400 | |||
401 | /** | ||
375 | * struct station_parameters - station parameters | 402 | * struct station_parameters - station parameters |
376 | * | 403 | * |
377 | * Used to change and create a new station. | 404 | * Used to change and create a new station. |
@@ -387,6 +414,7 @@ enum plink_actions { | |||
387 | * @listen_interval: listen interval or -1 for no change | 414 | * @listen_interval: listen interval or -1 for no change |
388 | * @aid: AID or zero for no change | 415 | * @aid: AID or zero for no change |
389 | * @plink_action: plink action to take | 416 | * @plink_action: plink action to take |
417 | * @plink_state: set the peer link state for a station | ||
390 | * @ht_capa: HT capabilities of station | 418 | * @ht_capa: HT capabilities of station |
391 | */ | 419 | */ |
392 | struct station_parameters { | 420 | struct station_parameters { |
@@ -397,6 +425,7 @@ struct station_parameters { | |||
397 | u16 aid; | 425 | u16 aid; |
398 | u8 supported_rates_len; | 426 | u8 supported_rates_len; |
399 | u8 plink_action; | 427 | u8 plink_action; |
428 | u8 plink_state; | ||
400 | struct ieee80211_ht_cap *ht_capa; | 429 | struct ieee80211_ht_cap *ht_capa; |
401 | }; | 430 | }; |
402 | 431 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 18c2555e04e6..51f775772d9e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -734,15 +734,27 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
734 | params->ht_capa, | 734 | params->ht_capa, |
735 | &sta->sta.ht_cap); | 735 | &sta->sta.ht_cap); |
736 | 736 | ||
737 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->plink_action) { | 737 | if (ieee80211_vif_is_mesh(&sdata->vif)) { |
738 | switch (params->plink_action) { | 738 | if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) |
739 | case PLINK_ACTION_OPEN: | 739 | switch (params->plink_state) { |
740 | mesh_plink_open(sta); | 740 | case PLINK_LISTEN: |
741 | break; | 741 | case PLINK_ESTAB: |
742 | case PLINK_ACTION_BLOCK: | 742 | case PLINK_BLOCKED: |
743 | mesh_plink_block(sta); | 743 | sta->plink_state = params->plink_state; |
744 | break; | 744 | break; |
745 | } | 745 | default: |
746 | /* nothing */ | ||
747 | break; | ||
748 | } | ||
749 | else | ||
750 | switch (params->plink_action) { | ||
751 | case PLINK_ACTION_OPEN: | ||
752 | mesh_plink_open(sta); | ||
753 | break; | ||
754 | case PLINK_ACTION_BLOCK: | ||
755 | mesh_plink_block(sta); | ||
756 | break; | ||
757 | } | ||
746 | } | 758 | } |
747 | } | 759 | } |
748 | 760 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index af1a7f8c8675..f00b4dcb49d7 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -174,29 +174,6 @@ struct sta_ampdu_mlme { | |||
174 | 174 | ||
175 | 175 | ||
176 | /** | 176 | /** |
177 | * enum plink_state - state of a mesh peer link finite state machine | ||
178 | * | ||
179 | * @PLINK_LISTEN: initial state, considered the implicit state of non existant | ||
180 | * mesh peer links | ||
181 | * @PLINK_OPN_SNT: mesh plink open frame has been sent to this mesh peer | ||
182 | * @PLINK_OPN_RCVD: mesh plink open frame has been received from this mesh peer | ||
183 | * @PLINK_CNF_RCVD: mesh plink confirm frame has been received from this mesh | ||
184 | * peer | ||
185 | * @PLINK_ESTAB: mesh peer link is established | ||
186 | * @PLINK_HOLDING: mesh peer link is being closed or cancelled | ||
187 | * @PLINK_BLOCKED: all frames transmitted from this mesh plink are discarded | ||
188 | */ | ||
189 | enum plink_state { | ||
190 | PLINK_LISTEN, | ||
191 | PLINK_OPN_SNT, | ||
192 | PLINK_OPN_RCVD, | ||
193 | PLINK_CNF_RCVD, | ||
194 | PLINK_ESTAB, | ||
195 | PLINK_HOLDING, | ||
196 | PLINK_BLOCKED | ||
197 | }; | ||
198 | |||
199 | /** | ||
200 | * struct sta_info - STA information | 177 | * struct sta_info - STA information |
201 | * | 178 | * |
202 | * This structure collects information about a station that | 179 | * This structure collects information about a station that |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 64efc2d7a7ad..f698c1d116e4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -174,6 +174,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
174 | [NL80211_ATTR_OFFCHANNEL_TX_OK] = { .type = NLA_FLAG }, | 174 | [NL80211_ATTR_OFFCHANNEL_TX_OK] = { .type = NLA_FLAG }, |
175 | [NL80211_ATTR_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED }, | 175 | [NL80211_ATTR_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED }, |
176 | [NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED }, | 176 | [NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED }, |
177 | [NL80211_ATTR_STA_PLINK_STATE] = { .type = NLA_U8 }, | ||
177 | }; | 178 | }; |
178 | 179 | ||
179 | /* policy for the key attributes */ | 180 | /* policy for the key attributes */ |
@@ -2247,6 +2248,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2247 | memset(¶ms, 0, sizeof(params)); | 2248 | memset(¶ms, 0, sizeof(params)); |
2248 | 2249 | ||
2249 | params.listen_interval = -1; | 2250 | params.listen_interval = -1; |
2251 | params.plink_state = PLINK_INVALID; | ||
2250 | 2252 | ||
2251 | if (info->attrs[NL80211_ATTR_STA_AID]) | 2253 | if (info->attrs[NL80211_ATTR_STA_AID]) |
2252 | return -EINVAL; | 2254 | return -EINVAL; |
@@ -2278,6 +2280,10 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) | |||
2278 | params.plink_action = | 2280 | params.plink_action = |
2279 | nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); | 2281 | nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); |
2280 | 2282 | ||
2283 | if (info->attrs[NL80211_ATTR_STA_PLINK_STATE]) | ||
2284 | params.plink_state = | ||
2285 | nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]); | ||
2286 | |||
2281 | err = get_vlan(info, rdev, ¶ms.vlan); | 2287 | err = get_vlan(info, rdev, ¶ms.vlan); |
2282 | if (err) | 2288 | if (err) |
2283 | goto out; | 2289 | goto out; |