aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Gnedt <david.gnedt@davizone.at>2014-01-07 07:10:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-01-09 10:56:08 -0500
commitc8909e5a275bfb57dc525d6551ed572e118e2eea (patch)
treee7cada306a872a763cc58ab42695aa7b6380b138
parented3213c9134f322b8faf945a1528a0f0344c8510 (diff)
wl1251: enable tx path in monitor mode if necessary for packet injection
If necessary enable the tx path in monitor mode for packet injection using the JOIN command with BSS_TYPE_STA_BSS and zero BSSID. 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>
-rw-r--r--drivers/net/wireless/ti/wl1251/main.c5
-rw-r--r--drivers/net/wireless/ti/wl1251/tx.c25
-rw-r--r--drivers/net/wireless/ti/wl1251/wl1251.h1
3 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 855026a34e45..5a265a24f1fe 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -486,6 +486,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
486 wl->rssi_thold = 0; 486 wl->rssi_thold = 0;
487 wl->channel = WL1251_DEFAULT_CHANNEL; 487 wl->channel = WL1251_DEFAULT_CHANNEL;
488 wl->monitor_present = false; 488 wl->monitor_present = false;
489 wl->joined = false;
489 490
490 wl1251_debugfs_reset(wl); 491 wl1251_debugfs_reset(wl);
491 492
@@ -545,6 +546,7 @@ static void wl1251_op_remove_interface(struct ieee80211_hw *hw,
545 mutex_lock(&wl->mutex); 546 mutex_lock(&wl->mutex);
546 wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface"); 547 wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface");
547 wl->vif = NULL; 548 wl->vif = NULL;
549 memset(wl->bssid, 0, ETH_ALEN);
548 mutex_unlock(&wl->mutex); 550 mutex_unlock(&wl->mutex);
549} 551}
550 552
@@ -623,6 +625,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
623 * at firmware level. 625 * at firmware level.
624 */ 626 */
625 if (wl->vif == NULL) { 627 if (wl->vif == NULL) {
628 wl->joined = false;
626 ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1); 629 ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
627 } else { 630 } else {
628 ret = wl1251_join(wl, wl->bss_type, wl->channel, 631 ret = wl1251_join(wl, wl->bss_type, wl->channel,
@@ -1507,7 +1510,9 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
1507 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); 1510 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work);
1508 wl->channel = WL1251_DEFAULT_CHANNEL; 1511 wl->channel = WL1251_DEFAULT_CHANNEL;
1509 wl->monitor_present = false; 1512 wl->monitor_present = false;
1513 wl->joined = false;
1510 wl->scanning = false; 1514 wl->scanning = false;
1515 wl->bss_type = MAX_BSS_TYPE;
1511 wl->default_key = 0; 1516 wl->default_key = 0;
1512 wl->listen_int = 1; 1517 wl->listen_int = 1;
1513 wl->rx_counter = 0; 1518 wl->rx_counter = 0;
diff --git a/drivers/net/wireless/ti/wl1251/tx.c b/drivers/net/wireless/ti/wl1251/tx.c
index 466cd25c022b..b91ea24bcedb 100644
--- a/drivers/net/wireless/ti/wl1251/tx.c
+++ b/drivers/net/wireless/ti/wl1251/tx.c
@@ -28,6 +28,7 @@
28#include "tx.h" 28#include "tx.h"
29#include "ps.h" 29#include "ps.h"
30#include "io.h" 30#include "io.h"
31#include "event.h"
31 32
32static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count) 33static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count)
33{ 34{
@@ -277,6 +278,26 @@ static void wl1251_tx_trigger(struct wl1251 *wl)
277 TX_STATUS_DATA_OUT_COUNT_MASK; 278 TX_STATUS_DATA_OUT_COUNT_MASK;
278} 279}
279 280
281static void enable_tx_for_packet_injection(struct wl1251 *wl)
282{
283 int ret;
284
285 ret = wl1251_cmd_join(wl, BSS_TYPE_STA_BSS, wl->channel,
286 wl->beacon_int, wl->dtim_period);
287 if (ret < 0) {
288 wl1251_warning("join failed");
289 return;
290 }
291
292 ret = wl1251_event_wait(wl, JOIN_EVENT_COMPLETE_ID, 100);
293 if (ret < 0) {
294 wl1251_warning("join timeout");
295 return;
296 }
297
298 wl->joined = true;
299}
300
280/* caller must hold wl->mutex */ 301/* caller must hold wl->mutex */
281static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb) 302static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb)
282{ 303{
@@ -298,6 +319,10 @@ static int wl1251_tx_frame(struct wl1251 *wl, struct sk_buff *skb)
298 } 319 }
299 } 320 }
300 321
322 /* Enable tx path in monitor mode for packet injection */
323 if ((wl->vif == NULL) && !wl->joined)
324 enable_tx_for_packet_injection(wl);
325
301 ret = wl1251_tx_path_status(wl); 326 ret = wl1251_tx_path_status(wl);
302 if (ret < 0) 327 if (ret < 0)
303 return ret; 328 return ret;
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h
index e231cdc44fc5..235617a7716d 100644
--- a/drivers/net/wireless/ti/wl1251/wl1251.h
+++ b/drivers/net/wireless/ti/wl1251/wl1251.h
@@ -305,6 +305,7 @@ struct wl1251 {
305 u8 listen_int; 305 u8 listen_int;
306 int channel; 306 int channel;
307 bool monitor_present; 307 bool monitor_present;
308 bool joined;
308 309
309 void *target_mem_map; 310 void *target_mem_map;
310 struct acx_data_path_params_resp *data_path; 311 struct acx_data_path_params_resp *data_path;