2009-12-23 05:15:40 -07:00
|
|
|
/*
|
|
|
|
* Off-channel operation helpers
|
|
|
|
*
|
|
|
|
* Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
|
|
|
|
* Copyright 2004, Instant802 Networks, Inc.
|
|
|
|
* Copyright 2005, Devicescape Software, Inc.
|
|
|
|
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
|
|
|
|
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
|
|
|
|
* Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
2011-07-15 08:47:34 -07:00
|
|
|
#include <linux/export.h>
|
2009-12-23 05:15:40 -07:00
|
|
|
#include <net/mac80211.h>
|
|
|
|
#include "ieee80211_i.h"
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
#include "driver-ops.h"
|
2009-12-23 05:15:40 -07:00
|
|
|
|
|
|
|
/*
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
* Tell our hardware to disable PS.
|
|
|
|
* Optionally inform AP that we will go to sleep so that it will buffer
|
|
|
|
* the frames while we are doing off-channel work. This is optional
|
|
|
|
* because we *may* be doing work on-operating channel, and want our
|
|
|
|
* hardware unconditionally awake, but still let the AP send us normal frames.
|
2009-12-23 05:15:40 -07:00
|
|
|
*/
|
2012-06-18 06:33:52 -07:00
|
|
|
static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
|
2009-12-23 05:15:40 -07:00
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
2010-09-16 12:12:31 -07:00
|
|
|
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
|
2009-12-23 05:15:40 -07:00
|
|
|
|
|
|
|
local->offchannel_ps_enabled = false;
|
|
|
|
|
|
|
|
/* FIXME: what to do when local->pspolling is true? */
|
|
|
|
|
|
|
|
del_timer_sync(&local->dynamic_ps_timer);
|
2010-09-16 12:12:33 -07:00
|
|
|
del_timer_sync(&ifmgd->bcn_mon_timer);
|
2010-09-16 12:12:31 -07:00
|
|
|
del_timer_sync(&ifmgd->conn_mon_timer);
|
|
|
|
|
2009-12-23 05:15:40 -07:00
|
|
|
cancel_work_sync(&local->dynamic_ps_enable_work);
|
|
|
|
|
|
|
|
if (local->hw.conf.flags & IEEE80211_CONF_PS) {
|
|
|
|
local->offchannel_ps_enabled = true;
|
|
|
|
local->hw.conf.flags &= ~IEEE80211_CONF_PS;
|
|
|
|
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
|
|
|
|
}
|
|
|
|
|
2012-06-18 06:33:52 -07:00
|
|
|
if (!local->offchannel_ps_enabled ||
|
|
|
|
!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
|
2009-12-23 05:15:40 -07:00
|
|
|
/*
|
|
|
|
* If power save was enabled, no need to send a nullfunc
|
|
|
|
* frame because AP knows that we are sleeping. But if the
|
|
|
|
* hardware is creating the nullfunc frame for power save
|
|
|
|
* status (ie. IEEE80211_HW_PS_NULLFUNC_STACK is not
|
|
|
|
* enabled) and power save was enabled, the firmware just
|
|
|
|
* sent a null frame with power save disabled. So we need
|
|
|
|
* to send a new nullfunc frame to inform the AP that we
|
|
|
|
* are again sleeping.
|
|
|
|
*/
|
|
|
|
ieee80211_send_nullfunc(local, sdata, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* inform AP that we are awake again, unless power save is enabled */
|
|
|
|
static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
|
|
|
|
if (!local->ps_sdata)
|
|
|
|
ieee80211_send_nullfunc(local, sdata, 0);
|
|
|
|
else if (local->offchannel_ps_enabled) {
|
|
|
|
/*
|
|
|
|
* In !IEEE80211_HW_PS_NULLFUNC_STACK case the hardware
|
|
|
|
* will send a nullfunc frame with the powersave bit set
|
|
|
|
* even though the AP already knows that we are sleeping.
|
|
|
|
* This could be avoided by sending a null frame with power
|
|
|
|
* save bit disabled before enabling the power save, but
|
|
|
|
* this doesn't gain anything.
|
|
|
|
*
|
|
|
|
* When IEEE80211_HW_PS_NULLFUNC_STACK is enabled, no need
|
|
|
|
* to send a nullfunc frame because AP already knows that
|
|
|
|
* we are sleeping, let's just enable power save mode in
|
|
|
|
* hardware.
|
|
|
|
*/
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
/* TODO: Only set hardware if CONF_PS changed?
|
|
|
|
* TODO: Should we set offchannel_ps_enabled to false?
|
|
|
|
*/
|
2009-12-23 05:15:40 -07:00
|
|
|
local->hw.conf.flags |= IEEE80211_CONF_PS;
|
|
|
|
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
|
|
|
|
} else if (local->hw.conf.dynamic_ps_timeout > 0) {
|
|
|
|
/*
|
|
|
|
* If IEEE80211_CONF_PS was not set and the dynamic_ps_timer
|
|
|
|
* had been running before leaving the operating channel,
|
|
|
|
* restart the timer now and send a nullfunc frame to inform
|
|
|
|
* the AP that we are awake.
|
|
|
|
*/
|
|
|
|
ieee80211_send_nullfunc(local, sdata, 0);
|
|
|
|
mod_timer(&local->dynamic_ps_timer, jiffies +
|
|
|
|
msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
|
|
|
|
}
|
2010-09-16 12:12:31 -07:00
|
|
|
|
2010-09-16 12:12:33 -07:00
|
|
|
ieee80211_sta_reset_beacon_monitor(sdata);
|
2010-09-16 12:12:31 -07:00
|
|
|
ieee80211_sta_reset_conn_monitor(sdata);
|
2009-12-23 05:15:40 -07:00
|
|
|
}
|
|
|
|
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
|
|
|
|
bool offchannel_ps_enable)
|
2009-12-23 05:15:40 -07:00
|
|
|
{
|
|
|
|
struct ieee80211_sub_if_data *sdata;
|
|
|
|
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
/*
|
|
|
|
* notify the AP about us leaving the channel and stop all
|
|
|
|
* STA interfaces.
|
|
|
|
*/
|
2009-12-23 05:15:40 -07:00
|
|
|
mutex_lock(&local->iflist_mtx);
|
|
|
|
list_for_each_entry(sdata, &local->interfaces, list) {
|
|
|
|
if (!ieee80211_sdata_running(sdata))
|
|
|
|
continue;
|
|
|
|
|
2012-06-18 11:07:15 -07:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
|
|
|
|
continue;
|
|
|
|
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
|
|
|
|
set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
|
|
|
|
|
|
|
|
/* Check to see if we should disable beaconing. */
|
2009-12-23 05:15:40 -07:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_ADHOC ||
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
|
|
|
ieee80211_bss_info_change_notify(
|
|
|
|
sdata, BSS_CHANGED_BEACON_ENABLED);
|
|
|
|
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
|
2010-01-06 15:22:54 -07:00
|
|
|
netif_tx_stop_all_queues(sdata->dev);
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
if (offchannel_ps_enable &&
|
|
|
|
(sdata->vif.type == NL80211_IFTYPE_STATION) &&
|
|
|
|
sdata->u.mgd.associated)
|
2012-06-18 06:33:52 -07:00
|
|
|
ieee80211_offchannel_ps_enable(sdata);
|
2010-08-27 04:45:28 -07:00
|
|
|
}
|
2009-12-23 05:15:40 -07:00
|
|
|
}
|
|
|
|
mutex_unlock(&local->iflist_mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_offchannel_return(struct ieee80211_local *local,
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
bool offchannel_ps_disable)
|
2009-12-23 05:15:40 -07:00
|
|
|
{
|
|
|
|
struct ieee80211_sub_if_data *sdata;
|
|
|
|
|
|
|
|
mutex_lock(&local->iflist_mtx);
|
|
|
|
list_for_each_entry(sdata, &local->interfaces, list) {
|
2012-06-18 11:07:15 -07:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
|
|
|
|
continue;
|
|
|
|
|
2011-12-22 16:48:06 -07:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
|
|
|
|
clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
|
|
|
|
|
2009-12-23 05:15:40 -07:00
|
|
|
if (!ieee80211_sdata_running(sdata))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Tell AP we're back */
|
mac80211: Optimize scans on current operating channel.
This should decrease un-necessary flushes, on/off channel work,
and channel changes in cases where the only scanned channel is
the current operating channel.
* Removes SCAN_OFF_CHANNEL flag, uses SDATA_STATE_OFFCHANNEL
and is-scanning flags instead.
* Add helper method to determine if we are currently configured
for the operating channel.
* Do no blindly go off/on channel in work.c Instead, only call
appropriate on/off code when we really need to change channels.
Always enable offchannel-ps mode when starting work,
and disable it when we are done.
* Consolidate ieee80211_offchannel_stop_station and
ieee80211_offchannel_stop_beaconing, call it
ieee80211_offchannel_stop_vifs instead.
* Accept non-beacon frames when scanning on operating channel.
* Scan state machine optimized to minimize on/off channel
transitions. Also, when going on-channel, go ahead and
re-enable beaconing. We're going to be there for 200ms,
so seems like some useful beaconing could happen.
Always enable offchannel-ps mode when starting software
scan, and disable it when we are done.
* Grab local->mtx earlier in __ieee80211_scan_completed_finish
so that we are protected when calling hw_config(), etc.
* Pass probe-responses up the stack if scanning on local
channel, so that mlme can take a look.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-02-04 12:54:17 -07:00
|
|
|
if (offchannel_ps_disable &&
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_STATION) {
|
2009-12-23 05:15:40 -07:00
|
|
|
if (sdata->u.mgd.associated)
|
|
|
|
ieee80211_offchannel_ps_disable(sdata);
|
|
|
|
}
|
|
|
|
|
2010-08-27 04:45:28 -07:00
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
|
|
|
|
/*
|
|
|
|
* This may wake up queues even though the driver
|
|
|
|
* currently has them stopped. This is not very
|
|
|
|
* likely, since the driver won't have gotten any
|
|
|
|
* (or hardly any) new packets while we weren't
|
|
|
|
* on the right channel, and even if it happens
|
|
|
|
* it will at most lead to queueing up one more
|
|
|
|
* packet per queue in mac80211 rather than on
|
|
|
|
* the interface qdisc.
|
|
|
|
*/
|
2010-01-14 15:20:31 -07:00
|
|
|
netif_tx_wake_all_queues(sdata->dev);
|
2010-08-27 04:45:28 -07:00
|
|
|
}
|
2010-01-14 15:20:31 -07:00
|
|
|
|
2011-11-29 02:20:02 -07:00
|
|
|
if (sdata->vif.type == NL80211_IFTYPE_AP ||
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_ADHOC ||
|
|
|
|
sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
|
2009-12-23 05:15:40 -07:00
|
|
|
ieee80211_bss_info_change_notify(
|
|
|
|
sdata, BSS_CHANGED_BEACON_ENABLED);
|
|
|
|
}
|
|
|
|
mutex_unlock(&local->iflist_mtx);
|
|
|
|
}
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc)
|
|
|
|
{
|
|
|
|
if (roc->notified)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (roc->mgmt_tx_cookie) {
|
|
|
|
if (!WARN_ON(!roc->frame)) {
|
|
|
|
ieee80211_tx_skb(roc->sdata, roc->frame);
|
|
|
|
roc->frame = NULL;
|
|
|
|
}
|
|
|
|
} else {
|
2012-06-15 06:30:18 -07:00
|
|
|
cfg80211_ready_on_channel(&roc->sdata->wdev, (unsigned long)roc,
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
roc->chan, roc->chan_type,
|
|
|
|
roc->req_duration, GFP_KERNEL);
|
|
|
|
}
|
|
|
|
|
|
|
|
roc->notified = true;
|
|
|
|
}
|
|
|
|
|
2010-12-18 09:20:47 -07:00
|
|
|
static void ieee80211_hw_roc_start(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local =
|
|
|
|
container_of(work, struct ieee80211_local, hw_roc_start);
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
struct ieee80211_roc_work *roc, *dep, *tmp;
|
2010-12-18 09:20:47 -07:00
|
|
|
|
|
|
|
mutex_lock(&local->mtx);
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
if (list_empty(&local->roc_list))
|
|
|
|
goto out_unlock;
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work,
|
|
|
|
list);
|
|
|
|
|
|
|
|
if (!roc->started)
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
roc->hw_begun = true;
|
|
|
|
roc->hw_start_time = local->hw_roc_start_time;
|
2010-12-18 09:20:48 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
ieee80211_handle_roc_started(roc);
|
|
|
|
list_for_each_entry_safe(dep, tmp, &roc->dependents, list) {
|
|
|
|
ieee80211_handle_roc_started(dep);
|
|
|
|
|
|
|
|
if (dep->duration > roc->duration) {
|
|
|
|
u32 dur = dep->duration;
|
|
|
|
dep->duration = dur - roc->duration;
|
|
|
|
roc->duration = dur;
|
2012-09-05 22:20:53 -07:00
|
|
|
list_move(&dep->list, &roc->list);
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
out_unlock:
|
2010-12-18 09:20:47 -07:00
|
|
|
mutex_unlock(&local->mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_ready_on_channel(struct ieee80211_hw *hw)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = hw_to_local(hw);
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
local->hw_roc_start_time = jiffies;
|
|
|
|
|
2010-12-18 09:20:47 -07:00
|
|
|
trace_api_ready_on_channel(local);
|
|
|
|
|
|
|
|
ieee80211_queue_work(hw, &local->hw_roc_start);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(ieee80211_ready_on_channel);
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
void ieee80211_start_next_roc(struct ieee80211_local *local)
|
2010-12-18 09:20:47 -07:00
|
|
|
{
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
struct ieee80211_roc_work *roc;
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
lockdep_assert_held(&local->mtx);
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
if (list_empty(&local->roc_list)) {
|
|
|
|
ieee80211_run_deferred_scan(local);
|
2010-12-18 09:20:47 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work,
|
|
|
|
list);
|
2012-05-31 06:09:27 -07:00
|
|
|
|
2012-06-20 11:11:33 -07:00
|
|
|
if (WARN_ON_ONCE(roc->started))
|
|
|
|
return;
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
if (local->ops->remain_on_channel) {
|
|
|
|
int ret, duration = roc->duration;
|
2012-05-31 06:09:27 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
/* XXX: duplicated, see ieee80211_start_roc_work() */
|
|
|
|
if (!duration)
|
|
|
|
duration = 10;
|
2012-05-31 06:09:27 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
ret = drv_remain_on_channel(local, roc->chan,
|
|
|
|
roc->chan_type,
|
|
|
|
duration);
|
|
|
|
|
|
|
|
roc->started = true;
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
wiphy_warn(local->hw.wiphy,
|
|
|
|
"failed to start next HW ROC (%d)\n", ret);
|
|
|
|
/*
|
|
|
|
* queue the work struct again to avoid recursion
|
|
|
|
* when multiple failures occur
|
|
|
|
*/
|
|
|
|
ieee80211_remain_on_channel_expired(&local->hw);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* delay it a bit */
|
|
|
|
ieee80211_queue_delayed_work(&local->hw, &roc->work,
|
|
|
|
round_jiffies_relative(HZ/2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
|
|
|
|
{
|
|
|
|
struct ieee80211_roc_work *dep, *tmp;
|
|
|
|
|
|
|
|
/* was never transmitted */
|
|
|
|
if (roc->frame) {
|
2012-06-15 06:30:18 -07:00
|
|
|
cfg80211_mgmt_tx_status(&roc->sdata->wdev,
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
(unsigned long)roc->frame,
|
|
|
|
roc->frame->data, roc->frame->len,
|
|
|
|
false, GFP_KERNEL);
|
|
|
|
kfree_skb(roc->frame);
|
2012-05-31 06:09:27 -07:00
|
|
|
}
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
if (!roc->mgmt_tx_cookie)
|
2012-06-15 06:30:18 -07:00
|
|
|
cfg80211_remain_on_channel_expired(&roc->sdata->wdev,
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
(unsigned long)roc,
|
|
|
|
roc->chan, roc->chan_type,
|
2010-12-18 09:20:48 -07:00
|
|
|
GFP_KERNEL);
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
|
|
|
|
ieee80211_roc_notify_destroy(dep);
|
|
|
|
|
|
|
|
kfree(roc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_sw_roc_work(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct ieee80211_roc_work *roc =
|
|
|
|
container_of(work, struct ieee80211_roc_work, work.work);
|
|
|
|
struct ieee80211_sub_if_data *sdata = roc->sdata;
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
2012-07-13 07:14:45 -07:00
|
|
|
bool started;
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
|
|
|
|
mutex_lock(&local->mtx);
|
|
|
|
|
|
|
|
if (roc->abort)
|
|
|
|
goto finish;
|
|
|
|
|
|
|
|
if (WARN_ON(list_empty(&local->roc_list)))
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
if (WARN_ON(roc != list_first_entry(&local->roc_list,
|
|
|
|
struct ieee80211_roc_work,
|
|
|
|
list)))
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
if (!roc->started) {
|
|
|
|
struct ieee80211_roc_work *dep;
|
|
|
|
|
|
|
|
/* start this ROC */
|
2010-12-18 09:20:47 -07:00
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
/* switch channel etc */
|
|
|
|
ieee80211_recalc_idle(local);
|
|
|
|
|
|
|
|
local->tmp_channel = roc->chan;
|
|
|
|
local->tmp_channel_type = roc->chan_type;
|
|
|
|
ieee80211_hw_config(local, 0);
|
|
|
|
|
|
|
|
/* tell userspace or send frame */
|
|
|
|
ieee80211_handle_roc_started(roc);
|
|
|
|
list_for_each_entry(dep, &roc->dependents, list)
|
|
|
|
ieee80211_handle_roc_started(dep);
|
|
|
|
|
|
|
|
/* if it was pure TX, just finish right away */
|
|
|
|
if (!roc->duration)
|
|
|
|
goto finish;
|
|
|
|
|
|
|
|
roc->started = true;
|
|
|
|
ieee80211_queue_delayed_work(&local->hw, &roc->work,
|
|
|
|
msecs_to_jiffies(roc->duration));
|
|
|
|
} else {
|
|
|
|
/* finish this ROC */
|
|
|
|
finish:
|
|
|
|
list_del(&roc->list);
|
2012-07-13 07:14:45 -07:00
|
|
|
started = roc->started;
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
ieee80211_roc_notify_destroy(roc);
|
|
|
|
|
2012-07-13 07:14:45 -07:00
|
|
|
if (started) {
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
drv_flush(local, false);
|
|
|
|
|
|
|
|
local->tmp_channel = NULL;
|
|
|
|
ieee80211_hw_config(local, 0);
|
|
|
|
|
|
|
|
ieee80211_offchannel_return(local, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
ieee80211_recalc_idle(local);
|
|
|
|
|
2012-07-13 07:14:45 -07:00
|
|
|
if (started)
|
2012-06-20 11:11:33 -07:00
|
|
|
ieee80211_start_next_roc(local);
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
out_unlock:
|
|
|
|
mutex_unlock(&local->mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ieee80211_hw_roc_done(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local =
|
|
|
|
container_of(work, struct ieee80211_local, hw_roc_done);
|
|
|
|
struct ieee80211_roc_work *roc;
|
|
|
|
|
|
|
|
mutex_lock(&local->mtx);
|
|
|
|
|
|
|
|
if (list_empty(&local->roc_list))
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
roc = list_first_entry(&local->roc_list, struct ieee80211_roc_work,
|
|
|
|
list);
|
|
|
|
|
|
|
|
if (!roc->started)
|
|
|
|
goto out_unlock;
|
|
|
|
|
|
|
|
list_del(&roc->list);
|
|
|
|
|
|
|
|
ieee80211_roc_notify_destroy(roc);
|
|
|
|
|
|
|
|
/* if there's another roc, start it now */
|
|
|
|
ieee80211_start_next_roc(local);
|
|
|
|
|
|
|
|
out_unlock:
|
2010-12-18 09:20:47 -07:00
|
|
|
mutex_unlock(&local->mtx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = hw_to_local(hw);
|
|
|
|
|
|
|
|
trace_api_remain_on_channel_expired(local);
|
|
|
|
|
|
|
|
ieee80211_queue_work(hw, &local->hw_roc_done);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(ieee80211_remain_on_channel_expired);
|
|
|
|
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
void ieee80211_roc_setup(struct ieee80211_local *local)
|
2010-12-18 09:20:47 -07:00
|
|
|
{
|
|
|
|
INIT_WORK(&local->hw_roc_start, ieee80211_hw_roc_start);
|
|
|
|
INIT_WORK(&local->hw_roc_done, ieee80211_hw_roc_done);
|
mac80211: unify SW/offload remain-on-channel
Redesign all the off-channel code, getting rid of
the generic off-channel work concept, replacing
it with a simple remain-on-channel list.
This fixes a number of small issues with the ROC
implementation:
* offloaded remain-on-channel couldn't be queued,
now we can queue it as well, if needed
* in iwlwifi (the only user) offloaded ROC is
mutually exclusive with scanning, use the new
queue to handle that case -- I expect that it
will later depend on a HW flag
The bigger issue though is that there's a bad bug
in the current implementation: if we get a mgmt
TX request while HW roc is active, and this new
request has a wait time, we actually schedule a
software ROC instead since we can't guarantee the
existing offloaded ROC will still be that long.
To fix this, the queuing mechanism was needed.
The queuing mechanism for offloaded ROC isn't yet
optimal, ideally we should add API to have the HW
extend the ROC if needed. We could add that later
but for now use a software implementation.
Overall, this unifies the behaviour between the
offloaded and software-implemented case as much
as possible.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05 05:28:42 -07:00
|
|
|
INIT_LIST_HEAD(&local->roc_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata)
|
|
|
|
{
|
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
|
struct ieee80211_roc_work *roc, *tmp;
|
|
|
|
LIST_HEAD(tmp_list);
|
|
|
|
|
|
|
|
mutex_lock(&local->mtx);
|
|
|
|
list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
|
|
|
|
if (roc->sdata != sdata)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (roc->started && local->ops->remain_on_channel) {
|
|
|
|
/* can race, so ignore return value */
|
|
|
|
drv_cancel_remain_on_channel(local);
|
|
|
|
}
|
|
|
|
|
|
|
|
list_move_tail(&roc->list, &tmp_list);
|
|
|
|
roc->abort = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ieee80211_start_next_roc(local);
|
|
|
|
mutex_unlock(&local->mtx);
|
|
|
|
|
|
|
|
list_for_each_entry_safe(roc, tmp, &tmp_list, list) {
|
|
|
|
if (local->ops->remain_on_channel) {
|
|
|
|
list_del(&roc->list);
|
|
|
|
ieee80211_roc_notify_destroy(roc);
|
|
|
|
} else {
|
|
|
|
ieee80211_queue_delayed_work(&local->hw, &roc->work, 0);
|
|
|
|
|
|
|
|
/* work will clean up etc */
|
|
|
|
flush_delayed_work(&roc->work);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN_ON_ONCE(!list_empty(&tmp_list));
|
2010-12-18 09:20:47 -07:00
|
|
|
}
|