diff mbox

[RFC,2/4] nl80211/mac80211: Extend NoAck policy command with peer MAC address

Message ID 1522140171-10926-3-git-send-email-vthiagar@codeaurora.org (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show

Commit Message

Vasanthakumar Thiagarajan March 27, 2018, 8:42 a.m. UTC
Provides peer level NoAck policy configuration by extending
NL80211_CMD_SET_NOACK_MAP command with peer MAC address.
If user space does not give any peer mac address, the driver
should retain the existing functionality of applying the NoAck
policy for all the staions connected to the netdev. Peer specific
configuration takes precedence over netdev level configuration when
both are set by the user. Drivers supporting per-sta NoAck policy
must advertise the support through the extended flag index
NL80211_EXT_FEATURE_PER_STA_NOACK_MAP.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 include/net/cfg80211.h       |  9 +++++++--
 include/uapi/linux/nl80211.h | 12 +++++++++++-
 net/mac80211/cfg.c           |  1 +
 net/wireless/nl80211.c       | 12 +++++++++++-
 net/wireless/rdev-ops.h      |  7 ++++---
 net/wireless/trace.h         | 11 +++++++----
 6 files changed, 41 insertions(+), 11 deletions(-)

Comments

Johannes Berg March 27, 2018, 12:47 p.m. UTC | #1
On Tue, 2018-03-27 at 14:12 +0530, Vasanthakumar Thiagarajan wrote:
> 
> - * @set_noack_map: Set the NoAck Map for the TIDs.
> + * @set_noack_map: Set the NoAck Map for the TIDs. When peer is not %NULL NoAck
> + *	map will be applied for that particular peer. When peer is %NULL NoAck
> + *	map will be applied for all the connected stations (except the ones
> + *	which already have per-peer TID map configured) on the netdev.
> + *	Driver should return -ENOSPC when the it does not have room for
> + *	additional entries for per-peer NoAck map.

I guess it should also set the default for new stations when the peer is
not given? At least that's how mac80211 would behave now, afaict.

The question is how that interacts with having enough space - are you
sure this is a concern?

>   * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
> - *      No Acknowledgement Policy should be applied.
> + *	No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is used
> + *	to apply No Acknowledgement policy for a particular connected station.
> + *	Station specific NoAck policy configuration is valid only for STA's
> + *	current connection, i.e. the configuration will not be used when the
> + *	station connects back after disconnection/roaming.
> + *	When user-space does not include %NL80211_ATTR_MAC, the No
> + *	Acknowledgement Policy setting should be treated as per-netdev
> + *	configuration.

Here you describe different semantics - i.e. you didn't describe the
"previous per-station settings are kept" part. I'm not sure that part
makes much sense anyhow?

johannes
Vasanthakumar Thiagarajan March 28, 2018, 4:54 a.m. UTC | #2
On 2018-03-27 18:17, Johannes Berg wrote:
> On Tue, 2018-03-27 at 14:12 +0530, Vasanthakumar Thiagarajan wrote:
>> 
>> - * @set_noack_map: Set the NoAck Map for the TIDs.
>> + * @set_noack_map: Set the NoAck Map for the TIDs. When peer is not 
>> %NULL NoAck
>> + *	map will be applied for that particular peer. When peer is %NULL 
>> NoAck
>> + *	map will be applied for all the connected stations (except the 
>> ones
>> + *	which already have per-peer TID map configured) on the netdev.
>> + *	Driver should return -ENOSPC when the it does not have room for
>> + *	additional entries for per-peer NoAck map.
> 
> I guess it should also set the default for new stations when the peer 
> is
> not given? At least that's how mac80211 would behave now, afaict.

Sure. May be setting -1 as the default value when the per-peer NoAck 
policy is not
set would work.

> 
> The question is how that interacts with having enough space - are you
> sure this is a concern?

This will not be an issue at lest for ath10k. This is mainly for a 
(new)driver
which implements the offload but has limitation in supporting more than 
certain
number of peers. Perhaps we can remove it now and add it when such 
driver is
available?

> 
>>   * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs 
>> whether
>> - *      No Acknowledgement Policy should be applied.
>> + *	No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is 
>> used
>> + *	to apply No Acknowledgement policy for a particular connected 
>> station.
>> + *	Station specific NoAck policy configuration is valid only for 
>> STA's
>> + *	current connection, i.e. the configuration will not be used when 
>> the
>> + *	station connects back after disconnection/roaming.
>> + *	When user-space does not include %NL80211_ATTR_MAC, the No
>> + *	Acknowledgement Policy setting should be treated as per-netdev
>> + *	configuration.
> 
> Here you describe different semantics - i.e. you didn't describe the
> "previous per-station settings are kept" part. I'm not sure that part
> makes much sense anyhow?

Not sure I got this comment right. As mentioned in the doc, the previous 
settings
would be reset upon reconnection of the station and any ndev wide 
configuration
will be used. As mentioned above, additionally default value will be set 
to the
station to mark no per-station configuration is given so far.

Vasanth
Johannes Berg March 28, 2018, 8:06 a.m. UTC | #3
On Wed, 2018-03-28 at 10:24 +0530, vthiagar@codeaurora.org wrote:

> > The question is how that interacts with having enough space - are you
> > sure this is a concern?
> 
> This will not be an issue at lest for ath10k. This is mainly for a 
> (new)driver
> which implements the offload but has limitation in supporting more than 
> certain
> number of peers. Perhaps we can remove it now and add it when such 
> driver is
> available?

Ok, that's good. Yes, I think that sounds better - I have a hard time
imagining a firmware/driver that has space for the station, but doesn't
automatically allocate a u16 bitmap as part of the station :-)

> > >   * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs 
> > > whether
> > > - *      No Acknowledgement Policy should be applied.
> > > + *	No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is 
> > > used
> > > + *	to apply No Acknowledgement policy for a particular connected 
> > > station.
> > > + *	Station specific NoAck policy configuration is valid only for 
> > > STA's
> > > + *	current connection, i.e. the configuration will not be used when 
> > > the
> > > + *	station connects back after disconnection/roaming.
> > > + *	When user-space does not include %NL80211_ATTR_MAC, the No
> > > + *	Acknowledgement Policy setting should be treated as per-netdev
> > > + *	configuration.
> > 
> > Here you describe different semantics - i.e. you didn't describe the
> > "previous per-station settings are kept" part. I'm not sure that part
> > makes much sense anyhow?
> 
> Not sure I got this comment right. As mentioned in the doc, the previous 
> settings
> would be reset upon reconnection of the station and any ndev wide 
> configuration
> will be used. As mentioned above, additionally default value will be set 
> to the
> station to mark no per-station configuration is given so far.

I just thought that there was a difference in how this applies to a
certain station.

Btw, we should probably also have a way to *delete* the per-station
configuration, so it uses the default again?

johannes
Vasanthakumar Thiagarajan March 28, 2018, 8:50 a.m. UTC | #4
On 2018-03-28 13:36, Johannes Berg wrote:
> On Wed, 2018-03-28 at 10:24 +0530, vthiagar@codeaurora.org wrote:
> 
>> > The question is how that interacts with having enough space - are you
>> > sure this is a concern?
>> 
>> This will not be an issue at lest for ath10k. This is mainly for a
>> (new)driver
>> which implements the offload but has limitation in supporting more 
>> than
>> certain
>> number of peers. Perhaps we can remove it now and add it when such
>> driver is
>> available?
> 
> Ok, that's good. Yes, I think that sounds better - I have a hard time
> imagining a firmware/driver that has space for the station, but doesn't
> automatically allocate a u16 bitmap as part of the station :-)
> 
>> > >   * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs
>> > > whether
>> > > - *      No Acknowledgement Policy should be applied.
>> > > + *	No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is
>> > > used
>> > > + *	to apply No Acknowledgement policy for a particular connected
>> > > station.
>> > > + *	Station specific NoAck policy configuration is valid only for
>> > > STA's
>> > > + *	current connection, i.e. the configuration will not be used when
>> > > the
>> > > + *	station connects back after disconnection/roaming.
>> > > + *	When user-space does not include %NL80211_ATTR_MAC, the No
>> > > + *	Acknowledgement Policy setting should be treated as per-netdev
>> > > + *	configuration.
>> >
>> > Here you describe different semantics - i.e. you didn't describe the
>> > "previous per-station settings are kept" part. I'm not sure that part
>> > makes much sense anyhow?
>> 
>> Not sure I got this comment right. As mentioned in the doc, the 
>> previous
>> settings
>> would be reset upon reconnection of the station and any ndev wide
>> configuration
>> will be used. As mentioned above, additionally default value will be 
>> set
>> to the
>> station to mark no per-station configuration is given so far.
> 
> I just thought that there was a difference in how this applies to a
> certain station.

May be the doc needs more update

> 
> Btw, we should probably also have a way to *delete* the per-station
> configuration, so it uses the default again?

Sure. How about setting it to default when the command is received with 
no
NL80211_ATTR_NOACK_MAP attribute for a station?

Vasanth
Johannes Berg March 28, 2018, 8:52 a.m. UTC | #5
On Wed, 2018-03-28 at 14:20 +0530, vthiagar@codeaurora.org wrote:
> 
> > Btw, we should probably also have a way to *delete* the per-station
> > configuration, so it uses the default again?
> 
> Sure. How about setting it to default when the command is received with 
> no NL80211_ATTR_NOACK_MAP attribute for a station?

Sounds good to me.

johannes
diff mbox

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index fc40843..b974d32 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2872,7 +2872,12 @@  struct cfg80211_external_auth_params {
  * @probe_client: probe an associated client, must return a cookie that it
  *	later passes to cfg80211_probe_status().
  *
- * @set_noack_map: Set the NoAck Map for the TIDs.
+ * @set_noack_map: Set the NoAck Map for the TIDs. When peer is not %NULL NoAck
+ *	map will be applied for that particular peer. When peer is %NULL NoAck
+ *	map will be applied for all the connected stations (except the ones
+ *	which already have per-peer TID map configured) on the netdev.
+ *	Driver should return -ENOSPC when the it does not have room for
+ *	additional entries for per-peer NoAck map.
  *
  * @get_channel: Get the current operating channel for the virtual interface.
  *	For monitor interfaces, it should return %NULL unless there's a single
@@ -3180,7 +3185,7 @@  struct cfg80211_ops {
 
 	int	(*set_noack_map)(struct wiphy *wiphy,
 				  struct net_device *dev,
-				  u16 noack_map);
+				  const u8 *peer, u16 noack_map);
 
 	int	(*get_channel)(struct wiphy *wiphy,
 			       struct wireless_dev *wdev,
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 60fefc5..7425ea6 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -784,7 +784,14 @@ 
  *	messages. Note that per PHY only one application may register.
  *
  * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
- *      No Acknowledgement Policy should be applied.
+ *	No Acknowledgement Policy should be applied. %NL80211_ATTR_MAC is used
+ *	to apply No Acknowledgement policy for a particular connected station.
+ *	Station specific NoAck policy configuration is valid only for STA's
+ *	current connection, i.e. the configuration will not be used when the
+ *	station connects back after disconnection/roaming.
+ *	When user-space does not include %NL80211_ATTR_MAC, the No
+ *	Acknowledgement Policy setting should be treated as per-netdev
+ *	configuration.
  *
  * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
  *	independently of the userspace SME, send this event indicating
@@ -5005,6 +5012,8 @@  enum nl80211_feature_flags {
  *	channel change triggered by radar detection event.
  *	No need to start CAC from user-space, no need to react to
  *	"radar detected" event.
+ * @NL80211_EXT_FEATURE_PER_STA_NOACK_MAP: Driver supports STA specific NoAck
+ *	policy functionality.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -5036,6 +5045,7 @@  enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_LOW_POWER_SCAN,
 	NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
 	NL80211_EXT_FEATURE_DFS_OFFLOAD,
+	NL80211_EXT_FEATURE_PER_STA_NOACK_MAP,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index a2f0eae..621ef38 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -341,6 +341,7 @@  static void ieee80211_del_nan_func(struct wiphy *wiphy,
 
 static int ieee80211_set_noack_map(struct wiphy *wiphy,
 				  struct net_device *dev,
+				  const u8 *peer,
 				  u16 noack_map)
 {
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fe27ab4..8d7f055a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3095,16 +3095,26 @@  static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info)
 	struct cfg80211_registered_device *rdev = info->user_ptr[0];
 	struct net_device *dev = info->user_ptr[1];
 	u16 noack_map;
+	const u8 *peer = NULL;
 
 	if (!info->attrs[NL80211_ATTR_NOACK_MAP])
 		return -EINVAL;
 
+	if (info->attrs[NL80211_ATTR_MAC]) {
+		if (!wiphy_ext_feature_isset(
+				&rdev->wiphy,
+				NL80211_EXT_FEATURE_PER_STA_NOACK_MAP))
+			return -EOPNOTSUPP;
+
+		peer = nla_data(info->attrs[NL80211_ATTR_MAC]);
+	}
+
 	if (!rdev->ops->set_noack_map)
 		return -EOPNOTSUPP;
 
 	noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]);
 
-	return rdev_set_noack_map(rdev, dev, noack_map);
+	return rdev_set_noack_map(rdev, dev, peer, noack_map);
 }
 
 struct get_key_cookie {
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 84f23ae..5c9089d 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -881,11 +881,12 @@  static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
 }
 
 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
-				     struct net_device *dev, u16 noack_map)
+				     struct net_device *dev, const u8 *peer,
+				     u16 noack_map)
 {
 	int ret;
-	trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
-	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
+	trace_rdev_set_noack_map(&rdev->wiphy, dev, peer, noack_map);
+	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, peer, noack_map);
 	trace_rdev_return_int(&rdev->wiphy, ret);
 	return ret;
 }
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 5152938..caecf18 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1883,21 +1883,24 @@ 
 );
 
 TRACE_EVENT(rdev_set_noack_map,
-	TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
+	TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer,
 		 u16 noack_map),
-	TP_ARGS(wiphy, netdev, noack_map),
+	TP_ARGS(wiphy, netdev, peer, noack_map),
 	TP_STRUCT__entry(
 		WIPHY_ENTRY
 		NETDEV_ENTRY
+		MAC_ENTRY(peer)
 		__field(u16, noack_map)
 	),
 	TP_fast_assign(
 		WIPHY_ASSIGN;
 		NETDEV_ASSIGN;
+		MAC_ASSIGN(peer, peer);
 		__entry->noack_map = noack_map;
 	),
-	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", noack_map: %u",
-		  WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
+	TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", " MAC_PR_FMT
+		  ", noack_map: %u", WIPHY_PR_ARG, NETDEV_PR_ARG,
+		  MAC_PR_ARG(peer), __entry->noack_map)
 );
 
 DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,