From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 12/12] cfg80211/mac80211: allow management TX to not wait for ACK
Date: Fri, 04 Nov 2011 11:18:21 +0100 [thread overview]
Message-ID: <20111104101945.803176720@sipsolutions.net> (raw)
In-Reply-To: 20111104101809.711636760@sipsolutions.net
From: Johannes Berg <johannes.berg@intel.com>
For probe responses it can be useful to not wait for ACK to
avoid retransmissions if the station that sent the probe is
already on the next channel, so allow userspace to request
not caring about the ACK with a new nl80211 flag.
Since mac80211 needs to be updated for the new function
prototype anyway implement it right away -- it's just a
few lines of code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
v2: accidentally sent as v2 instead of v1
v3: update commit log (Arend) and fix bug (Eliad)
drivers/net/wireless/ath/ath6kl/cfg80211.c | 3 +-
include/linux/nl80211.h | 7 ++++
include/net/cfg80211.h | 2 -
net/mac80211/cfg.c | 11 +++++--
net/wireless/core.h | 2 -
net/wireless/mlme.c | 5 ++-
net/wireless/nl80211.c | 43 +++++++++++++++++------------
7 files changed, 48 insertions(+), 25 deletions(-)
--- a/include/linux/nl80211.h 2011-11-03 14:02:32.000000000 +0100
+++ b/include/linux/nl80211.h 2011-11-03 14:02:44.000000000 +0100
@@ -1144,6 +1144,11 @@ enum nl80211_commands {
* with support for the features listed in this attribute, see
* &enum nl80211_ap_sme_features.
*
+ * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
+ * the driver to not wait for an acknowledgement. Note that due to this,
+ * it will also not give a status callback nor return a cookie. This is
+ * mostly useful for probe responses to save airtime.
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1374,6 +1379,8 @@ enum nl80211_attrs {
NL80211_ATTR_DEVICE_AP_SME,
+ NL80211_ATTR_DONT_WAIT_FOR_ACK,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
--- a/net/wireless/core.h 2011-11-03 14:02:32.000000000 +0100
+++ b/net/wireless/core.h 2011-11-03 14:02:44.000000000 +0100
@@ -378,7 +378,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
- u64 *cookie);
+ bool dont_wait_for_ack, u64 *cookie);
/* SME */
int __cfg80211_connect(struct cfg80211_registered_device *rdev,
--- a/net/wireless/mlme.c 2011-11-03 14:02:28.000000000 +0100
+++ b/net/wireless/mlme.c 2011-11-03 14:02:44.000000000 +0100
@@ -904,7 +904,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
- u64 *cookie)
+ bool dont_wait_for_ack, u64 *cookie)
{
struct wireless_dev *wdev = dev->ieee80211_ptr;
const struct ieee80211_mgmt *mgmt;
@@ -995,7 +995,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
/* Transmit the Action frame as requested by user space */
return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan,
channel_type, channel_type_valid,
- wait, buf, len, no_cck, cookie);
+ wait, buf, len, no_cck, dont_wait_for_ack,
+ cookie);
}
bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf,
--- a/net/wireless/nl80211.c 2011-11-03 14:02:32.000000000 +0100
+++ b/net/wireless/nl80211.c 2011-11-03 14:02:44.000000000 +0100
@@ -196,6 +196,7 @@ static const struct nla_policy nl80211_p
[NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 },
[NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG },
[NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG },
+ [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -5276,10 +5277,11 @@ static int nl80211_tx_mgmt(struct sk_buf
int err;
void *hdr;
u64 cookie;
- struct sk_buff *msg;
+ struct sk_buff *msg = NULL;
unsigned int wait = 0;
- bool offchan;
- bool no_cck;
+ bool offchan, no_cck, dont_wait_for_ack;
+
+ dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK];
if (!info->attrs[NL80211_ATTR_FRAME] ||
!info->attrs[NL80211_ATTR_WIPHY_FREQ])
@@ -5323,29 +5325,36 @@ static int nl80211_tx_mgmt(struct sk_buf
if (chan == NULL)
return -EINVAL;
- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
- if (!msg)
- return -ENOMEM;
-
- hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
- NL80211_CMD_FRAME);
-
- if (IS_ERR(hdr)) {
- err = PTR_ERR(hdr);
- goto free_msg;
+ if (!dont_wait_for_ack) {
+ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!msg)
+ return -ENOMEM;
+
+ hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+ NL80211_CMD_FRAME);
+
+ if (IS_ERR(hdr)) {
+ err = PTR_ERR(hdr);
+ goto free_msg;
+ }
}
+
err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type,
channel_type_valid, wait,
nla_data(info->attrs[NL80211_ATTR_FRAME]),
nla_len(info->attrs[NL80211_ATTR_FRAME]),
- no_cck, &cookie);
+ no_cck, dont_wait_for_ack, &cookie);
if (err)
goto free_msg;
- NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie);
+ if (msg) {
+ NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie);
- genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ genlmsg_end(msg, hdr);
+ return genlmsg_reply(msg, info);
+ }
+
+ return 0;
nla_put_failure:
err = -ENOBUFS;
--- a/include/net/cfg80211.h 2011-11-03 14:02:32.000000000 +0100
+++ b/include/net/cfg80211.h 2011-11-03 14:02:44.000000000 +0100
@@ -1584,7 +1584,7 @@ struct cfg80211_ops {
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
- u64 *cookie);
+ bool dont_wait_for_ack, u64 *cookie);
int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
struct net_device *dev,
u64 cookie);
--- a/net/mac80211/cfg.c 2011-11-03 14:02:28.000000000 +0100
+++ b/net/mac80211/cfg.c 2011-11-03 14:02:44.000000000 +0100
@@ -1936,7 +1936,7 @@ static int ieee80211_mgmt_tx(struct wiph
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
const u8 *buf, size_t len, bool no_cck,
- u64 *cookie)
+ bool dont_wait_for_ack, u64 *cookie)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
@@ -1944,10 +1944,15 @@ static int ieee80211_mgmt_tx(struct wiph
struct sta_info *sta;
struct ieee80211_work *wk;
const struct ieee80211_mgmt *mgmt = (void *)buf;
- u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |
- IEEE80211_TX_CTL_REQ_TX_STATUS;
+ u32 flags;
bool is_offchan = false;
+ if (dont_wait_for_ack)
+ flags = IEEE80211_TX_CTL_NO_ACK;
+ else
+ flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX |
+ IEEE80211_TX_CTL_REQ_TX_STATUS;
+
/* Check that we are on the requested channel for transmission */
if (chan != local->tmp_channel &&
chan != local->oper_channel)
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c 2011-11-03 13:48:08.000000000 +0100
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c 2011-11-03 14:02:44.000000000 +0100
@@ -1732,7 +1732,8 @@ static int ath6kl_mgmt_tx(struct wiphy *
struct ieee80211_channel *chan, bool offchan,
enum nl80211_channel_type channel_type,
bool channel_type_valid, unsigned int wait,
- const u8 *buf, size_t len, bool no_cck, u64 *cookie)
+ const u8 *buf, size_t len, bool no_cck,
+ bool dont_wait_for_ack, u64 *cookie)
{
struct ath6kl *ar = ath6kl_priv(dev);
u32 id;
prev parent reply other threads:[~2011-11-04 10:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-04 10:18 [PATCH 00/12] monitor-less AP mode part 1 Johannes Berg
2011-11-04 10:18 ` [PATCH 01/12] mac80211: add helper to free TX skb Johannes Berg
2011-11-04 10:18 ` [PATCH 02/12] mac80211: add support for control port protocol in AP mode Johannes Berg
2011-11-04 10:18 ` [PATCH 03/12] nl80211: allow subscribing to unexpected class3 frames Johannes Berg
2011-11-04 10:18 ` [PATCH 04/12] mac80211: support spurious class3 event Johannes Berg
2011-11-04 10:18 ` [PATCH 05/12] nl80211: advertise device AP SME Johannes Berg
2011-11-07 8:29 ` Arik Nemtsov
2011-11-07 8:49 ` Johannes Berg
2011-11-07 11:39 ` [PATCH v3 " Johannes Berg
2011-11-04 10:18 ` [PATCH 06/12] nl80211: add API to probe a client Johannes Berg
2011-11-04 10:18 ` [PATCH 07/12] mac80211: support client probe Johannes Berg
2011-11-04 10:18 ` [PATCH 08/12] cfg80211: allow registering to beacons Johannes Berg
2011-11-04 10:18 ` [PATCH 09/12] mac80211: report OBSS beacons Johannes Berg
2011-11-04 10:18 ` [PATCH 10/12] cfg80211: add event for unexpected 4addr frames Johannes Berg
2011-11-04 10:18 ` [PATCH 11/12] mac80211: send unexpected 4addr event Johannes Berg
2011-11-04 10:18 ` Johannes Berg [this message]
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=20111104101945.803176720@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/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;
as well as URLs for NNTP newsgroup(s).