aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mac80211_hwsim.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-11-01 04:30:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-02 15:43:26 -0500
commit70541839dd2eacb521fa4f8515ab696599b36ea3 (patch)
tree3e82863e254f33485c00e95a88af9d33fa4c7c4e /drivers/net/wireless/mac80211_hwsim.c
parentc5f8289cd9b2e31fca506cb82f4aaa5ffc468602 (diff)
mac80211_hwsim: Check idle state on TX
Track the idle state for hwsim radios and reject TX if mac80211 is trying to transmit something when the radio is supposed to be idle. In addition, do not deliver frames if the receiving radio is in the idle state. Signed-off-by: Jouni Malinen <j@w1.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index d2b2e5e739b7..58c357eaf216 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -284,7 +284,7 @@ struct mac80211_hwsim_data {
284 struct ieee80211_channel *channel; 284 struct ieee80211_channel *channel;
285 unsigned long beacon_int; /* in jiffies unit */ 285 unsigned long beacon_int; /* in jiffies unit */
286 unsigned int rx_filter; 286 unsigned int rx_filter;
287 int started; 287 bool started, idle;
288 struct timer_list beacon_timer; 288 struct timer_list beacon_timer;
289 enum ps_mode { 289 enum ps_mode {
290 PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL 290 PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL
@@ -402,6 +402,12 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
402 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 402 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
403 struct ieee80211_rx_status rx_status; 403 struct ieee80211_rx_status rx_status;
404 404
405 if (data->idle) {
406 printk(KERN_DEBUG "%s: Trying to TX when idle - reject\n",
407 wiphy_name(hw->wiphy));
408 return false;
409 }
410
405 memset(&rx_status, 0, sizeof(rx_status)); 411 memset(&rx_status, 0, sizeof(rx_status));
406 /* TODO: set mactime */ 412 /* TODO: set mactime */
407 rx_status.freq = data->channel->center_freq; 413 rx_status.freq = data->channel->center_freq;
@@ -428,7 +434,8 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
428 if (data == data2) 434 if (data == data2)
429 continue; 435 continue;
430 436
431 if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || 437 if (data2->idle || !data2->started ||
438 !hwsim_ps_rx_ok(data2, skb) ||
432 !data->channel || !data2->channel || 439 !data->channel || !data2->channel ||
433 data->channel->center_freq != data2->channel->center_freq || 440 data->channel->center_freq != data2->channel->center_freq ||
434 !(data->group & data2->group)) 441 !(data->group & data2->group))
@@ -571,6 +578,8 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
571 !!(conf->flags & IEEE80211_CONF_IDLE), 578 !!(conf->flags & IEEE80211_CONF_IDLE),
572 !!(conf->flags & IEEE80211_CONF_PS)); 579 !!(conf->flags & IEEE80211_CONF_PS));
573 580
581 data->idle = !!(conf->flags & IEEE80211_CONF_IDLE);
582
574 data->channel = conf->channel; 583 data->channel = conf->channel;
575 if (!data->started || !data->beacon_int) 584 if (!data->started || !data->beacon_int)
576 del_timer(&data->beacon_timer); 585 del_timer(&data->beacon_timer);