diff options
author | Avinash Patil <patila@marvell.com> | 2012-05-08 21:30:25 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-05-16 12:46:36 -0400 |
commit | e568634ae7ac379661c90731d480e067929420a1 (patch) | |
tree | 55f02f61eaf97c6e514304d9e0b5e3cee61bb0fd /drivers/net/wireless/mwifiex | |
parent | 12190c5d80bd3c880c76fdaee5a56314ff0bd256 (diff) |
mwifiex: add AP event handling framework
Added logic to handle AP event that are generated
by the firmware. As MLME/SME is implemented in the
firmware, events such as station association and
deauthentication, must be sent to userspace (hostapd)
for creating and deleting station database.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Yogesh Powar <yogeshp@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/fw.h | 18 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 51 |
4 files changed, 73 insertions, 2 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 8ae9b6821319..e7882e56950d 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1237,6 +1237,11 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1237 | goto done; | 1237 | goto done; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | if (priv->bss_mode == NL80211_IFTYPE_AP) { | ||
1241 | wiphy_err(wiphy, "skip association request for AP interface\n"); | ||
1242 | goto done; | ||
1243 | } | ||
1244 | |||
1240 | wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", | 1245 | wiphy_dbg(wiphy, "info: Trying to associate to %s and bssid %pM\n", |
1241 | (char *) sme->ssid, sme->bssid); | 1246 | (char *) sme->ssid, sme->bssid); |
1242 | 1247 | ||
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 07243c04454a..77f82fc811e2 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
@@ -117,6 +117,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
117 | #define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84) | 117 | #define TLV_TYPE_POWER_GROUP (PROPRIETARY_TLV_BASE_ID + 84) |
118 | #define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93) | 118 | #define TLV_TYPE_UAP_RETRY_LIMIT (PROPRIETARY_TLV_BASE_ID + 93) |
119 | #define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) | 119 | #define TLV_TYPE_WAPI_IE (PROPRIETARY_TLV_BASE_ID + 94) |
120 | #define TLV_TYPE_UAP_MGMT_FRAME (PROPRIETARY_TLV_BASE_ID + 104) | ||
120 | #define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) | 121 | #define TLV_TYPE_MGMT_IE (PROPRIETARY_TLV_BASE_ID + 105) |
121 | #define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) | 122 | #define TLV_TYPE_AUTO_DS_PARAM (PROPRIETARY_TLV_BASE_ID + 113) |
122 | #define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114) | 123 | #define TLV_TYPE_PS_PARAM (PROPRIETARY_TLV_BASE_ID + 114) |
@@ -324,15 +325,20 @@ enum ENH_PS_MODES { | |||
324 | #define EVENT_DATA_SNR_HIGH 0x00000027 | 325 | #define EVENT_DATA_SNR_HIGH 0x00000027 |
325 | #define EVENT_LINK_QUALITY 0x00000028 | 326 | #define EVENT_LINK_QUALITY 0x00000028 |
326 | #define EVENT_PORT_RELEASE 0x0000002b | 327 | #define EVENT_PORT_RELEASE 0x0000002b |
328 | #define EVENT_UAP_STA_DEAUTH 0x0000002c | ||
329 | #define EVENT_UAP_STA_ASSOC 0x0000002d | ||
330 | #define EVENT_UAP_BSS_START 0x0000002e | ||
327 | #define EVENT_PRE_BEACON_LOST 0x00000031 | 331 | #define EVENT_PRE_BEACON_LOST 0x00000031 |
328 | #define EVENT_ADDBA 0x00000033 | 332 | #define EVENT_ADDBA 0x00000033 |
329 | #define EVENT_DELBA 0x00000034 | 333 | #define EVENT_DELBA 0x00000034 |
330 | #define EVENT_BA_STREAM_TIEMOUT 0x00000037 | 334 | #define EVENT_BA_STREAM_TIEMOUT 0x00000037 |
331 | #define EVENT_AMSDU_AGGR_CTRL 0x00000042 | 335 | #define EVENT_AMSDU_AGGR_CTRL 0x00000042 |
336 | #define EVENT_UAP_BSS_IDLE 0x00000043 | ||
337 | #define EVENT_UAP_BSS_ACTIVE 0x00000044 | ||
332 | #define EVENT_WEP_ICV_ERR 0x00000046 | 338 | #define EVENT_WEP_ICV_ERR 0x00000046 |
333 | #define EVENT_HS_ACT_REQ 0x00000047 | 339 | #define EVENT_HS_ACT_REQ 0x00000047 |
334 | #define EVENT_BW_CHANGE 0x00000048 | 340 | #define EVENT_BW_CHANGE 0x00000048 |
335 | 341 | #define EVENT_UAP_MIC_COUNTERMEASURES 0x0000004c | |
336 | #define EVENT_HOSTWAKE_STAIE 0x0000004d | 342 | #define EVENT_HOSTWAKE_STAIE 0x0000004d |
337 | 343 | ||
338 | #define EVENT_ID_MASK 0xffff | 344 | #define EVENT_ID_MASK 0xffff |
@@ -1119,6 +1125,16 @@ struct host_cmd_tlv { | |||
1119 | __le16 len; | 1125 | __le16 len; |
1120 | } __packed; | 1126 | } __packed; |
1121 | 1127 | ||
1128 | struct mwifiex_assoc_event { | ||
1129 | u8 sta_addr[ETH_ALEN]; | ||
1130 | __le16 type; | ||
1131 | __le16 len; | ||
1132 | __le16 frame_control; | ||
1133 | __le16 cap_info; | ||
1134 | __le16 listen_interval; | ||
1135 | u8 data[0]; | ||
1136 | } __packed; | ||
1137 | |||
1122 | struct host_cmd_ds_sys_config { | 1138 | struct host_cmd_ds_sys_config { |
1123 | __le16 action; | 1139 | __le16 action; |
1124 | u8 tlv[0]; | 1140 | u8 tlv[0]; |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index acea8d41c048..b0a8338d2c8a 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -116,6 +116,7 @@ enum { | |||
116 | #define MAX_FREQUENCY_BAND_BG 2484 | 116 | #define MAX_FREQUENCY_BAND_BG 2484 |
117 | 117 | ||
118 | #define MWIFIEX_EVENT_HEADER_LEN 4 | 118 | #define MWIFIEX_EVENT_HEADER_LEN 4 |
119 | #define MWIFIEX_UAP_EVENT_EXTRA_HEADER 2 | ||
119 | 120 | ||
120 | #define MWIFIEX_TYPE_LEN 4 | 121 | #define MWIFIEX_TYPE_LEN 4 |
121 | #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE | 122 | #define MWIFIEX_USB_TYPE_CMD 0xF00DFACE |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index f6bbb9307f86..4ace5a3dcd23 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -184,8 +184,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) | |||
184 | int mwifiex_process_sta_event(struct mwifiex_private *priv) | 184 | int mwifiex_process_sta_event(struct mwifiex_private *priv) |
185 | { | 185 | { |
186 | struct mwifiex_adapter *adapter = priv->adapter; | 186 | struct mwifiex_adapter *adapter = priv->adapter; |
187 | int ret = 0; | 187 | int len, ret = 0; |
188 | u32 eventcause = adapter->event_cause; | 188 | u32 eventcause = adapter->event_cause; |
189 | struct station_info sinfo; | ||
190 | struct mwifiex_assoc_event *event; | ||
189 | 191 | ||
190 | switch (eventcause) { | 192 | switch (eventcause) { |
191 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: | 193 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: |
@@ -402,6 +404,53 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
402 | case EVENT_HOSTWAKE_STAIE: | 404 | case EVENT_HOSTWAKE_STAIE: |
403 | dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause); | 405 | dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause); |
404 | break; | 406 | break; |
407 | |||
408 | case EVENT_UAP_STA_ASSOC: | ||
409 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
410 | memset(&sinfo, 0, sizeof(sinfo)); | ||
411 | event = (struct mwifiex_assoc_event *)adapter->event_skb->data; | ||
412 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { | ||
413 | len = -1; | ||
414 | |||
415 | if (ieee80211_is_assoc_req(event->frame_control)) | ||
416 | len = 0; | ||
417 | else if (ieee80211_is_reassoc_req(event->frame_control)) | ||
418 | /* There will be ETH_ALEN bytes of | ||
419 | * current_ap_addr before the re-assoc ies. | ||
420 | */ | ||
421 | len = ETH_ALEN; | ||
422 | |||
423 | if (len != -1) { | ||
424 | sinfo.filled = STATION_INFO_ASSOC_REQ_IES; | ||
425 | sinfo.assoc_req_ies = (u8 *)&event->data[len]; | ||
426 | len = (u8 *)sinfo.assoc_req_ies - | ||
427 | (u8 *)&event->frame_control; | ||
428 | sinfo.assoc_req_ies_len = | ||
429 | le16_to_cpu(event->len) - (u16)len; | ||
430 | } | ||
431 | } | ||
432 | cfg80211_new_sta(priv->netdev, event->sta_addr, &sinfo, | ||
433 | GFP_KERNEL); | ||
434 | break; | ||
435 | case EVENT_UAP_STA_DEAUTH: | ||
436 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
437 | cfg80211_del_sta(priv->netdev, adapter->event_skb->data, | ||
438 | GFP_KERNEL); | ||
439 | break; | ||
440 | case EVENT_UAP_BSS_IDLE: | ||
441 | priv->media_connected = false; | ||
442 | break; | ||
443 | case EVENT_UAP_BSS_ACTIVE: | ||
444 | priv->media_connected = true; | ||
445 | break; | ||
446 | case EVENT_UAP_BSS_START: | ||
447 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
448 | memcpy(priv->netdev->dev_addr, adapter->event_body+2, ETH_ALEN); | ||
449 | break; | ||
450 | case EVENT_UAP_MIC_COUNTERMEASURES: | ||
451 | /* For future development */ | ||
452 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
453 | break; | ||
405 | default: | 454 | default: |
406 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", | 455 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", |
407 | eventcause); | 456 | eventcause); |