diff options
author | Avinash Patil <patila@marvell.com> | 2012-08-03 21:06:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-06 15:12:52 -0400 |
commit | 3d99d9877dabc6468c3df1c990d436bd221b5089 (patch) | |
tree | 1ff54f8d45536fa01eb76005cbba79cb38c82fbe /drivers/net/wireless/mwifiex | |
parent | c82589131840767443f32f6d235a825cbef7b914 (diff) |
mwifiex: separate file for handling AP events
Route AP events handling to separate function defined in
uap_event.c.
AP specific event handling is removed from sta_event.c.
Signed-off-by: Avinash Patil <patila@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/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cmdevt.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/uap_event.c | 100 |
5 files changed, 107 insertions, 49 deletions
diff --git a/drivers/net/wireless/mwifiex/Makefile b/drivers/net/wireless/mwifiex/Makefile index 3f66ebb0a630..20932f24dc23 100644 --- a/drivers/net/wireless/mwifiex/Makefile +++ b/drivers/net/wireless/mwifiex/Makefile | |||
@@ -33,6 +33,7 @@ mwifiex-y += uap_cmd.o | |||
33 | mwifiex-y += ie.o | 33 | mwifiex-y += ie.o |
34 | mwifiex-y += sta_cmdresp.o | 34 | mwifiex-y += sta_cmdresp.o |
35 | mwifiex-y += sta_event.o | 35 | mwifiex-y += sta_event.o |
36 | mwifiex-y += uap_event.o | ||
36 | mwifiex-y += sta_tx.o | 37 | mwifiex-y += sta_tx.o |
37 | mwifiex-y += sta_rx.o | 38 | mwifiex-y += sta_rx.o |
38 | mwifiex-y += cfg80211.o | 39 | mwifiex-y += cfg80211.o |
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c index c68adec3cc8b..c229dddcf1c2 100644 --- a/drivers/net/wireless/mwifiex/cmdevt.c +++ b/drivers/net/wireless/mwifiex/cmdevt.c | |||
@@ -447,7 +447,10 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) | |||
447 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); | 447 | priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); |
448 | } | 448 | } |
449 | 449 | ||
450 | ret = mwifiex_process_sta_event(priv); | 450 | if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP) |
451 | ret = mwifiex_process_uap_event(priv); | ||
452 | else | ||
453 | ret = mwifiex_process_sta_event(priv); | ||
451 | 454 | ||
452 | adapter->event_cause = 0; | 455 | adapter->event_cause = 0; |
453 | adapter->event_skb = NULL; | 456 | adapter->event_skb = NULL; |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 5eeb17c3db00..cac0c2d64b0f 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -785,6 +785,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no, | |||
785 | int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *, | 785 | int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *, |
786 | struct sk_buff *skb); | 786 | struct sk_buff *skb); |
787 | int mwifiex_process_sta_event(struct mwifiex_private *); | 787 | int mwifiex_process_sta_event(struct mwifiex_private *); |
788 | int mwifiex_process_uap_event(struct mwifiex_private *); | ||
788 | void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); | 789 | void *mwifiex_process_sta_txpd(struct mwifiex_private *, struct sk_buff *skb); |
789 | int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta); | 790 | int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta); |
790 | int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, | 791 | int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index b8614a825460..2aad148db5c3 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -184,10 +184,8 @@ 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 len, ret = 0; | 187 | int 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; | ||
191 | 189 | ||
192 | switch (eventcause) { | 190 | switch (eventcause) { |
193 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: | 191 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: |
@@ -405,51 +403,6 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
405 | dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause); | 403 | dev_dbg(adapter->dev, "event: HOSTWAKE_STAIE %d\n", eventcause); |
406 | break; | 404 | break; |
407 | 405 | ||
408 | case EVENT_UAP_STA_ASSOC: | ||
409 | memset(&sinfo, 0, sizeof(sinfo)); | ||
410 | event = (struct mwifiex_assoc_event *) | ||
411 | (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
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 = &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 | cfg80211_del_sta(priv->netdev, adapter->event_body + | ||
437 | MWIFIEX_UAP_EVENT_EXTRA_HEADER, GFP_KERNEL); | ||
438 | break; | ||
439 | case EVENT_UAP_BSS_IDLE: | ||
440 | priv->media_connected = false; | ||
441 | break; | ||
442 | case EVENT_UAP_BSS_ACTIVE: | ||
443 | priv->media_connected = true; | ||
444 | break; | ||
445 | case EVENT_UAP_BSS_START: | ||
446 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
447 | memcpy(priv->netdev->dev_addr, adapter->event_body+2, ETH_ALEN); | ||
448 | break; | ||
449 | case EVENT_UAP_MIC_COUNTERMEASURES: | ||
450 | /* For future development */ | ||
451 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
452 | break; | ||
453 | default: | 406 | default: |
454 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", | 407 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", |
455 | eventcause); | 408 | eventcause); |
diff --git a/drivers/net/wireless/mwifiex/uap_event.c b/drivers/net/wireless/mwifiex/uap_event.c new file mode 100644 index 000000000000..5af60d8ac13e --- /dev/null +++ b/drivers/net/wireless/mwifiex/uap_event.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * Marvell Wireless LAN device driver: AP event handling | ||
3 | * | ||
4 | * Copyright (C) 2012, Marvell International Ltd. | ||
5 | * | ||
6 | * This software file (the "File") is distributed by Marvell International | ||
7 | * Ltd. under the terms of the GNU General Public License Version 2, June 1991 | ||
8 | * (the "License"). You may use, redistribute and/or modify this File in | ||
9 | * accordance with the terms and conditions of the License, a copy of which | ||
10 | * is available by writing to the Free Software Foundation, Inc., | ||
11 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the | ||
12 | * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. | ||
13 | * | ||
14 | * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE | ||
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE | ||
16 | * ARE EXPRESSLY DISCLAIMED. The License provides additional details about | ||
17 | * this warranty disclaimer. | ||
18 | */ | ||
19 | |||
20 | #include "decl.h" | ||
21 | #include "main.h" | ||
22 | |||
23 | /* | ||
24 | * This function handles AP interface specific events generated by firmware. | ||
25 | * | ||
26 | * Event specific routines are called by this function based | ||
27 | * upon the generated event cause. | ||
28 | * | ||
29 | * | ||
30 | * Events supported for AP - | ||
31 | * - EVENT_UAP_STA_ASSOC | ||
32 | * - EVENT_UAP_STA_DEAUTH | ||
33 | * - EVENT_UAP_BSS_ACTIVE | ||
34 | * - EVENT_UAP_BSS_START | ||
35 | * - EVENT_UAP_BSS_IDLE | ||
36 | * - EVENT_UAP_MIC_COUNTERMEASURES: | ||
37 | */ | ||
38 | int mwifiex_process_uap_event(struct mwifiex_private *priv) | ||
39 | { | ||
40 | struct mwifiex_adapter *adapter = priv->adapter; | ||
41 | int len; | ||
42 | u32 eventcause = adapter->event_cause; | ||
43 | struct station_info sinfo; | ||
44 | struct mwifiex_assoc_event *event; | ||
45 | |||
46 | switch (eventcause) { | ||
47 | case EVENT_UAP_STA_ASSOC: | ||
48 | memset(&sinfo, 0, sizeof(sinfo)); | ||
49 | event = (struct mwifiex_assoc_event *) | ||
50 | (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
51 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { | ||
52 | len = -1; | ||
53 | |||
54 | if (ieee80211_is_assoc_req(event->frame_control)) | ||
55 | len = 0; | ||
56 | else if (ieee80211_is_reassoc_req(event->frame_control)) | ||
57 | /* There will be ETH_ALEN bytes of | ||
58 | * current_ap_addr before the re-assoc ies. | ||
59 | */ | ||
60 | len = ETH_ALEN; | ||
61 | |||
62 | if (len != -1) { | ||
63 | sinfo.filled = STATION_INFO_ASSOC_REQ_IES; | ||
64 | sinfo.assoc_req_ies = &event->data[len]; | ||
65 | len = (u8 *)sinfo.assoc_req_ies - | ||
66 | (u8 *)&event->frame_control; | ||
67 | sinfo.assoc_req_ies_len = | ||
68 | le16_to_cpu(event->len) - (u16)len; | ||
69 | } | ||
70 | } | ||
71 | cfg80211_new_sta(priv->netdev, event->sta_addr, &sinfo, | ||
72 | GFP_KERNEL); | ||
73 | break; | ||
74 | case EVENT_UAP_STA_DEAUTH: | ||
75 | cfg80211_del_sta(priv->netdev, adapter->event_body + | ||
76 | MWIFIEX_UAP_EVENT_EXTRA_HEADER, GFP_KERNEL); | ||
77 | break; | ||
78 | case EVENT_UAP_BSS_IDLE: | ||
79 | priv->media_connected = false; | ||
80 | break; | ||
81 | case EVENT_UAP_BSS_ACTIVE: | ||
82 | priv->media_connected = true; | ||
83 | break; | ||
84 | case EVENT_UAP_BSS_START: | ||
85 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
86 | memcpy(priv->netdev->dev_addr, adapter->event_body + 2, | ||
87 | ETH_ALEN); | ||
88 | break; | ||
89 | case EVENT_UAP_MIC_COUNTERMEASURES: | ||
90 | /* For future development */ | ||
91 | dev_dbg(adapter->dev, "AP EVENT: event id: %#x\n", eventcause); | ||
92 | break; | ||
93 | default: | ||
94 | dev_dbg(adapter->dev, "event: unknown event id: %#x\n", | ||
95 | eventcause); | ||
96 | break; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||