aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti
diff options
context:
space:
mode:
authorDavid Gnedt <david.gnedt@davizone.at>2014-01-07 07:07:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-01-09 10:54:58 -0500
commit4d09b5378defd4ef685f9d33e0d35b380109eafa (patch)
treec4f78e3938bc864e6140bb1cce434543ea36d096 /drivers/net/wireless/ti
parent9281691fb2e48f0853bb986a9049e5d9c8bf1578 (diff)
wl1251: configure hardware en-/decryption for monitor mode
Disable hardware encryption (DF_ENCRYPTION_DISABLE) and decryption (DF_SNIFF_MODE_ENABLE) via wl1251_acx_feature_cfg while monitor interface is present. Signed-off-by: David Gnedt <david.gnedt@davizone.at> Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r--drivers/net/wireless/ti/wl1251/acx.c6
-rw-r--r--drivers/net/wireless/ti/wl1251/acx.h2
-rw-r--r--drivers/net/wireless/ti/wl1251/init.c2
-rw-r--r--drivers/net/wireless/ti/wl1251/main.c34
-rw-r--r--drivers/net/wireless/ti/wl1251/rx.c2
-rw-r--r--drivers/net/wireless/ti/wl1251/tx.c3
-rw-r--r--drivers/net/wireless/ti/wl1251/wl1251.h1
7 files changed, 39 insertions, 11 deletions
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index eaf2d5dadcb9..b390adfb5d89 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -194,7 +194,7 @@ out:
194 return ret; 194 return ret;
195} 195}
196 196
197int wl1251_acx_feature_cfg(struct wl1251 *wl) 197int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options)
198{ 198{
199 struct acx_feature_config *feature; 199 struct acx_feature_config *feature;
200 int ret; 200 int ret;
@@ -205,8 +205,8 @@ int wl1251_acx_feature_cfg(struct wl1251 *wl)
205 if (!feature) 205 if (!feature)
206 return -ENOMEM; 206 return -ENOMEM;
207 207
208 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */ 208 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE can be set */
209 feature->data_flow_options = 0; 209 feature->data_flow_options = data_flow_options;
210 feature->options = 0; 210 feature->options = 0;
211 211
212 ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG, 212 ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG,
diff --git a/drivers/net/wireless/ti/wl1251/acx.h b/drivers/net/wireless/ti/wl1251/acx.h
index ba9ddc05e47a..5360bbecd073 100644
--- a/drivers/net/wireless/ti/wl1251/acx.h
+++ b/drivers/net/wireless/ti/wl1251/acx.h
@@ -1454,7 +1454,7 @@ int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event,
1454int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth); 1454int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth);
1455int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len); 1455int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len);
1456int wl1251_acx_tx_power(struct wl1251 *wl, int power); 1456int wl1251_acx_tx_power(struct wl1251 *wl, int power);
1457int wl1251_acx_feature_cfg(struct wl1251 *wl); 1457int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options);
1458int wl1251_acx_mem_map(struct wl1251 *wl, 1458int wl1251_acx_mem_map(struct wl1251 *wl,
1459 struct acx_header *mem_map, size_t len); 1459 struct acx_header *mem_map, size_t len);
1460int wl1251_acx_data_path_params(struct wl1251 *wl, 1460int wl1251_acx_data_path_params(struct wl1251 *wl,
diff --git a/drivers/net/wireless/ti/wl1251/init.c b/drivers/net/wireless/ti/wl1251/init.c
index 1641e4c8fa52..4b78965ebf6f 100644
--- a/drivers/net/wireless/ti/wl1251/init.c
+++ b/drivers/net/wireless/ti/wl1251/init.c
@@ -33,7 +33,7 @@ int wl1251_hw_init_hwenc_config(struct wl1251 *wl)
33{ 33{
34 int ret; 34 int ret;
35 35
36 ret = wl1251_acx_feature_cfg(wl); 36 ret = wl1251_acx_feature_cfg(wl, 0);
37 if (ret < 0) { 37 if (ret < 0) {
38 wl1251_warning("couldn't set feature config"); 38 wl1251_warning("couldn't set feature config");
39 return ret; 39 return ret;
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 9fee7f4d1152..afd79aa69869 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -484,6 +484,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
484 wl->power_level = WL1251_DEFAULT_POWER_LEVEL; 484 wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
485 wl->rssi_thold = 0; 485 wl->rssi_thold = 0;
486 wl->channel = WL1251_DEFAULT_CHANNEL; 486 wl->channel = WL1251_DEFAULT_CHANNEL;
487 wl->monitor_present = false;
487 488
488 wl1251_debugfs_reset(wl); 489 wl1251_debugfs_reset(wl);
489 490
@@ -576,8 +577,10 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
576 channel = ieee80211_frequency_to_channel( 577 channel = ieee80211_frequency_to_channel(
577 conf->chandef.chan->center_freq); 578 conf->chandef.chan->center_freq);
578 579
579 wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d", 580 wl1251_debug(DEBUG_MAC80211,
581 "mac80211 config ch %d monitor %s psm %s power %d",
580 channel, 582 channel,
583 conf->flags & IEEE80211_CONF_MONITOR ? "on" : "off",
581 conf->flags & IEEE80211_CONF_PS ? "on" : "off", 584 conf->flags & IEEE80211_CONF_PS ? "on" : "off",
582 conf->power_level); 585 conf->power_level);
583 586
@@ -587,6 +590,22 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
587 if (ret < 0) 590 if (ret < 0)
588 goto out; 591 goto out;
589 592
593 if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
594 u32 mode;
595
596 if (conf->flags & IEEE80211_CONF_MONITOR) {
597 wl->monitor_present = true;
598 mode = DF_SNIFF_MODE_ENABLE | DF_ENCRYPTION_DISABLE;
599 } else {
600 wl->monitor_present = false;
601 mode = 0;
602 }
603
604 ret = wl1251_acx_feature_cfg(wl, mode);
605 if (ret < 0)
606 goto out_sleep;
607 }
608
590 if (channel != wl->channel) { 609 if (channel != wl->channel) {
591 wl->channel = channel; 610 wl->channel = channel;
592 611
@@ -803,12 +822,12 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
803 822
804 mutex_lock(&wl->mutex); 823 mutex_lock(&wl->mutex);
805 824
806 ret = wl1251_ps_elp_wakeup(wl);
807 if (ret < 0)
808 goto out_unlock;
809
810 switch (cmd) { 825 switch (cmd) {
811 case SET_KEY: 826 case SET_KEY:
827 if (wl->monitor_present) {
828 ret = -EOPNOTSUPP;
829 goto out_unlock;
830 }
812 wl_cmd->key_action = KEY_ADD_OR_REPLACE; 831 wl_cmd->key_action = KEY_ADD_OR_REPLACE;
813 break; 832 break;
814 case DISABLE_KEY: 833 case DISABLE_KEY:
@@ -819,6 +838,10 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
819 break; 838 break;
820 } 839 }
821 840
841 ret = wl1251_ps_elp_wakeup(wl);
842 if (ret < 0)
843 goto out_unlock;
844
822 ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr); 845 ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr);
823 if (ret < 0) { 846 if (ret < 0) {
824 wl1251_error("Set KEY type failed"); 847 wl1251_error("Set KEY type failed");
@@ -1415,6 +1438,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
1415 1438
1416 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); 1439 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work);
1417 wl->channel = WL1251_DEFAULT_CHANNEL; 1440 wl->channel = WL1251_DEFAULT_CHANNEL;
1441 wl->monitor_present = false;
1418 wl->scanning = false; 1442 wl->scanning = false;
1419 wl->default_key = 0; 1443 wl->default_key = 0;
1420 wl->listen_int = 1; 1444 wl->listen_int = 1;
diff --git a/drivers/net/wireless/ti/wl1251/rx.c b/drivers/net/wireless/ti/wl1251/rx.c
index 23289d49dd31..123c4bb50e0a 100644
--- a/drivers/net/wireless/ti/wl1251/rx.c
+++ b/drivers/net/wireless/ti/wl1251/rx.c
@@ -83,7 +83,7 @@ static void wl1251_rx_status(struct wl1251 *wl,
83 83
84 status->flag |= RX_FLAG_MACTIME_START; 84 status->flag |= RX_FLAG_MACTIME_START;
85 85
86 if (desc->flags & RX_DESC_ENCRYPTION_MASK) { 86 if (!wl->monitor_present && (desc->flags & RX_DESC_ENCRYPTION_MASK)) {
87 status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED; 87 status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
88 88
89 if (likely(!(desc->flags & RX_DESC_DECRYPT_FAIL))) 89 if (likely(!(desc->flags & RX_DESC_DECRYPT_FAIL)))
diff --git a/drivers/net/wireless/ti/wl1251/tx.c b/drivers/net/wireless/ti/wl1251/tx.c
index 28121c590a2b..466cd25c022b 100644
--- a/drivers/net/wireless/ti/wl1251/tx.c
+++ b/drivers/net/wireless/ti/wl1251/tx.c
@@ -287,6 +287,9 @@ static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb)
287 info = IEEE80211_SKB_CB(skb); 287 info = IEEE80211_SKB_CB(skb);
288 288
289 if (info->control.hw_key) { 289 if (info->control.hw_key) {
290 if (unlikely(wl->monitor_present))
291 return -EINVAL;
292
290 idx = info->control.hw_key->hw_key_idx; 293 idx = info->control.hw_key->hw_key_idx;
291 if (unlikely(wl->default_key != idx)) { 294 if (unlikely(wl->default_key != idx)) {
292 ret = wl1251_acx_default_key(wl, idx); 295 ret = wl1251_acx_default_key(wl, idx);
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h
index 24869458cf74..58bb414c51e5 100644
--- a/drivers/net/wireless/ti/wl1251/wl1251.h
+++ b/drivers/net/wireless/ti/wl1251/wl1251.h
@@ -303,6 +303,7 @@ struct wl1251 {
303 u8 bss_type; 303 u8 bss_type;
304 u8 listen_int; 304 u8 listen_int;
305 int channel; 305 int channel;
306 bool monitor_present;
306 307
307 void *target_mem_map; 308 void *target_mem_map;
308 struct acx_data_path_params_resp *data_path; 309 struct acx_data_path_params_resp *data_path;