From: James Prestwood <james.prestwood@linux.intel.com>
To: linux-wireless@vger.kernel.org
Cc: James Prestwood <james.prestwood@linux.intel.com>
Subject: [PATCH 2/3] nl80211: send event when CMD_FRAME duration expires
Date: Wed, 12 Jun 2019 12:35:09 -0700 [thread overview]
Message-ID: <20190612193510.27680-2-james.prestwood@linux.intel.com> (raw)
In-Reply-To: <20190612193510.27680-1-james.prestwood@linux.intel.com>
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: James Prestwood <james.prestwood@linux.intel.com>
---
include/net/cfg80211.h | 11 +++++++++++
net/wireless/nl80211.c | 13 +++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 948139690a58..57f9774d8c90 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -6492,6 +6492,17 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
struct ieee80211_channel *chan,
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.
*
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e3c0805af415..74dbe6000fe3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -15375,6 +15375,19 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
}
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,
struct station_info *sinfo, gfp_t gfp)
{
--
2.17.1
next prev parent reply other threads:[~2019-06-12 19:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 19:35 [PATCH 1/3] net: wireless: trace: add trace for tx_mgmt_expired James Prestwood
2019-06-12 19:35 ` James Prestwood [this message]
2019-06-12 19:35 ` [PATCH 3/3] mac80211: notify offchannel expire on mgmt_tx James Prestwood
2019-06-14 13:42 ` [PATCH 1/3] net: wireless: trace: add trace for tx_mgmt_expired Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190612193510.27680-2-james.prestwood@linux.intel.com \
--to=james.prestwood@linux.intel.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox