aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@nokia.com>2009-10-12 08:08:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:01 -0400
commit25a7dc6d22adda590be4932ebc772ea35914880c (patch)
tree792d7411cd451131fee44a8362c720fdfbc2ea8a /drivers
parente57f14895bf6bc7f16df760963427ac6ee6ff7e1 (diff)
wl1271: implement cmd_disconnect
This patch implements the CMD_DISCONNECT command, which should be sent to the firmware when we are disassociated. Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Reviewed-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c32
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h27
2 files changed, 58 insertions, 1 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index ac93efd53f2a..d09ad1211977 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -191,7 +191,6 @@ int wl1271_cmd_join(struct wl1271 *wl)
191 do_cal = false; 191 do_cal = false;
192 } 192 }
193 193
194
195 join = kzalloc(sizeof(*join), GFP_KERNEL); 194 join = kzalloc(sizeof(*join), GFP_KERNEL);
196 if (!join) { 195 if (!join) {
197 ret = -ENOMEM; 196 ret = -ENOMEM;
@@ -825,3 +824,34 @@ out:
825 824
826 return ret; 825 return ret;
827} 826}
827
828int wl1271_cmd_disconnect(struct wl1271 *wl)
829{
830 struct wl1271_cmd_disconnect *cmd;
831 int ret = 0;
832
833 wl1271_debug(DEBUG_CMD, "cmd disconnect");
834
835 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
836 if (!cmd) {
837 ret = -ENOMEM;
838 goto out;
839 }
840
841 cmd->rx_config_options = wl->rx_config;
842 cmd->rx_filter_options = wl->rx_filter;
843 /* disconnect reason is not used in immediate disconnections */
844 cmd->type = DISCONNECT_IMMEDIATE;
845
846 ret = wl1271_cmd_send(wl, CMD_DISCONNECT, cmd, sizeof(*cmd));
847 if (ret < 0) {
848 wl1271_error("failed to send disconnect command");
849 goto out_free;
850 }
851
852out_free:
853 kfree(cmd);
854
855out:
856 return ret;
857}
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 63bc4417deb8..0219664765ec 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -50,6 +50,7 @@ int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id);
50int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, 50int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
51 u8 key_size, const u8 *key, const u8 *addr, 51 u8 key_size, const u8 *key, const u8 *addr,
52 u32 tx_seq_32, u16 tx_seq_16); 52 u32 tx_seq_32, u16 tx_seq_16);
53int wl1271_cmd_disconnect(struct wl1271 *wl);
53 54
54enum wl1271_commands { 55enum wl1271_commands {
55 CMD_INTERROGATE = 1, /*use this to read information elements*/ 56 CMD_INTERROGATE = 1, /*use this to read information elements*/
@@ -461,4 +462,30 @@ struct wl1271_cmd_cal_p2g {
461 u8 padding2; 462 u8 padding2;
462} __attribute__ ((packed)); 463} __attribute__ ((packed));
463 464
465
466/*
467 * There are three types of disconnections:
468 *
469 * DISCONNECT_IMMEDIATE: the fw doesn't send any frames
470 * DISCONNECT_DEAUTH: the fw generates a DEAUTH request with the reason
471 * we have passed
472 * DISCONNECT_DISASSOC: the fw generates a DESASSOC request with the reason
473 * we have passed
474 */
475enum wl1271_disconnect_type {
476 DISCONNECT_IMMEDIATE,
477 DISCONNECT_DEAUTH,
478 DISCONNECT_DISASSOC
479};
480
481struct wl1271_cmd_disconnect {
482 u32 rx_config_options;
483 u32 rx_filter_options;
484
485 u16 reason;
486 u8 type;
487
488 u8 padding;
489} __attribute__ ((packed));
490
464#endif /* __WL1271_CMD_H__ */ 491#endif /* __WL1271_CMD_H__ */