2018-10-16 18:42:53

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 0/6] wireless: Per-sta NoAck and offload support

Adds infrastructure for driver to offload NoAck functionality,
driver like ath10k could make use of it. Also extends the
current ndev wide NoAck policy to per-station, with sta level
NoAck policy configuration userspace could selectively turn off/on
Noack based on various connection parameters of the station.

Tamizh chelvam (2):
ath10k: Add wmi command support for station specific TID config
ath10k: Add support for station specific noack TID policy

Vasanthakumar Thiagarajan (4):
mac80211: Add NoAck policy functionality offload infrastructure
nl80211/mac80211: Extend NoAck policy command with peer MAC address
mac80211: Apply per-peer NoAck tid bitmap configuration
mac80211: Advertise per-peer NoAck policy support

include/net/cfg80211.h | 12 +++++++++--
include/net/mac80211.h | 13 ++++++++++++
include/uapi/linux/nl80211.h | 16 +++++++++++++-
net/mac80211/cfg.c | 48 ++++++++++++++++++++++++++++++++++++++----
net/mac80211/driver-ops.h | 22 +++++++++++++++++++
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/iface.c | 4 ++++
net/mac80211/main.c | 4 ++++
net/mac80211/sta_info.c | 2 ++
net/mac80211/sta_info.h | 3 +++
net/mac80211/trace.h | 25 ++++++++++++++++++++++
net/mac80211/tx.c | 4 +++-
net/mac80211/wme.c | 35 +++++++++++++++++++++++++++++-
net/wireless/nl80211.c | 22 ++++++++++++++-----
net/wireless/rdev-ops.h | 7 +++---
net/wireless/trace.h | 15 +++++++------
16 files changed, 210 insertions(+), 24 deletions(-)

--
1.7.9.5



2018-10-16 18:42:56

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 1/6] mac80211: Add NoAck policy functionality offload infrastructure

From: Vasanthakumar Thiagarajan <[email protected]>

Add infrastructure for drivers to implement NoAck policy functionlity.
Driver like ath10k does not use the per-packet TID NoAck policy
configuration. Instead NoAck map is sent to the firmware/hardware
in control path. Firmware takes care of setting up QOS header with
NoAck policy based on the TID NoAck map.

Drivers having this support should implement callback set_noack_tid_bitmap().
Supporting drivers would receive TID NoAck map through set_noack_tid_bitmap()
instead of receiving as part of every tx skb.

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
Signed-off-by: Tamizh chelvam <[email protected]>
---
include/net/mac80211.h | 7 +++++++
net/mac80211/cfg.c | 10 ++++++++--
net/mac80211/driver-ops.h | 21 +++++++++++++++++++++
net/mac80211/iface.c | 4 ++++
net/mac80211/trace.h | 25 +++++++++++++++++++++++++
net/mac80211/tx.c | 2 +-
net/mac80211/wme.c | 3 ++-
7 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 71985e9..7da9d30 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3623,6 +3623,10 @@ enum ieee80211_reconfig_type {
* skb is always a real frame, head may or may not be an A-MSDU.
* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
* Statistics should be cumulative, currently no way to reset is provided.
+ *
+ * @set_noack_tid_bitmap: Set NoAck policy TID bitmap for a virtual interface.
+ * Drivers mplementing this callback must take care of setting NoAck policy
+ * in QOS control field based on the configured TID bitmap.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3911,6 +3915,9 @@ struct ieee80211_ops {
int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct cfg80211_ftm_responder_stats *ftm_stats);
+
+ int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif, u16 noack_map);
};

/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5162233..4d8cc8d 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -346,9 +346,15 @@ static int ieee80211_set_noack_map(struct wiphy *wiphy,

sdata->noack_map = noack_map;

- ieee80211_check_fast_xmit_iface(sdata);
+ if (!sdata->local->ops->set_noack_tid_bitmap) {
+ ieee80211_check_fast_xmit_iface(sdata);
+ return 0;
+ }

- return 0;
+ if (!ieee80211_sdata_running(sdata))
+ return 0;
+
+ return drv_set_noack_tid_bitmap(sdata->local, sdata, noack_map);
}

static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0b1747a..a6dcef5 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1278,4 +1278,25 @@ static inline void drv_del_nan_func(struct ieee80211_local *local,
trace_drv_return_void(local);
}

+static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ u16 noack_map)
+{
+ int ret;
+
+ might_sleep();
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
+ if (!local->ops->set_noack_tid_bitmap)
+ return -EOPNOTSUPP;
+
+ trace_drv_set_noack_tid_bitmap(local, sdata, noack_map);
+ ret = local->ops->set_noack_tid_bitmap(&local->hw, &sdata->vif,
+ noack_map);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 5836dde..06106f2 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -633,6 +633,10 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
ieee80211_vif_type_p2p(&sdata->vif));
if (res)
goto err_del_interface;
+
+ if (sdata->noack_map)
+ drv_set_noack_tid_bitmap(local, sdata,
+ sdata->noack_map);
}

if (sdata->vif.type == NL80211_IFTYPE_AP) {
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 588c51a..a563904 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1882,6 +1882,31 @@ struct trace_switch_entry {
)
);

+TRACE_EVENT(drv_set_noack_tid_bitmap,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ u16 noack_map),
+
+ TP_ARGS(local, sdata, noack_map),
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ VIF_ENTRY
+ __field(u16, noack_map)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ VIF_ASSIGN;
+ __entry->noack_map = noack_map;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT VIF_PR_FMT
+ ", noack_map: %u",
+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->noack_map
+ )
+);
+
/*
* Tracing for API calls that drivers call.
*/
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e0ccee2..d744c4b 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2872,7 +2872,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
goto out;

- if (sdata->noack_map)
+ if (sdata->noack_map && !local->ops->set_noack_tid_bitmap)
goto out;

/* fast-xmit doesn't handle fragmentation at all */
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 5f7c963..11c14b9 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -256,7 +256,8 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,
IEEE80211_QOS_CTL_ACK_POLICY_MASK);

if (is_multicast_ether_addr(hdr->addr1) ||
- sdata->noack_map & BIT(tid)) {
+ (!sdata->local->ops->set_noack_tid_bitmap &&
+ sdata->noack_map & BIT(tid))) {
flags |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
info->flags |= IEEE80211_TX_CTL_NO_ACK;
}
--
1.7.9.5


2018-10-16 18:42:59

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 2/6] nl80211/mac80211: Extend NoAck policy command with peer MAC address

From: Vasanthakumar Thiagarajan <[email protected]>

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. For a connected
peer, the peer specific configuration takes precedence over netdev
level configuration when both are set by the user. When the command
is given without attribute NL80211_ATTR_NOACK_MAP for a peer, the
NoAck policy for the peer will be reset to default which is peer's
netdev NoAck policy. Newly connected stations will have default
NoAck policy. Drivers supporting per-sta NoAck policy must advertise
the support through the extended flag index
NL80211_EXT_FEATURE_PER_STA_NOACK_MAP. Since a value of -1 NoAck map
is used for default configuration, redefine noack_map as int from u16.

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
Signed-off-by: Tamizh chelvam <[email protected]>
---
include/net/cfg80211.h | 12 ++++++++++--
include/net/mac80211.h | 2 +-
include/uapi/linux/nl80211.h | 16 +++++++++++++++-
net/mac80211/cfg.c | 3 ++-
net/mac80211/driver-ops.h | 2 +-
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/trace.h | 6 +++---
net/wireless/nl80211.c | 22 +++++++++++++++++-----
net/wireless/rdev-ops.h | 7 ++++---
net/wireless/trace.h | 15 +++++++++------
10 files changed, 63 insertions(+), 24 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1fa41b7..5801d76 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3086,7 +3086,15 @@ struct cfg80211_ftm_responder_stats {
* @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. A NoAck map value of -1
+ * for non-%NULL peer would indicate that the peer's current NoAck
+ * configuration should be reset to the default one. The default NoAck
+ * configuration for a peer uses the currently configured NoAck setting of
+ * netdev. When peer is %NULL NoAck map will be applied for all the
+ * connected stations on the netdev which have default NoAck policy
+ * configuration. Default NoAck configuration should be used for newly
+ * connected stations.
*
* @get_channel: Get the current operating channel for the virtual interface.
* For monitor interfaces, it should return %NULL unless there's a single
@@ -3403,7 +3411,7 @@ struct cfg80211_ops {

int (*set_noack_map)(struct wiphy *wiphy,
struct net_device *dev,
- u16 noack_map);
+ const u8 *peer, int noack_map);

int (*get_channel)(struct wiphy *wiphy,
struct wireless_dev *wdev,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7da9d30..5ce7ce7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3917,7 +3917,7 @@ struct ieee80211_ops {
struct cfg80211_ftm_responder_stats *ftm_stats);

int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif, u16 noack_map);
+ struct ieee80211_vif *vif, int noack_map);
};

/**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6d610ba..31b7a4b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -788,7 +788,18 @@
* 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.
+ * When the command is received without %NL80211_ATTR_NOACK_MAP for a
+ * connected station (%NL80211_ATTR_MAC), the station's current NoAck
+ * policy configuration should be reset to default. The default
+ * configuration for a peer should use the current ndev level NoAck
+ * policy configuration. Station specific NoAck policy configuration is
+ * valid only for STA's current connection, i.e. the configuration will
+ * be reset to default 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
@@ -5257,6 +5268,8 @@ enum nl80211_feature_flags {
* able to rekey an in-use key correctly. Userspace must not rekey PTK keys
* if this flag is not set. Ignoring this can leak clear text packets and/or
* freeze the connection.
+ * @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.
@@ -5297,6 +5310,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
+ 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 4d8cc8d..7a7e423 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -340,7 +340,8 @@ static void ieee80211_del_nan_func(struct wiphy *wiphy,

static int ieee80211_set_noack_map(struct wiphy *wiphy,
struct net_device *dev,
- u16 noack_map)
+ const u8 *peer,
+ int noack_map)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);

diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index a6dcef5..d705938 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1280,7 +1280,7 @@ static inline void drv_del_nan_func(struct ieee80211_local *local,

static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
- u16 noack_map)
+ int noack_map)
{
int ret;

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 10a0506..257dec5 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -891,7 +891,7 @@ struct ieee80211_sub_if_data {
unsigned int fragment_next;

/* TID bitmap for NoAck policy */
- u16 noack_map;
+ int noack_map;

/* bit field of ACM bits (BIT(802.1D tag)) */
u8 wmm_acm;
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index a563904..e0e6c9a 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1885,13 +1885,13 @@ struct trace_switch_entry {
TRACE_EVENT(drv_set_noack_tid_bitmap,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
- u16 noack_map),
+ int noack_map),

TP_ARGS(local, sdata, noack_map),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
- __field(u16, noack_map)
+ __field(int, noack_map)
),

TP_fast_assign(
@@ -1902,7 +1902,7 @@ struct trace_switch_entry {

TP_printk(
LOCAL_PR_FMT VIF_PR_FMT
- ", noack_map: %u",
+ ", noack_map: %d",
LOCAL_PR_ARG, VIF_PR_ARG, __entry->noack_map
)
);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 744b585..d744388 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3331,17 +3331,29 @@ 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;
+ int noack_map = -1;
+ const u8 *peer = NULL;

- if (!info->attrs[NL80211_ATTR_NOACK_MAP])
+ if (!(info->attrs[NL80211_ATTR_NOACK_MAP] ||
+ info->attrs[NL80211_ATTR_MAC]))
return -EINVAL;

+ if (info->attrs[NL80211_ATTR_NOACK_MAP])
+ noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]);
+
+ 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 51380b5..8426eb1 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -908,11 +908,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,
+ int 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 c6a9446..2ff78dd 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1909,21 +1909,24 @@
);

TRACE_EVENT(rdev_set_noack_map,
- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
- u16 noack_map),
- TP_ARGS(wiphy, netdev, noack_map),
+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *peer,
+ int noack_map),
+ TP_ARGS(wiphy, netdev, peer, noack_map),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
- __field(u16, noack_map)
+ MAC_ENTRY(peer)
+ __field(int, 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: %d", WIPHY_PR_ARG, NETDEV_PR_ARG,
+ MAC_PR_ARG(peer), __entry->noack_map)
);

DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
--
1.7.9.5


2018-10-16 18:43:01

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 3/6] mac80211: Apply per-peer NoAck tid bitmap configuration

From: Vasanthakumar Thiagarajan <[email protected]>

Use per-peer NoAck tid bitmap, if it is configured,
when setting up the qos header. If the NoAck tid bitmap is
default (-1) for a peer, use the netdev wide noack policy
configuration. The NoAck tid bitmap for newly connected stations
is set to default (-1). Also modifies callback set_noack_tid_bitmap()
with the provision to send per-peer NoAck policy configuration to the
drivers.

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
Signed-off-by: Tamizh chelvam <[email protected]>
---
include/net/mac80211.h | 14 ++++++++++----
net/mac80211/cfg.c | 43 ++++++++++++++++++++++++++++++++++++++-----
net/mac80211/driver-ops.h | 3 ++-
net/mac80211/iface.c | 2 +-
net/mac80211/sta_info.c | 2 ++
net/mac80211/sta_info.h | 3 +++
net/mac80211/tx.c | 4 +++-
net/mac80211/wme.c | 34 +++++++++++++++++++++++++++++++++-
8 files changed, 92 insertions(+), 13 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5ce7ce7..b6cc3e33 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3624,9 +3624,14 @@ enum ieee80211_reconfig_type {
* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
* Statistics should be cumulative, currently no way to reset is provided.
*
- * @set_noack_tid_bitmap: Set NoAck policy TID bitmap for a virtual interface.
- * Drivers mplementing this callback must take care of setting NoAck policy
- * in QOS control field based on the configured TID bitmap.
+ * @set_noack_tid_bitmap: Set NoAck policy TID bitmap. Apply the TID NoAck
+ * configuration for a particular station when @sta is non-NULL. NoAck
+ * policy is set to default for a peer when noack_map is -1 for the peer.
+ * The default NoAck policy for a peer is using netdev NoAck policy.
+ * When @sta is NULL, apply TID NoAck configuration at virtual interface
+ * level. Drivers mplementing this callback must take care of setting NoAck
+ * policy in QOS control field based on the configured TID bitmap.
+ * This callback may sleep.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3917,7 +3922,8 @@ struct ieee80211_ops {
struct cfg80211_ftm_responder_stats *ftm_stats);

int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif, int noack_map);
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, int noack_map);
};

/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7a7e423..02e6d49 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -344,18 +344,51 @@ static int ieee80211_set_noack_map(struct wiphy *wiphy,
int noack_map)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+ struct sta_info *sta;
+ int ret;

- sdata->noack_map = noack_map;
+ if (!peer) {
+ sdata->noack_map = noack_map;

- if (!sdata->local->ops->set_noack_tid_bitmap) {
- ieee80211_check_fast_xmit_iface(sdata);
- return 0;
+ if (!sdata->local->ops->set_noack_tid_bitmap) {
+ ieee80211_check_fast_xmit_iface(sdata);
+ return 0;
+ }
+
+ if (!ieee80211_sdata_running(sdata))
+ return 0;
+
+ return drv_set_noack_tid_bitmap(sdata->local, sdata, NULL,
+ noack_map);
}

+ /* NoAck policy is for a connected client on the dev */
+
if (!ieee80211_sdata_running(sdata))
+ return -ENETDOWN;
+
+ mutex_lock(&sdata->local->sta_mtx);
+
+ sta = sta_info_get_bss(sdata, peer);
+ if (!sta) {
+ mutex_unlock(&sdata->local->sta_mtx);
+ return -ENOENT;
+ }
+
+ sta->noack_map = noack_map;
+
+ if (!sdata->local->ops->set_noack_tid_bitmap) {
+ ieee80211_check_fast_xmit(sta);
+ mutex_unlock(&sdata->local->sta_mtx);
return 0;
+ }
+
+ ret = drv_set_noack_tid_bitmap(sdata->local, sdata,
+ &sta->sta, noack_map);

- return drv_set_noack_tid_bitmap(sdata->local, sdata, noack_map);
+ mutex_unlock(&sdata->local->sta_mtx);
+
+ return ret;
}

static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index d705938..ed9bd59 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1280,6 +1280,7 @@ static inline void drv_del_nan_func(struct ieee80211_local *local,

static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
+ struct ieee80211_sta *sta,
int noack_map)
{
int ret;
@@ -1293,7 +1294,7 @@ static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local,

trace_drv_set_noack_tid_bitmap(local, sdata, noack_map);
ret = local->ops->set_noack_tid_bitmap(&local->hw, &sdata->vif,
- noack_map);
+ sta, noack_map);
trace_drv_return_int(local, ret);

return ret;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 06106f2..4999977 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -635,7 +635,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
goto err_del_interface;

if (sdata->noack_map)
- drv_set_noack_tid_bitmap(local, sdata,
+ drv_set_noack_tid_bitmap(local, sdata, NULL,
sdata->noack_map);
}

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index fb8c225..d2ea8ee 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -606,6 +606,8 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);
kfree(sinfo);

+ sta->noack_map = -1;
+
sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr);

/* move reference to rcu-protected */
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 9a04327..863601a 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -583,6 +583,9 @@ struct sta_info {

struct cfg80211_chan_def tdls_chandef;

+ /* TID bitmap for station's NoAck policy */
+ int noack_map;
+
/* keep last! */
struct ieee80211_sta sta;
};
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d744c4b..b57cd1f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2872,7 +2872,9 @@ void ieee80211_check_fast_xmit(struct sta_info *sta)
test_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT))
goto out;

- if (sdata->noack_map && !local->ops->set_noack_tid_bitmap)
+ if (((sta->noack_map == -1 && sdata->noack_map) ||
+ (sta->noack_map != -1 && sta->noack_map)) &&
+ !local->ops->set_noack_tid_bitmap)
goto out;

/* fast-xmit doesn't handle fragmentation at all */
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 11c14b9..b1722b8 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -227,6 +227,38 @@ u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
}

/**
+ * ieee80211_get_noack_map - Get TID bitmap of NoAck policy. NoAck policy
+ * could be device wide or per-station.
+ *
+ * @sdata: local subif
+ * @mac: MAC address of the receiver
+ */
+int ieee80211_get_noack_map(struct ieee80211_sub_if_data *sdata, const u8 *mac)
+{
+ struct sta_info *sta;
+ int noack_map = 0;
+
+ /* Retrieve per-station noack_map config for the receiver, if any */
+
+ rcu_read_lock();
+
+ sta = sta_info_get(sdata, mac);
+ if (!sta) {
+ rcu_read_unlock();
+ return noack_map;
+ }
+
+ noack_map = sta->noack_map;
+
+ rcu_read_unlock();
+
+ if (noack_map == -1)
+ noack_map = sdata->noack_map;
+
+ return noack_map;
+}
+
+/**
* ieee80211_set_qos_hdr - Fill in the QoS header if there is one.
*
* @sdata: local subif
@@ -257,7 +289,7 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata,

if (is_multicast_ether_addr(hdr->addr1) ||
(!sdata->local->ops->set_noack_tid_bitmap &&
- sdata->noack_map & BIT(tid))) {
+ ieee80211_get_noack_map(sdata, hdr->addr1) & BIT(tid))) {
flags |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;
info->flags |= IEEE80211_TX_CTL_NO_ACK;
}
--
1.7.9.5


2018-10-16 18:43:02

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 4/6] mac80211: Advertise per-peer NoAck policy support

From: Vasanthakumar Thiagarajan <[email protected]>

This enables per-peer NoAck handling in mac80211 when
the functionality is not offloaded to the drivers.

Signed-off-by: Vasanthakumar Thiagarajan <[email protected]>
Signed-off-by: Tamizh chelvam <[email protected]>
---
net/mac80211/main.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 83e71e6..698cf56 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -597,6 +597,10 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,

wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_RRM);

+ if (!ops->set_noack_tid_bitmap)
+ wiphy_ext_feature_set(wiphy,
+ NL80211_EXT_FEATURE_PER_STA_NOACK_MAP);
+
wiphy->bss_priv_size = sizeof(struct ieee80211_bss);

local = wiphy_priv(wiphy);
--
1.7.9.5


2018-10-16 18:43:06

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 5/6] ath10k: Add wmi command support for station specific TID config

This patch adds WMI interface to support station specific
TID configuration like setting noack policy. Host needs to send
station's MAC address, ack policy and TID info to target through
WMI_10_4_PER_PEER_PER_TID_CONFIG_CMDID.

WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT flag is added to advertise
this support.

Testing:
* Tested HW: QCA9888
* Tested FW: 10.4-3.5.1-00052

Signed-off-by: Tamizh chelvam <[email protected]>
---
drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 ++++++++++++
drivers/net/wireless/ath/ath10k/wmi.c | 29 ++++++++++++++++++
drivers/net/wireless/ath/ath10k/wmi.h | 50 +++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 7978a77..65be00e 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -219,6 +219,8 @@ struct wmi_ops {
struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar,
u32 param);
+ struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar,
+ const struct wmi_per_peer_per_tid_cfg_arg *arg);

};

@@ -1576,4 +1578,21 @@ struct wmi_ops {
ar->wmi.cmd->radar_found_cmdid);
}

+static inline int
+ath10k_wmi_set_per_peer_per_tid_cfg(struct ath10k *ar,
+ const struct wmi_per_peer_per_tid_cfg_arg *arg)
+{
+ struct sk_buff *skb;
+
+ if (!ar->wmi.ops->gen_per_peer_per_tid_cfg)
+ return -EOPNOTSUPP;
+
+ skb = ar->wmi.ops->gen_per_peer_per_tid_cfg(ar, arg);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ return ath10k_wmi_cmd_send(ar, skb,
+ ar->wmi.cmd->per_peer_per_tid_config_cmdid);
+}
+
#endif
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 25e8fa7..14fdc94 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -750,6 +750,7 @@
.tdls_peer_update_cmdid = WMI_10_4_TDLS_PEER_UPDATE_CMDID,
.tdls_set_offchan_mode_cmdid = WMI_10_4_TDLS_SET_OFFCHAN_MODE_CMDID,
.radar_found_cmdid = WMI_10_4_RADAR_FOUND_CMDID,
+ .per_peer_per_tid_config_cmdid = WMI_10_4_PER_PEER_PER_TID_CONFIG_CMDID,
};

/* MAIN WMI VDEV param map */
@@ -8744,6 +8745,33 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
}

static struct sk_buff *
+ath10k_wmi_10_4_gen_per_peer_per_tid_cfg(struct ath10k *ar,
+ const struct wmi_per_peer_per_tid_cfg_arg *arg)
+{
+ struct wmi_peer_per_tid_cfg_cmd *cmd;
+ struct sk_buff *skb;
+
+ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+ if (!skb)
+ return ERR_PTR(-ENOMEM);
+
+ memset(skb->data, 0, sizeof(*cmd));
+
+ cmd = (struct wmi_peer_per_tid_cfg_cmd *)skb->data;
+ cmd->vdev_id = cpu_to_le32(arg->vdev_id);
+ ether_addr_copy(cmd->peer_macaddr.addr, arg->peer_macaddr.addr);
+ cmd->tid = cpu_to_le32(arg->tid);
+ cmd->ack_policy = cpu_to_le32(arg->ack_policy);
+ cmd->aggr_control = cpu_to_le32(arg->aggr_control);
+ cmd->rate_control = cpu_to_le32(arg->rate_ctrl);
+
+ ath10k_dbg(ar, ATH10K_DBG_WMI,
+ "wmi noack tid %d vdev id %d ack_policy %d aggr %u rate %u mac_addr %pM\n",
+ arg->tid, arg->vdev_id, arg->ack_policy, arg->aggr_control, arg->rate_ctrl, arg->peer_macaddr.addr);
+ return skb;
+}
+
+static struct sk_buff *
ath10k_wmi_op_gen_echo(struct ath10k *ar, u32 value)
{
struct wmi_echo_cmd *cmd;
@@ -9128,6 +9156,7 @@ static u32 ath10k_wmi_prepare_peer_qos(u8 uapsd_queues, u8 sp)
.gen_pdev_get_tpc_table_cmdid =
ath10k_wmi_10_4_op_gen_pdev_get_tpc_table_cmdid,
.gen_radar_found = ath10k_wmi_10_4_gen_radar_found,
+ .gen_per_peer_per_tid_cfg = ath10k_wmi_10_4_gen_per_peer_per_tid_cfg,

/* shared with 10.2 */
.pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index f7badd0..d3571b6 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -205,6 +205,7 @@ enum wmi_service {
WMI_SERVICE_SPOOF_MAC_SUPPORT,
WMI_SERVICE_TX_DATA_ACK_RSSI,
WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
+ WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT,

/* keep last */
WMI_SERVICE_MAX,
@@ -474,6 +475,7 @@ static inline char *wmi_service_name(int service_id)
SVCSTR(WMI_SERVICE_RESET_CHIP);
SVCSTR(WMI_SERVICE_TX_DATA_ACK_RSSI);
SVCSTR(WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT);
+ SVCSTR(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT);
default:
return NULL;
}
@@ -786,6 +788,8 @@ static inline void wmi_10_4_svc_map(const __le32 *in, unsigned long *out,
WMI_SERVICE_TX_DATA_ACK_RSSI, len);
SVCMAP(WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT,
WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len);
+ SVCMAP(WMI_10_4_SERVICE_PEER_TID_CONFIGS_SUPPORT,
+ WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, len);
}

#undef SVCMAP
@@ -986,6 +990,7 @@ struct wmi_cmd_map {
u32 pdev_wds_entry_list_cmdid;
u32 tdls_set_offchan_mode_cmdid;
u32 radar_found_cmdid;
+ u32 per_peer_per_tid_config_cmdid;
};

/*
@@ -1825,6 +1830,8 @@ enum wmi_10_4_cmd_id {
WMI_10_4_PDEV_SET_BRIDGE_MACADDR_CMDID,
WMI_10_4_ATF_GROUP_WMM_AC_CONFIG_REQUEST_CMDID,
WMI_10_4_RADAR_FOUND_CMDID,
+ WMI_10_4_PEER_CFR_CAPTURE_CMDID,
+ WMI_10_4_PER_PEER_PER_TID_CONFIG_CMDID,
WMI_10_4_PDEV_UTF_CMDID = WMI_10_4_END_CMDID - 1,
};

@@ -7053,6 +7060,49 @@ struct wmi_tdls_peer_event {
__le32 vdev_id;
} __packed;

+enum wmi_tid_aggr_control_conf {
+ WMI_TID_CONFIG_AGGR_CONTROL_IGNORE,
+ WMI_TID_CONFIG_AGGR_CONTROL_ENABLE,
+ WMI_TID_CONFIG_AGGR_CONTROL_DISABLE,
+};
+
+enum wmi_noack_tid_conf {
+ WMI_NOACK_TID_CONFIG_IGNORE_ACK_POLICY,
+ WMI_PEER_TID_CONFIG_ACK,
+ WMI_PEER_TID_CONFIG_NOACK,
+};
+
+enum wmi_tid_rate_ctrl_conf {
+ WMI_TID_CONFIG_RATE_CONTROL_IGNORE,
+ WMI_TID_CONFIG_RATE_CONTROL_AUTO,
+ WMI_TID_CONFIG_RATE_CONTROL_FIXED_RATE,
+ WMI_TID_CONFIG_RATE_CONTROL_DEFAULT_LOWEST_RATE,
+};
+
+struct wmi_per_peer_per_tid_cfg_arg {
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 tid;
+ enum wmi_noack_tid_conf ack_policy;
+ enum wmi_tid_aggr_control_conf aggr_control;
+ enum wmi_tid_rate_ctrl_conf rate_ctrl;
+};
+
+struct wmi_peer_per_tid_cfg_cmd {
+ __le32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ __le32 tid;
+
+ /* see enum wmi_noack_tid_conf */
+ __le32 ack_policy;
+ /* see enum wmi_tid_aggr_control_conf */
+ __le32 aggr_control;
+ /* see enum wmi_tid_rate_ctrl_conf */
+ __le32 rate_control;
+ __le32 rcode_rcflags;
+ __le32 sw_retry_threshold;
+} __packed;
+
enum wmi_txbf_conf {
WMI_TXBF_CONF_UNSUPPORTED,
WMI_TXBF_CONF_BEFORE_ASSOC,
--
1.9.1


2018-10-16 18:43:10

by Tamizh chelvam

[permalink] [raw]
Subject: [PATCH 6/6] ath10k: Add support for station specific noack TID policy

This patch add ops for set_noack_tid_bitmap to support
station specific noack policy functionality for a TID.
TID will be parsed from noack_map parameter and pass to target
with station's mac address and the ack policy, and the value
is stored in arsta.

Suppose if the station entry is not mentioned in the command, the configuration
will be applied for all the connected stations in the vif which have default
value(-1) in the arsta structure. And this will be applied for newly connecting
station as well.

ATH10K_SKB_F_NOACK_TID skb cb flag introduced to avoid
setting IEEE80211_TX_STAT_ACK flag in the tx completion.

WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT flag is added to
advertise this command support

Testing:
* Tested HW: QCA9888
* Tested FW: 10.4-3.5.1-00052

Signed-off-by: Tamizh chelvam <[email protected]>
---
drivers/net/wireless/ath/ath10k/core.h | 11 +++
drivers/net/wireless/ath/ath10k/mac.c | 172 ++++++++++++++++++++++++++++++++-
drivers/net/wireless/ath/ath10k/txrx.c | 12 ++-
3 files changed, 188 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 0424180..418eb19 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -90,6 +90,9 @@
/* The magic used by QCA spec */
#define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_"

+/* Number of TID target accepts from host */
+#define ATH10K_MAX_TIDS 0x8
+
struct ath10k;

static inline const char *ath10k_bus_str(enum ath10k_bus bus)
@@ -116,6 +119,7 @@ enum ath10k_skb_flags {
ATH10K_SKB_F_DELIVER_CAB = BIT(2),
ATH10K_SKB_F_MGMT = BIT(3),
ATH10K_SKB_F_QOS = BIT(4),
+ ATH10K_SKB_F_NOACK_TID = BIT(5),
};

struct ath10k_skb_cb {
@@ -498,6 +502,10 @@ struct ath10k_sta {
u64 rx_duration;
struct ath10k_htt_tx_stats *tx_stats;

+ /* TID bitmap for station's NoAck policy, protected by conf_mutex */
+ int noack_map;
+ struct work_struct noack_map_wk;
+
#ifdef CONFIG_MAC80211_DEBUGFS
/* protected by conf_mutex */
bool aggr_mode;
@@ -573,6 +581,9 @@ struct ath10k_vif {
struct work_struct ap_csa_work;
struct delayed_work connection_loss_work;
struct cfg80211_bitrate_mask bitrate_mask;
+
+ /* TID bitmap for station's NoAck policy, protected by conf_mutex */
+ int noack_map;
};

struct ath10k_vif_iter {
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index a1c2801..54ec919 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2940,6 +2940,39 @@ static void ath10k_bss_disassoc(struct ieee80211_hw *hw,
cancel_delayed_work_sync(&arvif->connection_loss_work);
}

+static int
+ath10k_mac_set_noack_tid_bitmap(struct ath10k *ar,
+ struct wmi_per_peer_per_tid_cfg_arg *arg,
+ int noack_map)
+{
+ int tid, ret;
+
+ for (tid = 0; tid < ATH10K_MAX_TIDS; tid++) {
+ if (noack_map & BIT(tid)) {
+ arg->ack_policy = WMI_PEER_TID_CONFIG_NOACK;
+ /* It is preferred to transmit the noack policy frames
+ * in basic rate. for 5G -> 6Mbps 2G -> 1Mbps
+ */
+ arg->rate_ctrl =
+ WMI_TID_CONFIG_RATE_CONTROL_DEFAULT_LOWEST_RATE;
+ arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_DISABLE;
+ } else {
+ arg->ack_policy = WMI_PEER_TID_CONFIG_ACK;
+ arg->rate_ctrl = WMI_TID_CONFIG_RATE_CONTROL_AUTO;
+ arg->aggr_control = WMI_TID_CONFIG_AGGR_CONTROL_ENABLE;
+ }
+
+ arg->tid = tid;
+ ret = ath10k_wmi_set_per_peer_per_tid_cfg(ar, arg);
+ if (ret) {
+ ath10k_warn(ar, "failed to set noack map for STA %pM for vdev %i: %d\n",
+ arg->peer_macaddr.addr, arg->vdev_id, ret);
+ break;
+ }
+ }
+ return ret;
+}
+
static int ath10k_station_assoc(struct ath10k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -2947,6 +2980,7 @@ static int ath10k_station_assoc(struct ath10k *ar,
{
struct ath10k_vif *arvif = (void *)vif->drv_priv;
struct wmi_peer_assoc_complete_arg peer_arg;
+ struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
int ret = 0;

lockdep_assert_held(&ar->conf_mutex);
@@ -3005,6 +3039,23 @@ static int ath10k_station_assoc(struct ath10k *ar,
}
}

+ if (arvif->noack_map) {
+ struct wmi_per_peer_per_tid_cfg_arg arg = {};
+
+ arg.vdev_id = arvif->vdev_id;
+ ether_addr_copy(arg.peer_macaddr.addr, sta->addr);
+
+ ret = ath10k_mac_set_noack_tid_bitmap(ar, &arg,
+ arvif->noack_map);
+ if (ret)
+ return ret;
+ }
+
+ /* Assign default noack_map value (-1) to newly connecting station.
+ * This default value used to identify the station configured with
+ * vif specific noack configuration rather than station specific.
+ */
+ arsta->noack_map = -1;
return ret;
}

@@ -3543,10 +3594,15 @@ static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar,
static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
struct ieee80211_vif *vif,
struct ieee80211_txq *txq,
+ struct ieee80211_sta *sta,
struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (void *)skb->data;
struct ath10k_skb_cb *cb = ATH10K_SKB_CB(skb);
+ struct ath10k_vif *arvif = (void *)vif->drv_priv;
+ int noack_map = arvif->noack_map;
+ struct ath10k_sta *arsta;
+ u8 tid, *p;

cb->flags = 0;
if (!ath10k_tx_h_use_hwcrypto(vif, skb))
@@ -3555,8 +3611,20 @@ static void ath10k_mac_tx_h_fill_cb(struct ath10k *ar,
if (ieee80211_is_mgmt(hdr->frame_control))
cb->flags |= ATH10K_SKB_F_MGMT;

- if (ieee80211_is_data_qos(hdr->frame_control))
+ if (ieee80211_is_data_qos(hdr->frame_control)) {
cb->flags |= ATH10K_SKB_F_QOS;
+ p = ieee80211_get_qos_ctl(hdr);
+ tid = (*p) & IEEE80211_QOS_CTL_TID_MASK;
+
+ if (sta) {
+ arsta = (struct ath10k_sta *)sta->drv_priv;
+ if (arsta->noack_map != -1)
+ noack_map = arsta->noack_map;
+ }
+
+ if (noack_map & BIT(tid))
+ cb->flags |= ATH10K_SKB_F_NOACK_TID;
+ }

cb->vif = vif;
cb->txq = txq;
@@ -3987,7 +4055,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,
return -ENOENT;
}

- ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb);
+ ath10k_mac_tx_h_fill_cb(ar, vif, txq, sta, skb);

skb_len = skb->len;
txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
@@ -4258,7 +4326,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,
bool is_presp;
int ret;

- ath10k_mac_tx_h_fill_cb(ar, vif, txq, skb);
+ ath10k_mac_tx_h_fill_cb(ar, vif, txq, sta, skb);

txmode = ath10k_mac_tx_h_get_txmode(ar, vif, sta, skb);
txpath = ath10k_mac_tx_h_get_txpath(ar, skb, txmode);
@@ -6247,6 +6315,42 @@ static void ath10k_mac_dec_num_stations(struct ath10k_vif *arvif,
ar->num_stations--;
}

+struct ath10k_mac_iter_noack_map_data {
+ struct ieee80211_vif *curr_vif;
+ struct ath10k *ar;
+};
+
+static void ath10k_sta_set_noack_tid_bitmap(struct work_struct *wk)
+{
+ struct wmi_per_peer_per_tid_cfg_arg arg = {};
+ struct ieee80211_sta *sta;
+ struct ath10k_sta *arsta;
+ struct ath10k_vif *arvif;
+ struct ath10k *ar;
+
+ arsta = container_of(wk, struct ath10k_sta, noack_map_wk);
+ sta = container_of((void *)arsta, struct ieee80211_sta, drv_priv);
+ arvif = arsta->arvif;
+ ar = arvif->ar;
+
+ arg.vdev_id = arvif->vdev_id;
+ ether_addr_copy(arg.peer_macaddr.addr, sta->addr);
+ ath10k_mac_set_noack_tid_bitmap(ar, &arg, arvif->noack_map);
+}
+
+static void ath10k_mac_vif_stations_noack_map(void *data,
+ struct ieee80211_sta *sta)
+{
+ struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
+ struct ath10k_mac_iter_noack_map_data *iter_data = data;
+ struct ieee80211_vif *sta_vif = arsta->arvif->vif;
+
+ if (sta_vif != iter_data->curr_vif || arsta->noack_map != -1)
+ return;
+
+ ieee80211_queue_work(iter_data->ar->hw, &arsta->noack_map_wk);
+}
+
static int ath10k_sta_state(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -6266,6 +6370,8 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
arsta->arvif = arvif;
arsta->peer_ps_state = WMI_PEER_PS_STATE_DISABLED;
INIT_WORK(&arsta->update_wk, ath10k_sta_rc_update_wk);
+ INIT_WORK(&arsta->noack_map_wk,
+ ath10k_sta_set_noack_tid_bitmap);

for (i = 0; i < ARRAY_SIZE(sta->txq); i++)
ath10k_mac_txq_init(sta->txq[i]);
@@ -6273,8 +6379,10 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,

/* cancel must be done outside the mutex to avoid deadlock */
if ((old_state == IEEE80211_STA_NONE &&
- new_state == IEEE80211_STA_NOTEXIST))
+ new_state == IEEE80211_STA_NOTEXIST)) {
cancel_work_sync(&arsta->update_wk);
+ cancel_work_sync(&arsta->noack_map_wk);
+ }

mutex_lock(&ar->conf_mutex);

@@ -7882,6 +7990,55 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
}

+static int ath10k_mac_op_set_noack_tid_bitmap(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta,
+ int noack_map)
+{
+ struct ath10k_vif *arvif = (void *)vif->drv_priv;
+ struct ath10k_mac_iter_noack_map_data data = {};
+ struct wmi_per_peer_per_tid_cfg_arg arg = {};
+ struct ath10k *ar = hw->priv;
+ struct ath10k_sta *arsta;
+ int ret;
+
+ mutex_lock(&ar->conf_mutex);
+
+ arg.vdev_id = arvif->vdev_id;
+ if (sta) {
+ arsta = (struct ath10k_sta *)sta->drv_priv;
+ ether_addr_copy(arg.peer_macaddr.addr, sta->addr);
+ if (arsta->noack_map == noack_map)
+ goto exit;
+
+ if (noack_map == -1)
+ ret = ath10k_mac_set_noack_tid_bitmap(ar, &arg,
+ arvif->noack_map);
+ else
+ ret = ath10k_mac_set_noack_tid_bitmap(ar, &arg,
+ noack_map);
+ if (!ret)
+ arsta->noack_map = noack_map;
+
+ goto exit;
+ }
+
+ if (arvif->noack_map == noack_map)
+ goto exit;
+
+ data.curr_vif = vif;
+ data.ar = ar;
+ arvif->noack_map = noack_map;
+ ieee80211_iterate_stations_atomic(hw,
+ ath10k_mac_vif_stations_noack_map,
+ &data);
+ arvif->noack_map = noack_map;
+
+exit:
+ mutex_unlock(&ar->conf_mutex);
+ return ret;
+}
+
static const struct ieee80211_ops ath10k_ops = {
.tx = ath10k_mac_op_tx,
.wake_tx_queue = ath10k_mac_op_wake_tx_queue,
@@ -7924,6 +8081,7 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
.switch_vif_chanctx = ath10k_mac_op_switch_vif_chanctx,
.sta_pre_rcu_remove = ath10k_mac_op_sta_pre_rcu_remove,
.sta_statistics = ath10k_sta_statistics,
+ .set_noack_tid_bitmap = ath10k_mac_op_set_noack_tid_bitmap,

CFG80211_TESTMODE_CMD(ath10k_tm_cmd)

@@ -8578,6 +8736,12 @@ int ath10k_mac_register(struct ath10k *ar)
wiphy_ext_feature_set(ar->hw->wiphy,
NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);

+ if (test_bit(WMI_SERVICE_PEER_TID_CONFIGS_SUPPORT, ar->wmi.svc_map))
+ wiphy_ext_feature_set(ar->hw->wiphy,
+ NL80211_EXT_FEATURE_PER_STA_NOACK_MAP);
+ else
+ ar->ops->set_noack_tid_bitmap = NULL;
+
/*
* on LL hardware queues are managed entirely by the FW
* so we only advertise to mac we can do the queues thing
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 23606b6..3b385d4 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -61,6 +61,7 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
struct ath10k_skb_cb *skb_cb;
struct ath10k_txq *artxq;
struct sk_buff *msdu;
+ u8 flags;

ath10k_dbg(ar, ATH10K_DBG_HTT,
"htt tx completion msdu_id %u status %d\n",
@@ -89,6 +90,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
artxq->num_fw_queued--;
}

+ flags = skb_cb->flags;
+
ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id);
ath10k_htt_tx_dec_pending(htt);
if (htt->num_pending_tx == 0)
@@ -104,18 +107,21 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
memset(&info->status, 0, sizeof(info->status));
trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id);

- if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
+ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+ !(flags & ATH10K_SKB_F_NOACK_TID))
info->flags |= IEEE80211_TX_STAT_ACK;

if (tx_done->status == HTT_TX_COMPL_STATE_NOACK)
info->flags &= ~IEEE80211_TX_STAT_ACK;

if ((tx_done->status == HTT_TX_COMPL_STATE_ACK) &&
- (info->flags & IEEE80211_TX_CTL_NO_ACK))
+ ((info->flags & IEEE80211_TX_CTL_NO_ACK) ||
+ (flags & ATH10K_SKB_F_NOACK_TID)))
info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;

if (tx_done->status == HTT_TX_COMPL_STATE_DISCARD) {
- if (info->flags & IEEE80211_TX_CTL_NO_ACK)
+ if ((info->flags & IEEE80211_TX_CTL_NO_ACK) ||
+ (flags & ATH10K_SKB_F_NOACK_TID))
info->flags &= ~IEEE80211_TX_STAT_NOACK_TRANSMITTED;
else
info->flags &= ~IEEE80211_TX_STAT_ACK;
--
1.9.1


2018-11-09 11:28:08

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 0/6] wireless: Per-sta NoAck and offload support

Hi,

> Adds infrastructure for driver to offload NoAck functionality,
> driver like ath10k could make use of it. Also extends the
> current ndev wide NoAck policy to per-station, with sta level
> NoAck policy configuration userspace could selectively turn off/on
> Noack based on various connection parameters of the station.

So ... we have this, but we also have

[PATCH 0/4] cfg80211/mac80211: Add support for TID specific configuration

which you were involved in.

Unless you can cite a good reason not to, I think it would make sense to
combine the two and make "noack" just another attribute in the TID
configuration.

johannes