> +static const struct nla_policy
> +nl80211_attr_tid_policy[NL80211_ATTR_TID_MAX + 1] = {
> + [NL80211_ATTR_TID] = { .type = NLA_U8 },
> + [NL80211_ATTR_TID_RETRY_CONFIG] = { .type = NLA_FLAG },
> + [NL80211_ATTR_TID_RETRY_SHORT] = { .type = NLA_U8 },
> + [NL80211_ATTR_TID_RETRY_LONG] = { .type = NLA_U8 },
> +};
> +
> +static int nl80211_set_tid_config(struct sk_buff *skb,
> + struct genl_info *info)
> +{
> + struct cfg80211_registered_device *rdev = info->user_ptr[0];
> + struct nlattr *attrs[NL80211_ATTR_TID_MAX + 1];
> + struct nlattr *tid;
> + struct net_device *dev = info->user_ptr[1];
> + const char *peer = NULL;
> + u8 tid_no;
> + int ret = -EINVAL, retry_short = -1, retry_long = -1;
> +
> + tid = info->attrs[NL80211_ATTR_TID_CONFIG];
> + if (!tid)
> + return -EINVAL;
> +
> + ret = nla_parse_nested(attrs, NL80211_ATTR_TID_MAX, tid,
> + nl80211_attr_tid_policy, info->extack);
> + if (ret)
> + return ret;
> +
> + if (!attrs[NL80211_ATTR_TID])
> + return -EINVAL;
Why not allow configuring multiple at the same time, and make TID_CONFIG
an array of
tid => [config attrs, i.e. retry cfg/short/long]
If not, then you should probably use NLA_POLICY_RANGE() for it.
johannes