diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2012-10-05 23:21:43 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-10-08 15:06:03 -0400 |
commit | 8cc1d52390f53c6dd46ae71e29ea000634a17e3a (patch) | |
tree | 71f8855235d3ae8b8bd5e6e6c5637b3d132ee3e4 /drivers/net | |
parent | 06975884280976ba215ad0766bee1a69df612434 (diff) |
mwifiex: update cfg80211 with correct reason code when connection is lost
Driver gets LINK_LOST, DEAUTHENTICATED and DISASSOCIATED events
from firmware when connection is lost in different scenarios.
Currently we are using common code WLAN_REASON_DEAUTH_LEAVING
for these cases.
This patch adds support to parse an actual reason code from
firmware event body and send it to cfg80211.
WLAN_REASON_DEAUTH_LEAVING code is used if deauth is initiated
by our device.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mwifiex/join.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_cmdresp.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_event.c | 31 |
4 files changed, 27 insertions, 16 deletions
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 82e63cee1e97..7b0858af8f5d 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1180,16 +1180,18 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | |||
1180 | struct mwifiex_adapter *adapter = priv->adapter; | 1180 | struct mwifiex_adapter *adapter = priv->adapter; |
1181 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; | 1181 | struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; |
1182 | struct mwifiex_bssdescriptor *bss_desc; | 1182 | struct mwifiex_bssdescriptor *bss_desc; |
1183 | u16 reason_code; | ||
1183 | 1184 | ||
1184 | adhoc_result = &resp->params.adhoc_result; | 1185 | adhoc_result = &resp->params.adhoc_result; |
1185 | 1186 | ||
1186 | bss_desc = priv->attempted_bss_desc; | 1187 | bss_desc = priv->attempted_bss_desc; |
1187 | 1188 | ||
1188 | /* Join result code 0 --> SUCCESS */ | 1189 | /* Join result code 0 --> SUCCESS */ |
1189 | if (le16_to_cpu(resp->result)) { | 1190 | reason_code = le16_to_cpu(resp->result); |
1191 | if (reason_code) { | ||
1190 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); | 1192 | dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); |
1191 | if (priv->media_connected) | 1193 | if (priv->media_connected) |
1192 | mwifiex_reset_connect_state(priv); | 1194 | mwifiex_reset_connect_state(priv, reason_code); |
1193 | 1195 | ||
1194 | memset(&priv->curr_bss_params.bss_descriptor, | 1196 | memset(&priv->curr_bss_params.bss_descriptor, |
1195 | 0x00, sizeof(struct mwifiex_bssdescriptor)); | 1197 | 0x00, sizeof(struct mwifiex_bssdescriptor)); |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index bfb3fa69805c..c2d0ab146af5 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, | |||
847 | struct mwifiex_bssdescriptor *bss_desc); | 847 | struct mwifiex_bssdescriptor *bss_desc); |
848 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, | 848 | int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, |
849 | struct host_cmd_ds_command *resp); | 849 | struct host_cmd_ds_command *resp); |
850 | void mwifiex_reset_connect_state(struct mwifiex_private *priv); | 850 | void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason); |
851 | u8 mwifiex_band_to_radio_type(u8 band); | 851 | u8 mwifiex_band_to_radio_type(u8 band); |
852 | int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); | 852 | int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); |
853 | int mwifiex_adhoc_start(struct mwifiex_private *priv, | 853 | int mwifiex_adhoc_start(struct mwifiex_private *priv, |
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c index e380171c4c5d..09e6a267f566 100644 --- a/drivers/net/wireless/mwifiex/sta_cmdresp.c +++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c | |||
@@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, | |||
545 | if (!memcmp(resp->params.deauth.mac_addr, | 545 | if (!memcmp(resp->params.deauth.mac_addr, |
546 | &priv->curr_bss_params.bss_descriptor.mac_address, | 546 | &priv->curr_bss_params.bss_descriptor.mac_address, |
547 | sizeof(resp->params.deauth.mac_addr))) | 547 | sizeof(resp->params.deauth.mac_addr))) |
548 | mwifiex_reset_connect_state(priv); | 548 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
549 | 549 | ||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
@@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv, | |||
558 | static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, | 558 | static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, |
559 | struct host_cmd_ds_command *resp) | 559 | struct host_cmd_ds_command *resp) |
560 | { | 560 | { |
561 | mwifiex_reset_connect_state(priv); | 561 | mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING); |
562 | return 0; | 562 | return 0; |
563 | } | 563 | } |
564 | 564 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index aafde30e714a..8132119e1a21 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
@@ -41,7 +41,7 @@ | |||
41 | * - Sends a disconnect event to upper layers/applications. | 41 | * - Sends a disconnect event to upper layers/applications. |
42 | */ | 42 | */ |
43 | void | 43 | void |
44 | mwifiex_reset_connect_state(struct mwifiex_private *priv) | 44 | mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code) |
45 | { | 45 | { |
46 | struct mwifiex_adapter *adapter = priv->adapter; | 46 | struct mwifiex_adapter *adapter = priv->adapter; |
47 | 47 | ||
@@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv) | |||
117 | priv->media_connected = false; | 117 | priv->media_connected = false; |
118 | dev_dbg(adapter->dev, | 118 | dev_dbg(adapter->dev, |
119 | "info: successfully disconnected from %pM: reason code %d\n", | 119 | "info: successfully disconnected from %pM: reason code %d\n", |
120 | priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING); | 120 | priv->cfg_bssid, reason_code); |
121 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 121 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { |
122 | cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING, | 122 | cfg80211_disconnected(priv->netdev, reason_code, NULL, 0, |
123 | NULL, 0, GFP_KERNEL); | 123 | GFP_KERNEL); |
124 | } | 124 | } |
125 | memset(priv->cfg_bssid, 0, ETH_ALEN); | 125 | memset(priv->cfg_bssid, 0, ETH_ALEN); |
126 | 126 | ||
@@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
186 | struct mwifiex_adapter *adapter = priv->adapter; | 186 | struct mwifiex_adapter *adapter = priv->adapter; |
187 | int ret = 0; | 187 | int ret = 0; |
188 | u32 eventcause = adapter->event_cause; | 188 | u32 eventcause = adapter->event_cause; |
189 | u16 ctrl; | 189 | u16 ctrl, reason_code; |
190 | 190 | ||
191 | switch (eventcause) { | 191 | switch (eventcause) { |
192 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: | 192 | case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: |
@@ -204,22 +204,31 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
204 | case EVENT_DEAUTHENTICATED: | 204 | case EVENT_DEAUTHENTICATED: |
205 | dev_dbg(adapter->dev, "event: Deauthenticated\n"); | 205 | dev_dbg(adapter->dev, "event: Deauthenticated\n"); |
206 | adapter->dbg.num_event_deauth++; | 206 | adapter->dbg.num_event_deauth++; |
207 | if (priv->media_connected) | 207 | if (priv->media_connected) { |
208 | mwifiex_reset_connect_state(priv); | 208 | reason_code = |
209 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
210 | mwifiex_reset_connect_state(priv, reason_code); | ||
211 | } | ||
209 | break; | 212 | break; |
210 | 213 | ||
211 | case EVENT_DISASSOCIATED: | 214 | case EVENT_DISASSOCIATED: |
212 | dev_dbg(adapter->dev, "event: Disassociated\n"); | 215 | dev_dbg(adapter->dev, "event: Disassociated\n"); |
213 | adapter->dbg.num_event_disassoc++; | 216 | adapter->dbg.num_event_disassoc++; |
214 | if (priv->media_connected) | 217 | if (priv->media_connected) { |
215 | mwifiex_reset_connect_state(priv); | 218 | reason_code = |
219 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
220 | mwifiex_reset_connect_state(priv, reason_code); | ||
221 | } | ||
216 | break; | 222 | break; |
217 | 223 | ||
218 | case EVENT_LINK_LOST: | 224 | case EVENT_LINK_LOST: |
219 | dev_dbg(adapter->dev, "event: Link lost\n"); | 225 | dev_dbg(adapter->dev, "event: Link lost\n"); |
220 | adapter->dbg.num_event_link_lost++; | 226 | adapter->dbg.num_event_link_lost++; |
221 | if (priv->media_connected) | 227 | if (priv->media_connected) { |
222 | mwifiex_reset_connect_state(priv); | 228 | reason_code = |
229 | le16_to_cpu(*(__le16 *)adapter->event_body); | ||
230 | mwifiex_reset_connect_state(priv, reason_code); | ||
231 | } | ||
223 | break; | 232 | break; |
224 | 233 | ||
225 | case EVENT_PS_SLEEP: | 234 | case EVENT_PS_SLEEP: |