summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2020-02-24 11:34:25 +0100
committerJohannes Berg <johannes.berg@intel.com>2020-02-24 12:01:10 +0100
commit3710a8a6284f58a78ba4fe9c4b6672207636a223 (patch)
tree23aad86b1eae74040558aeb3d9022f699aafa90d /net/wireless
parent77f576deaa393b54a0f2ca8ab1ab5b2d3c6b971b (diff)
nl80211: modify TID-config API
Make some changes to the TID-config API: * use u16 in nl80211 (only, and restrict to using 8 bits for now), to avoid issues in the future if we ever want to use higher TIDs. * reject empty TIDs mask (via netlink policy) * change feature advertising to not use extended feature flags but have own mechanism for this, which simplifies the code * fix all variable names from 'tid' to 'tids' since it's a mask * change to cfg80211_ name prefixes, not ieee80211_ * fix some minor docs/spelling things. Change-Id: Ia234d464b3f914cdeab82f540e018855be580dce Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c99
-rw-r--r--net/wireless/rdev-ops.h8
-rw-r--r--net/wireless/trace.h14
3 files changed, 67 insertions, 54 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a0839fae6555..56ac851ccee1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -330,8 +330,10 @@ he_bss_color_policy[NL80211_HE_BSS_COLOR_ATTR_MAX + 1] = {
static const struct nla_policy
nl80211_tid_config_attr_policy[NL80211_TID_CONFIG_ATTR_MAX + 1] = {
+ [NL80211_TID_CONFIG_ATTR_VIF_SUPP] = { .type = NLA_U64 },
+ [NL80211_TID_CONFIG_ATTR_PEER_SUPP] = { .type = NLA_U64 },
[NL80211_TID_CONFIG_ATTR_OVERRIDE] = { .type = NLA_FLAG },
- [NL80211_TID_CONFIG_ATTR_TIDS] = { .type = NLA_U8 },
+ [NL80211_TID_CONFIG_ATTR_TIDS] = NLA_POLICY_RANGE(NLA_U16, 1, 0xff),
[NL80211_TID_CONFIG_ATTR_NOACK] =
NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
};
@@ -1957,6 +1959,40 @@ nl80211_put_iftype_akm_suites(struct cfg80211_registered_device *rdev,
return 0;
}
+static int
+nl80211_put_tid_config_support(struct cfg80211_registered_device *rdev,
+ struct sk_buff *msg)
+{
+ struct nlattr *supp;
+
+ if (!rdev->wiphy.tid_config_support.vif &&
+ !rdev->wiphy.tid_config_support.peer)
+ return 0;
+
+ supp = nla_nest_start(msg, NL80211_ATTR_TID_CONFIG);
+ if (!supp)
+ return -ENOSPC;
+
+ if (rdev->wiphy.tid_config_support.vif &&
+ nla_put_u64_64bit(msg, NL80211_TID_CONFIG_ATTR_VIF_SUPP,
+ rdev->wiphy.tid_config_support.vif,
+ NL80211_TID_CONFIG_ATTR_PAD))
+ goto fail;
+
+ if (rdev->wiphy.tid_config_support.peer &&
+ nla_put_u64_64bit(msg, NL80211_TID_CONFIG_ATTR_PEER_SUPP,
+ rdev->wiphy.tid_config_support.peer,
+ NL80211_TID_CONFIG_ATTR_PAD))
+ goto fail;
+
+ nla_nest_end(msg, supp);
+
+ return 0;
+fail:
+ nla_nest_cancel(msg, supp);
+ return -ENOBUFS;
+}
+
struct nl80211_dump_wiphy_state {
s64 filter_wiphy;
long start;
@@ -2518,6 +2554,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
if (nl80211_put_iftype_akm_suites(rdev, msg))
goto nla_put_failure;
+ if (nl80211_put_tid_config_support(rdev, msg))
+ goto nla_put_failure;
+
/* done */
state->split_start = 0;
break;
@@ -13944,44 +13983,13 @@ static int nl80211_probe_mesh_link(struct sk_buff *skb, struct genl_info *info)
return rdev_probe_mesh_link(rdev, dev, dest, buf, len);
}
-static int
-__nl80211_check_tid_conf_support(struct cfg80211_registered_device *rdev,
- struct netlink_ext_ack *extack,
- const u8 *peer, struct nlattr *attrs[],
- struct ieee80211_tid_cfg *tid_conf,
- enum nl80211_tid_config_attr attr,
- enum nl80211_ext_feature_index per_tid_config,
- enum nl80211_ext_feature_index per_sta_config)
-{
- if (!wiphy_ext_feature_isset(&rdev->wiphy, per_tid_config)) {
- NL_SET_ERR_MSG_ATTR(extack, attrs[attr],
- "TID specific configuration not supported");
- return -ENOTSUPP;
- }
-
- if (peer && !wiphy_ext_feature_isset(&rdev->wiphy, per_sta_config)) {
- NL_SET_ERR_MSG_ATTR(extack, attrs[attr],
- "peer specific TID configuration not supported");
- return -ENOTSUPP;
- }
-
- tid_conf->tid_conf_mask |= BIT(attr);
- return 0;
-}
-
-#define nl80211_check_tid_config_support(rdev, extack, peer, attrs, tid_conf, \
- conf) \
- __nl80211_check_tid_conf_support(rdev, extack, peer, attrs, tid_conf, \
- NL80211_TID_CONFIG_ATTR_##conf, \
- NL80211_EXT_FEATURE_PER_TID_##conf##_CONFIG, \
- NL80211_EXT_FEATURE_PER_STA_##conf##_CONFIG)
-
static int parse_tid_conf(struct cfg80211_registered_device *rdev,
struct nlattr *attrs[], struct net_device *dev,
- struct ieee80211_tid_cfg *tid_conf,
+ struct cfg80211_tid_cfg *tid_conf,
struct genl_info *info, const u8 *peer)
{
struct netlink_ext_ack *extack = info->extack;
+ u64 mask;
int err;
if (!attrs[NL80211_TID_CONFIG_ATTR_TIDS])
@@ -13989,12 +13997,12 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev,
tid_conf->config_override =
nla_get_flag(attrs[NL80211_TID_CONFIG_ATTR_OVERRIDE]);
- tid_conf->tid = nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_TIDS]);
+ tid_conf->tids = nla_get_u16(attrs[NL80211_TID_CONFIG_ATTR_TIDS]);
if (tid_conf->config_override) {
if (rdev->ops->reset_tid_config) {
err = rdev_reset_tid_config(rdev, dev, peer,
- tid_conf->tid);
+ tid_conf->tids);
/* If peer is there no other configuration will be
* allowed
*/
@@ -14006,16 +14014,21 @@ static int parse_tid_conf(struct cfg80211_registered_device *rdev,
}
if (attrs[NL80211_TID_CONFIG_ATTR_NOACK]) {
- err = nl80211_check_tid_config_support(rdev, extack, peer,
- attrs, tid_conf,
- NOACK);
- if (err)
- return err;
-
+ tid_conf->mask |= BIT(NL80211_TID_CONFIG_ATTR_NOACK);
tid_conf->noack =
nla_get_u8(attrs[NL80211_TID_CONFIG_ATTR_NOACK]);
}
+ if (peer)
+ mask = rdev->wiphy.tid_config_support.peer;
+ else
+ mask = rdev->wiphy.tid_config_support.vif;
+
+ if (tid_conf->mask & ~mask) {
+ NL_SET_ERR_MSG(extack, "unsupported TID configuration");
+ return -ENOTSUPP;
+ }
+
return 0;
}
@@ -14025,7 +14038,7 @@ static int nl80211_set_tid_config(struct sk_buff *skb,
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct nlattr *attrs[NL80211_TID_CONFIG_ATTR_MAX + 1];
struct net_device *dev = info->user_ptr[1];
- struct ieee80211_tid_config *tid_config;
+ struct cfg80211_tid_config *tid_config;
struct nlattr *tid;
int conf_idx = 0, rem_conf;
int ret = -EINVAL;
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index a754e0496b6c..99462f0c4e08 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -1328,7 +1328,7 @@ rdev_probe_mesh_link(struct cfg80211_registered_device *rdev,
static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev,
struct net_device *dev,
- struct ieee80211_tid_config *tid_conf)
+ struct cfg80211_tid_config *tid_conf)
{
int ret;
@@ -1340,12 +1340,12 @@ static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev,
static inline int rdev_reset_tid_config(struct cfg80211_registered_device *rdev,
struct net_device *dev, const u8 *peer,
- u8 tid)
+ u8 tids)
{
int ret;
- trace_rdev_reset_tid_config(&rdev->wiphy, dev, peer, tid);
- ret = rdev->ops->reset_tid_config(&rdev->wiphy, dev, peer, tid);
+ trace_rdev_reset_tid_config(&rdev->wiphy, dev, peer, tids);
+ ret = rdev->ops->reset_tid_config(&rdev->wiphy, dev, peer, tids);
trace_rdev_return_int(&rdev->wiphy, ret);
return ret;
}
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 167b18896cd6..839df54cee21 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -3482,7 +3482,7 @@ TRACE_EVENT(rdev_probe_mesh_link,
TRACE_EVENT(rdev_set_tid_config,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
- struct ieee80211_tid_config *tid_conf),
+ struct cfg80211_tid_config *tid_conf),
TP_ARGS(wiphy, netdev, tid_conf),
TP_STRUCT__entry(
WIPHY_ENTRY
@@ -3500,22 +3500,22 @@ TRACE_EVENT(rdev_set_tid_config,
TRACE_EVENT(rdev_reset_tid_config,
TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
- const u8 *peer, u8 tid),
- TP_ARGS(wiphy, netdev, peer, tid),
+ const u8 *peer, u8 tids),
+ TP_ARGS(wiphy, netdev, peer, tids),
TP_STRUCT__entry(
WIPHY_ENTRY
NETDEV_ENTRY
MAC_ENTRY(peer)
- __field(u8, tid)
+ __field(u8, tids)
),
TP_fast_assign(
WIPHY_ASSIGN;
NETDEV_ASSIGN;
MAC_ASSIGN(peer, peer);
- __entry->tid = tid;
+ __entry->tids = tids;
),
- TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", tid: %u",
- WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->tid)
+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", tids: 0x%x",
+ WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->tids)
);
#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */