Commit 1c38c7f2 authored by James Prestwood's avatar James Prestwood Committed by Johannes Berg

nl80211: send event when CMD_FRAME duration expires

cfg80211_remain_on_channel_expired is used to notify userspace when
the remain on channel duration expired by sending an event. There is
no such equivalent to CMD_FRAME, where if offchannel and a duration
is provided, the card will go offchannel for that duration. Currently
there is no way for userspace to tell when that duration expired
apart from setting an independent timeout. This timeout is quite
erroneous as the kernel may not immediately send out the frame
because of scheduling or work queue delays. In testing, it was found
this timeout had to be quite large to accomidate any potential delays.

A better solution is to have the kernel send an event when this
duration has expired. There is already NL80211_CMD_FRAME_WAIT_CANCEL
which can be used to cancel a NL80211_CMD_FRAME offchannel. Using this
command matches perfectly to how NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL
works, where its both used to cancel and notify if the duration has
expired.
Signed-off-by: default avatarJames Prestwood <james.prestwood@linux.intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5a7bb7ce
...@@ -6547,6 +6547,16 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, ...@@ -6547,6 +6547,16 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan, struct ieee80211_channel *chan,
gfp_t gfp); gfp_t gfp);
/**
* cfg80211_tx_mgmt_expired - tx_mgmt duration expired
* @wdev: wireless device
* @cookie: the requested cookie
* @chan: The current channel (from tx_mgmt request)
* @gfp: allocation flags
*/
void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan, gfp_t gfp);
/** /**
* cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics. * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
* *
......
...@@ -15417,6 +15417,19 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, ...@@ -15417,6 +15417,19 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
} }
EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); EXPORT_SYMBOL(cfg80211_remain_on_channel_expired);
void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan,
gfp_t gfp)
{
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
trace_cfg80211_tx_mgmt_expired(wdev, cookie, chan);
nl80211_send_remain_on_chan_event(NL80211_CMD_FRAME_WAIT_CANCEL,
rdev, wdev, cookie, chan, 0, gfp);
}
EXPORT_SYMBOL(cfg80211_tx_mgmt_expired);
void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
struct station_info *sinfo, gfp_t gfp) struct station_info *sinfo, gfp_t gfp)
{ {
......
...@@ -2752,6 +2752,24 @@ TRACE_EVENT(cfg80211_ready_on_channel_expired, ...@@ -2752,6 +2752,24 @@ TRACE_EVENT(cfg80211_ready_on_channel_expired,
WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG) WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG)
); );
TRACE_EVENT(cfg80211_tx_mgmt_expired,
TP_PROTO(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan),
TP_ARGS(wdev, cookie, chan),
TP_STRUCT__entry(
WDEV_ENTRY
__field(u64, cookie)
CHAN_ENTRY
),
TP_fast_assign(
WDEV_ASSIGN;
__entry->cookie = cookie;
CHAN_ASSIGN(chan);
),
TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT,
WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG)
);
TRACE_EVENT(cfg80211_new_sta, TRACE_EVENT(cfg80211_new_sta,
TP_PROTO(struct net_device *netdev, const u8 *mac_addr, TP_PROTO(struct net_device *netdev, const u8 *mac_addr,
struct station_info *sinfo), struct station_info *sinfo),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment