aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2008-08-21 17:46:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:06 -0400
commit191bb40e725304c5fcfabd92c57eef58799f0e25 (patch)
treea64e66713495e39f74f088209d4b558628c214aa /drivers/net
parent87c8c72d532f96257162f978d5945dcf7f0df19e (diff)
libertas: convert CMD_802_11_DEAUTHENTICATE to a direct command
and remove DISASSOCIATE because it's not in any of the specs and has never been used. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/assoc.c61
-rw-r--r--drivers/net/wireless/libertas/assoc.h5
-rw-r--r--drivers/net/wireless/libertas/cmd.c4
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c5
-rw-r--r--drivers/net/wireless/libertas/host.h1
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h11
-rw-r--r--drivers/net/wireless/libertas/main.c4
-rw-r--r--drivers/net/wireless/libertas/wext.c4
8 files changed, 36 insertions, 59 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index a267d6e65f03..5072a8917fd9 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1029,7 +1029,9 @@ void lbs_association_worker(struct work_struct *work)
1029 */ 1029 */
1030 if (priv->mode == IW_MODE_INFRA) { 1030 if (priv->mode == IW_MODE_INFRA) {
1031 if (should_deauth_infrastructure(priv, assoc_req)) { 1031 if (should_deauth_infrastructure(priv, assoc_req)) {
1032 ret = lbs_send_deauthentication(priv); 1032 ret = lbs_cmd_80211_deauthenticate(priv,
1033 priv->curbssparams.bssid,
1034 WLAN_REASON_DEAUTH_LEAVING);
1033 if (ret) { 1035 if (ret) {
1034 lbs_deb_assoc("Deauthentication due to new " 1036 lbs_deb_assoc("Deauthentication due to new "
1035 "configuration request failed: %d\n", 1037 "configuration request failed: %d\n",
@@ -1290,18 +1292,6 @@ static void lbs_set_basic_rate_flags(u8 *rates, size_t len)
1290} 1292}
1291 1293
1292/** 1294/**
1293 * @brief Send Deauthentication Request
1294 *
1295 * @param priv A pointer to struct lbs_private structure
1296 * @return 0--success, -1--fail
1297 */
1298int lbs_send_deauthentication(struct lbs_private *priv)
1299{
1300 return lbs_prepare_and_send_command(priv, CMD_802_11_DEAUTHENTICATE,
1301 0, CMD_OPTION_WAITFORRSP, 0, NULL);
1302}
1303
1304/**
1305 * @brief This function prepares command of authenticate. 1295 * @brief This function prepares command of authenticate.
1306 * 1296 *
1307 * @param priv A pointer to struct lbs_private structure 1297 * @param priv A pointer to struct lbs_private structure
@@ -1353,26 +1343,37 @@ out:
1353 return ret; 1343 return ret;
1354} 1344}
1355 1345
1356int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, 1346/**
1357 struct cmd_ds_command *cmd) 1347 * @brief Deauthenticate from a specific BSS
1348 *
1349 * @param priv A pointer to struct lbs_private structure
1350 * @param bssid The specific BSS to deauthenticate from
1351 * @param reason The 802.11 sec. 7.3.1.7 Reason Code for deauthenticating
1352 *
1353 * @return 0 on success, error on failure
1354 */
1355int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, u8 bssid[ETH_ALEN],
1356 u16 reason)
1358{ 1357{
1359 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; 1358 struct cmd_ds_802_11_deauthenticate cmd;
1359 int ret;
1360 1360
1361 lbs_deb_enter(LBS_DEB_JOIN); 1361 lbs_deb_enter(LBS_DEB_JOIN);
1362 1362
1363 cmd->command = cpu_to_le16(CMD_802_11_DEAUTHENTICATE); 1363 memset(&cmd, 0, sizeof(cmd));
1364 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + 1364 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
1365 S_DS_GEN); 1365 memcpy(cmd.macaddr, &bssid[0], ETH_ALEN);
1366 cmd.reasoncode = cpu_to_le16(reason);
1366 1367
1367 /* set AP MAC address */ 1368 ret = lbs_cmd_with_response(priv, CMD_802_11_DEAUTHENTICATE, &cmd);
1368 memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN);
1369 1369
1370 /* Reason code 3 = Station is leaving */ 1370 /* Clean up everything even if there was an error; can't assume that
1371#define REASON_CODE_STA_LEAVING 3 1371 * we're still authenticated to the AP after trying to deauth.
1372 dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); 1372 */
1373 lbs_mac_event_disconnected(priv);
1373 1374
1374 lbs_deb_leave(LBS_DEB_JOIN); 1375 lbs_deb_leave(LBS_DEB_JOIN);
1375 return 0; 1376 return ret;
1376} 1377}
1377 1378
1378int lbs_cmd_80211_associate(struct lbs_private *priv, 1379int lbs_cmd_80211_associate(struct lbs_private *priv,
@@ -1815,16 +1816,6 @@ done:
1815 return ret; 1816 return ret;
1816} 1817}
1817 1818
1818int lbs_ret_80211_disassociate(struct lbs_private *priv)
1819{
1820 lbs_deb_enter(LBS_DEB_JOIN);
1821
1822 lbs_mac_event_disconnected(priv);
1823
1824 lbs_deb_leave(LBS_DEB_JOIN);
1825 return 0;
1826}
1827
1828int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, 1819int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
1829 struct cmd_ds_command *resp) 1820 struct cmd_ds_command *resp)
1830{ 1821{
diff --git a/drivers/net/wireless/libertas/assoc.h b/drivers/net/wireless/libertas/assoc.h
index c516fbe518fd..92ba2c2b3eea 100644
--- a/drivers/net/wireless/libertas/assoc.h
+++ b/drivers/net/wireless/libertas/assoc.h
@@ -20,7 +20,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
20 struct cmd_ds_command *cmd, 20 struct cmd_ds_command *cmd,
21 void *pdata_buf); 21 void *pdata_buf);
22int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, 22int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
23 struct cmd_ds_command *cmd); 23 u8 bssid[ETH_ALEN], u16 reason);
24int lbs_cmd_80211_associate(struct lbs_private *priv, 24int lbs_cmd_80211_associate(struct lbs_private *priv,
25 struct cmd_ds_command *cmd, 25 struct cmd_ds_command *cmd,
26 void *pdata_buf); 26 void *pdata_buf);
@@ -28,12 +28,9 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
28int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, 28int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
29 struct cmd_ds_command *resp); 29 struct cmd_ds_command *resp);
30int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv); 30int lbs_ret_80211_ad_hoc_stop(struct lbs_private *priv);
31int lbs_ret_80211_disassociate(struct lbs_private *priv);
32int lbs_ret_80211_associate(struct lbs_private *priv, 31int lbs_ret_80211_associate(struct lbs_private *priv,
33 struct cmd_ds_command *resp); 32 struct cmd_ds_command *resp);
34 33
35int lbs_stop_adhoc_network(struct lbs_private *priv); 34int lbs_stop_adhoc_network(struct lbs_private *priv);
36 35
37int lbs_send_deauthentication(struct lbs_private *priv);
38
39#endif /* _LBS_ASSOC_H */ 36#endif /* _LBS_ASSOC_H */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index c0db988926bf..8364a2f71b51 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1413,10 +1413,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1413 ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); 1413 ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf);
1414 break; 1414 break;
1415 1415
1416 case CMD_802_11_DEAUTHENTICATE:
1417 ret = lbs_cmd_80211_deauthenticate(priv, cmdptr);
1418 break;
1419
1420 case CMD_802_11_AD_HOC_START: 1416 case CMD_802_11_AD_HOC_START:
1421 ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); 1417 ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
1422 break; 1418 break;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index dfaf03a4bbba..c94604c536fe 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -258,11 +258,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
258 ret = lbs_ret_80211_associate(priv, resp); 258 ret = lbs_ret_80211_associate(priv, resp);
259 break; 259 break;
260 260
261 case CMD_RET(CMD_802_11_DISASSOCIATE):
262 case CMD_RET(CMD_802_11_DEAUTHENTICATE):
263 ret = lbs_ret_80211_disassociate(priv);
264 break;
265
266 case CMD_RET(CMD_802_11_AD_HOC_START): 261 case CMD_RET(CMD_802_11_AD_HOC_START):
267 case CMD_RET(CMD_802_11_AD_HOC_JOIN): 262 case CMD_RET(CMD_802_11_AD_HOC_JOIN):
268 ret = lbs_ret_80211_ad_hoc_start(priv, resp); 263 ret = lbs_ret_80211_ad_hoc_start(priv, resp);
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index 413030f17d74..caebb9b5715b 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -61,7 +61,6 @@
61#define CMD_RF_REG_MAP 0x0023 61#define CMD_RF_REG_MAP 0x0023
62#define CMD_802_11_DEAUTHENTICATE 0x0024 62#define CMD_802_11_DEAUTHENTICATE 0x0024
63#define CMD_802_11_REASSOCIATE 0x0025 63#define CMD_802_11_REASSOCIATE 0x0025
64#define CMD_802_11_DISASSOCIATE 0x0026
65#define CMD_MAC_CONTROL 0x0028 64#define CMD_MAC_CONTROL 0x0028
66#define CMD_802_11_AD_HOC_START 0x002b 65#define CMD_802_11_AD_HOC_START 0x002b
67#define CMD_802_11_AD_HOC_JOIN 0x002c 66#define CMD_802_11_AD_HOC_JOIN 0x002c
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 7f155cd1c117..342c2e3af34c 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -232,7 +232,9 @@ struct cmd_ds_802_11_authenticate {
232}; 232};
233 233
234struct cmd_ds_802_11_deauthenticate { 234struct cmd_ds_802_11_deauthenticate {
235 u8 macaddr[6]; 235 struct cmd_header hdr;
236
237 u8 macaddr[ETH_ALEN];
236 __le16 reasoncode; 238 __le16 reasoncode;
237}; 239};
238 240
@@ -251,11 +253,6 @@ struct cmd_ds_802_11_associate {
251#endif 253#endif
252} __attribute__ ((packed)); 254} __attribute__ ((packed));
253 255
254struct cmd_ds_802_11_disassociate {
255 u8 destmacaddr[6];
256 __le16 reasoncode;
257};
258
259struct cmd_ds_802_11_associate_rsp { 256struct cmd_ds_802_11_associate_rsp {
260 struct ieeetypes_assocrsp assocRsp; 257 struct ieeetypes_assocrsp assocRsp;
261}; 258};
@@ -697,7 +694,6 @@ struct cmd_ds_command {
697 union { 694 union {
698 struct cmd_ds_802_11_ps_mode psmode; 695 struct cmd_ds_802_11_ps_mode psmode;
699 struct cmd_ds_802_11_associate associate; 696 struct cmd_ds_802_11_associate associate;
700 struct cmd_ds_802_11_deauthenticate deauth;
701 struct cmd_ds_802_11_ad_hoc_start ads; 697 struct cmd_ds_802_11_ad_hoc_start ads;
702 struct cmd_ds_802_11_reset reset; 698 struct cmd_ds_802_11_reset reset;
703 struct cmd_ds_802_11_ad_hoc_result result; 699 struct cmd_ds_802_11_ad_hoc_result result;
@@ -710,7 +706,6 @@ struct cmd_ds_command {
710 struct cmd_ds_802_11_ad_hoc_join adj; 706 struct cmd_ds_802_11_ad_hoc_join adj;
711 struct cmd_ds_802_11_rssi rssi; 707 struct cmd_ds_802_11_rssi rssi;
712 struct cmd_ds_802_11_rssi_rsp rssirsp; 708 struct cmd_ds_802_11_rssi_rsp rssirsp;
713 struct cmd_ds_802_11_disassociate dassociate;
714 struct cmd_ds_mac_reg_access macreg; 709 struct cmd_ds_mac_reg_access macreg;
715 struct cmd_ds_bbp_reg_access bbpreg; 710 struct cmd_ds_bbp_reg_access bbpreg;
716 struct cmd_ds_rf_reg_access rfreg; 711 struct cmd_ds_rf_reg_access rfreg;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 3c13619ffa15..5e4c4e41098a 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -291,7 +291,9 @@ static ssize_t lbs_rtap_set(struct device *dev,
291 if (priv->infra_open || priv->mesh_open) 291 if (priv->infra_open || priv->mesh_open)
292 return -EBUSY; 292 return -EBUSY;
293 if (priv->mode == IW_MODE_INFRA) 293 if (priv->mode == IW_MODE_INFRA)
294 lbs_send_deauthentication(priv); 294 lbs_cmd_80211_deauthenticate(priv,
295 priv->curbssparams.bssid,
296 WLAN_REASON_DEAUTH_LEAVING);
295 else if (priv->mode == IW_MODE_ADHOC) 297 else if (priv->mode == IW_MODE_ADHOC)
296 lbs_stop_adhoc_network(priv); 298 lbs_stop_adhoc_network(priv);
297 lbs_add_rtap(priv); 299 lbs_add_rtap(priv);
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 10a806666001..38295ee1a05f 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -986,7 +986,9 @@ static int lbs_mesh_set_freq(struct net_device *dev,
986 if (fwrq->m != priv->curbssparams.channel) { 986 if (fwrq->m != priv->curbssparams.channel) {
987 lbs_deb_wext("mesh channel change forces eth disconnect\n"); 987 lbs_deb_wext("mesh channel change forces eth disconnect\n");
988 if (priv->mode == IW_MODE_INFRA) 988 if (priv->mode == IW_MODE_INFRA)
989 lbs_send_deauthentication(priv); 989 lbs_cmd_80211_deauthenticate(priv,
990 priv->curbssparams.bssid,
991 WLAN_REASON_DEAUTH_LEAVING);
990 else if (priv->mode == IW_MODE_ADHOC) 992 else if (priv->mode == IW_MODE_ADHOC)
991 lbs_stop_adhoc_network(priv); 993 lbs_stop_adhoc_network(priv);
992 } 994 }