aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2012-11-22 11:06:18 -0500
committerLuciano Coelho <coelho@ti.com>2012-11-27 03:49:28 -0500
commitfcab189027cdd68df7f97474d1419aaa4a82130c (patch)
treee50bde25bca8593bcdbf48a1f42fd20ed9d46cd6
parentb6acb4e00e187cb5ae8dd479958a02fe0ea97bf0 (diff)
wlcore: update channel_switch/stop_channel_switch commands
Some fields were added to the channel_switch and stop_channel_switch commands. Unfortunately, the new 18xx channel_switch struct is not backward compatible with the 12xx channel switch struct. Add a new channel_switch op to wlcore, and update the driver accordingly. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/ti/wl12xx/cmd.c37
-rw-r--r--drivers/net/wireless/ti/wl12xx/cmd.h20
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c1
-rw-r--r--drivers/net/wireless/ti/wl18xx/Makefile2
-rw-r--r--drivers/net/wireless/ti/wl18xx/cmd.c80
-rw-r--r--drivers/net/wireless/ti/wl18xx/cmd.h52
-rw-r--r--drivers/net/wireless/ti/wl18xx/main.c2
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.c40
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.h19
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c5
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h3
11 files changed, 204 insertions, 57 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/cmd.c b/drivers/net/wireless/ti/wl12xx/cmd.c
index 622206241e83..7dc9f965037d 100644
--- a/drivers/net/wireless/ti/wl12xx/cmd.c
+++ b/drivers/net/wireless/ti/wl12xx/cmd.c
@@ -284,3 +284,40 @@ int wl128x_cmd_radio_parms(struct wl1271 *wl)
284 kfree(radio_parms); 284 kfree(radio_parms);
285 return ret; 285 return ret;
286} 286}
287
288int wl12xx_cmd_channel_switch(struct wl1271 *wl,
289 struct wl12xx_vif *wlvif,
290 struct ieee80211_channel_switch *ch_switch)
291{
292 struct wl12xx_cmd_channel_switch *cmd;
293 int ret;
294
295 wl1271_debug(DEBUG_ACX, "cmd channel switch");
296
297 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
298 if (!cmd) {
299 ret = -ENOMEM;
300 goto out;
301 }
302
303 cmd->role_id = wlvif->role_id;
304 cmd->channel = ch_switch->channel->hw_value;
305 cmd->switch_time = ch_switch->count;
306 cmd->stop_tx = ch_switch->block_tx;
307
308 /* FIXME: control from mac80211 in the future */
309 /* Enable TX on the target channel */
310 cmd->post_switch_tx_disable = 0;
311
312 ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0);
313 if (ret < 0) {
314 wl1271_error("failed to send channel switch command");
315 goto out_free;
316 }
317
318out_free:
319 kfree(cmd);
320
321out:
322 return ret;
323}
diff --git a/drivers/net/wireless/ti/wl12xx/cmd.h b/drivers/net/wireless/ti/wl12xx/cmd.h
index 140a0e8829d5..32cbad54e993 100644
--- a/drivers/net/wireless/ti/wl12xx/cmd.h
+++ b/drivers/net/wireless/ti/wl12xx/cmd.h
@@ -103,10 +103,30 @@ struct wl1271_ext_radio_parms_cmd {
103 u8 padding[3]; 103 u8 padding[3];
104} __packed; 104} __packed;
105 105
106struct wl12xx_cmd_channel_switch {
107 struct wl1271_cmd_header header;
108
109 u8 role_id;
110
111 /* The new serving channel */
112 u8 channel;
113 /* Relative time of the serving channel switch in TBTT units */
114 u8 switch_time;
115 /* Stop the role TX, should expect it after radar detection */
116 u8 stop_tx;
117 /* The target channel tx status 1-stopped 0-open*/
118 u8 post_switch_tx_disable;
119
120 u8 padding[3];
121} __packed;
122
106int wl1271_cmd_general_parms(struct wl1271 *wl); 123int wl1271_cmd_general_parms(struct wl1271 *wl);
107int wl128x_cmd_general_parms(struct wl1271 *wl); 124int wl128x_cmd_general_parms(struct wl1271 *wl);
108int wl1271_cmd_radio_parms(struct wl1271 *wl); 125int wl1271_cmd_radio_parms(struct wl1271 *wl);
109int wl128x_cmd_radio_parms(struct wl1271 *wl); 126int wl128x_cmd_radio_parms(struct wl1271 *wl);
110int wl1271_cmd_ext_radio_parms(struct wl1271 *wl); 127int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
128int wl12xx_cmd_channel_switch(struct wl1271 *wl,
129 struct wl12xx_vif *wlvif,
130 struct ieee80211_channel_switch *ch_switch);
111 131
112#endif /* __WL12XX_CMD_H__ */ 132#endif /* __WL12XX_CMD_H__ */
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 0c81eeb4f5b8..b93de04ccd6a 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -1632,6 +1632,7 @@ static struct wlcore_ops wl12xx_ops = {
1632 .sched_scan_stop = wl12xx_scan_sched_scan_stop, 1632 .sched_scan_stop = wl12xx_scan_sched_scan_stop,
1633 .get_spare_blocks = wl12xx_get_spare_blocks, 1633 .get_spare_blocks = wl12xx_get_spare_blocks,
1634 .set_key = wl12xx_set_key, 1634 .set_key = wl12xx_set_key,
1635 .channel_switch = wl12xx_cmd_channel_switch,
1635 .pre_pkt_send = NULL, 1636 .pre_pkt_send = NULL,
1636}; 1637};
1637 1638
diff --git a/drivers/net/wireless/ti/wl18xx/Makefile b/drivers/net/wireless/ti/wl18xx/Makefile
index f74224960c70..81a864f3d793 100644
--- a/drivers/net/wireless/ti/wl18xx/Makefile
+++ b/drivers/net/wireless/ti/wl18xx/Makefile
@@ -1,3 +1,3 @@
1wl18xx-objs = main.o acx.o tx.o io.o debugfs.o scan.o 1wl18xx-objs = main.o acx.o tx.o io.o debugfs.o scan.o cmd.o
2 2
3obj-$(CONFIG_WL18XX) += wl18xx.o 3obj-$(CONFIG_WL18XX) += wl18xx.o
diff --git a/drivers/net/wireless/ti/wl18xx/cmd.c b/drivers/net/wireless/ti/wl18xx/cmd.c
new file mode 100644
index 000000000000..1d1f6cc7a50a
--- /dev/null
+++ b/drivers/net/wireless/ti/wl18xx/cmd.c
@@ -0,0 +1,80 @@
1/*
2 * This file is part of wl18xx
3 *
4 * Copyright (C) 2011 Texas Instruments Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include "../wlcore/cmd.h"
23#include "../wlcore/debug.h"
24#include "../wlcore/hw_ops.h"
25
26#include "cmd.h"
27
28int wl18xx_cmd_channel_switch(struct wl1271 *wl,
29 struct wl12xx_vif *wlvif,
30 struct ieee80211_channel_switch *ch_switch)
31{
32 struct wl18xx_cmd_channel_switch *cmd;
33 u32 supported_rates;
34 int ret;
35
36 wl1271_debug(DEBUG_ACX, "cmd channel switch");
37
38 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
39 if (!cmd) {
40 ret = -ENOMEM;
41 goto out;
42 }
43
44 cmd->role_id = wlvif->role_id;
45 cmd->channel = ch_switch->channel->hw_value;
46 cmd->switch_time = ch_switch->count;
47 cmd->stop_tx = ch_switch->block_tx;
48
49 switch (ch_switch->channel->band) {
50 case IEEE80211_BAND_2GHZ:
51 cmd->band = WLCORE_BAND_2_4GHZ;
52 break;
53 case IEEE80211_BAND_5GHZ:
54 cmd->band = WLCORE_BAND_5GHZ;
55 break;
56 default:
57 wl1271_error("invalid channel switch band: %d",
58 ch_switch->channel->band);
59 ret = -EINVAL;
60 goto out_free;
61 }
62
63 supported_rates = CONF_TX_ENABLED_RATES | CONF_TX_MCS_RATES |
64 wlcore_hw_sta_get_ap_rate_mask(wl, wlvif);
65 if (wlvif->p2p)
66 supported_rates &= ~CONF_TX_CCK_RATES;
67 cmd->local_supported_rates = cpu_to_le32(supported_rates);
68 cmd->channel_type = wlvif->channel_type;
69
70 ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0);
71 if (ret < 0) {
72 wl1271_error("failed to send channel switch command");
73 goto out_free;
74 }
75
76out_free:
77 kfree(cmd);
78out:
79 return ret;
80}
diff --git a/drivers/net/wireless/ti/wl18xx/cmd.h b/drivers/net/wireless/ti/wl18xx/cmd.h
new file mode 100644
index 000000000000..6687d10899ac
--- /dev/null
+++ b/drivers/net/wireless/ti/wl18xx/cmd.h
@@ -0,0 +1,52 @@
1/*
2 * This file is part of wl18xx
3 *
4 * Copyright (C) 2011 Texas Instruments. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#ifndef __WL18XX_CMD_H__
23#define __WL18XX_CMD_H__
24
25#include "../wlcore/wlcore.h"
26#include "../wlcore/acx.h"
27
28struct wl18xx_cmd_channel_switch {
29 struct wl1271_cmd_header header;
30
31 u8 role_id;
32
33 /* The new serving channel */
34 u8 channel;
35 /* Relative time of the serving channel switch in TBTT units */
36 u8 switch_time;
37 /* Stop the role TX, should expect it after radar detection */
38 u8 stop_tx;
39
40 __le32 local_supported_rates;
41
42 u8 channel_type;
43 u8 band;
44
45 u8 padding[2];
46} __packed;
47
48int wl18xx_cmd_channel_switch(struct wl1271 *wl,
49 struct wl12xx_vif *wlvif,
50 struct ieee80211_channel_switch *ch_switch);
51
52#endif
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index e81b3518d288..2e54a3ea813c 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -34,6 +34,7 @@
34 34
35#include "reg.h" 35#include "reg.h"
36#include "conf.h" 36#include "conf.h"
37#include "cmd.h"
37#include "acx.h" 38#include "acx.h"
38#include "tx.h" 39#include "tx.h"
39#include "wl18xx.h" 40#include "wl18xx.h"
@@ -1335,6 +1336,7 @@ static struct wlcore_ops wl18xx_ops = {
1335 .handle_static_data = wl18xx_handle_static_data, 1336 .handle_static_data = wl18xx_handle_static_data,
1336 .get_spare_blocks = wl18xx_get_spare_blocks, 1337 .get_spare_blocks = wl18xx_get_spare_blocks,
1337 .set_key = wl18xx_set_key, 1338 .set_key = wl18xx_set_key,
1339 .channel_switch = wl18xx_cmd_channel_switch,
1338 .pre_pkt_send = wl18xx_pre_pkt_send, 1340 .pre_pkt_send = wl18xx_pre_pkt_send,
1339}; 1341};
1340 1342
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index c8c776684d2c..979676529ed0 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -1722,43 +1722,7 @@ out:
1722 return ret; 1722 return ret;
1723} 1723}
1724 1724
1725int wl12xx_cmd_channel_switch(struct wl1271 *wl, 1725int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1726 struct wl12xx_vif *wlvif,
1727 struct ieee80211_channel_switch *ch_switch)
1728{
1729 struct wl12xx_cmd_channel_switch *cmd;
1730 int ret;
1731
1732 wl1271_debug(DEBUG_ACX, "cmd channel switch");
1733
1734 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
1735 if (!cmd) {
1736 ret = -ENOMEM;
1737 goto out;
1738 }
1739
1740 cmd->role_id = wlvif->role_id;
1741 cmd->channel = ch_switch->channel->hw_value;
1742 cmd->switch_time = ch_switch->count;
1743 cmd->stop_tx = ch_switch->block_tx;
1744
1745 /* FIXME: control from mac80211 in the future */
1746 cmd->post_switch_tx_disable = 0; /* Enable TX on the target channel */
1747
1748 ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0);
1749 if (ret < 0) {
1750 wl1271_error("failed to send channel switch command");
1751 goto out_free;
1752 }
1753
1754out_free:
1755 kfree(cmd);
1756
1757out:
1758 return ret;
1759}
1760
1761int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl)
1762{ 1726{
1763 struct wl12xx_cmd_stop_channel_switch *cmd; 1727 struct wl12xx_cmd_stop_channel_switch *cmd;
1764 int ret; 1728 int ret;
@@ -1771,6 +1735,8 @@ int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl)
1771 goto out; 1735 goto out;
1772 } 1736 }
1773 1737
1738 cmd->role_id = wlvif->role_id;
1739
1774 ret = wl1271_cmd_send(wl, CMD_STOP_CHANNEL_SWICTH, cmd, sizeof(*cmd), 0); 1740 ret = wl1271_cmd_send(wl, CMD_STOP_CHANNEL_SWICTH, cmd, sizeof(*cmd), 0);
1775 if (ret < 0) { 1741 if (ret < 0) {
1776 wl1271_error("failed to stop channel switch command"); 1742 wl1271_error("failed to stop channel switch command");
diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h
index 9e9062fdb712..96d53a730a31 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.h
+++ b/drivers/net/wireless/ti/wlcore/cmd.h
@@ -89,7 +89,8 @@ int wl12xx_cmd_stop_fwlog(struct wl1271 *wl);
89int wl12xx_cmd_channel_switch(struct wl1271 *wl, 89int wl12xx_cmd_channel_switch(struct wl1271 *wl,
90 struct wl12xx_vif *wlvif, 90 struct wl12xx_vif *wlvif,
91 struct ieee80211_channel_switch *ch_switch); 91 struct ieee80211_channel_switch *ch_switch);
92int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl); 92int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl,
93 struct wl12xx_vif *wlvif);
93int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, 94int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif,
94 u8 *hlid); 95 u8 *hlid);
95void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid); 96void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid);
@@ -633,27 +634,13 @@ struct wl12xx_cmd_stop_fwlog {
633 struct wl1271_cmd_header header; 634 struct wl1271_cmd_header header;
634} __packed; 635} __packed;
635 636
636struct wl12xx_cmd_channel_switch { 637struct wl12xx_cmd_stop_channel_switch {
637 struct wl1271_cmd_header header; 638 struct wl1271_cmd_header header;
638 639
639 u8 role_id; 640 u8 role_id;
640
641 /* The new serving channel */
642 u8 channel;
643 /* Relative time of the serving channel switch in TBTT units */
644 u8 switch_time;
645 /* Stop the role TX, should expect it after radar detection */
646 u8 stop_tx;
647 /* The target channel tx status 1-stopped 0-open*/
648 u8 post_switch_tx_disable;
649
650 u8 padding[3]; 641 u8 padding[3];
651} __packed; 642} __packed;
652 643
653struct wl12xx_cmd_stop_channel_switch {
654 struct wl1271_cmd_header header;
655} __packed;
656
657/* Used to check radio status after calibration */ 644/* Used to check radio status after calibration */
658#define MAX_TLV_LENGTH 500 645#define MAX_TLV_LENGTH 500
659#define TEST_CMD_P2G_CAL 2 /* TX BiP */ 646#define TEST_CMD_P2G_CAL 2 /* TX BiP */
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 0f7a9338d10b..efb770a02822 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -2673,7 +2673,7 @@ static int wlcore_unset_assoc(struct wl1271 *wl, struct wl12xx_vif *wlvif)
2673 if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) { 2673 if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) {
2674 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); 2674 struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
2675 2675
2676 wl12xx_cmd_stop_channel_switch(wl); 2676 wl12xx_cmd_stop_channel_switch(wl, wlvif);
2677 ieee80211_chswitch_done(vif, false); 2677 ieee80211_chswitch_done(vif, false);
2678 } 2678 }
2679 2679
@@ -4680,8 +4680,7 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw,
4680 4680
4681 /* TODO: change mac80211 to pass vif as param */ 4681 /* TODO: change mac80211 to pass vif as param */
4682 wl12xx_for_each_wlvif_sta(wl, wlvif) { 4682 wl12xx_for_each_wlvif_sta(wl, wlvif) {
4683 ret = wl12xx_cmd_channel_switch(wl, wlvif, ch_switch); 4683 ret = wl->ops->channel_switch(wl, wlvif, ch_switch);
4684
4685 if (!ret) 4684 if (!ret)
4686 set_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags); 4685 set_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags);
4687 } 4686 }
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 36fde4e01969..1ad49c9ea7a4 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -95,6 +95,9 @@ struct wlcore_ops {
95 struct ieee80211_vif *vif, 95 struct ieee80211_vif *vif,
96 struct ieee80211_sta *sta, 96 struct ieee80211_sta *sta,
97 struct ieee80211_key_conf *key_conf); 97 struct ieee80211_key_conf *key_conf);
98 int (*channel_switch)(struct wl1271 *wl,
99 struct wl12xx_vif *wlvif,
100 struct ieee80211_channel_switch *ch_switch);
98 u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len); 101 u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
99}; 102};
100 103