History

wifi: cfg80211: Add support for setting TID to link mapping

Add support for setting the TID to link mapping for a non-AP MLD station. This is useful in cases user space needs to restrict the possible set of active links, e.g., since it got a BSS Transition Management request forcing to use only a subset of the valid links etc.

Ilan Peer committed 2 years ago

Commit b61e6b41 parent 9adc8b65 files · +112 −0Browse files

Unified · Split

5 files
  1. include/net/cfg80211.h +18 −0
  2. include/uapi/linux/nl80211.h +19 −0
  3. net/wireless/nl80211.c +37 −0
  4. net/wireless/rdev-ops.h +18 −0
  5. net/wireless/trace.h +20 −0
include/net/cfg80211.h+18−0
@@ -1673,6 +1673,21 @@ struct link_station_del_parameters { · 1672 unmodified lines
16731673 u32 link_id;
16741674 };
16751675
1676+/**
1677+ * struct cfg80211_ttlm_params: TID to link mapping parameters
1678+ *
1679+ * Used for setting a TID to link mapping.
1680+ *
1681+ * @dlink: Downlink TID to link mapping, as defined in section 9.4.2.314
1682+ * (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1683+ * @ulink: Uplink TID to link mapping, as defined in section 9.4.2.314
1684+ * (TID-To-Link Mapping element) in Draft P802.11be_D4.0.
1685+ */
1686+struct cfg80211_ttlm_params {
1687+ u16 dlink[8];
1688+ u16 ulink[8];
1689+};
1690+
16761691 /**
16771692 * struct station_parameters - station parameters
16781693 *
@@ -4523,6 +4538,7 @@ struct mgmt_frame_regs { · 2844 unmodified lines
45234538 * @del_link_station: Remove a link of a station.
45244539 *
45254540 * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
4541+ * @set_ttlm: set the TID to link mapping.
45264542 */
45274543 struct cfg80211_ops {
45284544 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -4882,6 +4898,8 @@ struct cfg80211_ops { · 353 unmodified lines
48824898 struct link_station_del_parameters *params);
48834899 int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
48844900 struct cfg80211_set_hw_timestamp *hwts);
4901+ int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
4902+ struct cfg80211_ttlm_params *params);
48854903 };
48864904
48874905 /*
include/uapi/linux/nl80211.h+19−0
@@ -1328,6 +1328,11 @@ · 1327 unmodified lines
13281328 * Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide
13291329 * information about the removed STA MLD setup links.
13301330 *
1331+ * @NL80211_CMD_SET_TID_TO_LINK_MAPPING: Set the TID to Link Mapping for a
1332+ * non-AP MLD station. The %NL80211_ATTR_MLO_TTLM_DLINK and
1333+ * %NL80211_ATTR_MLO_TTLM_ULINK attributes are used to specify the
1334+ * TID to Link mapping for downlink/uplink traffic.
1335+ *
13311336 * @NL80211_CMD_MAX: highest used command number
13321337 * @__NL80211_CMD_AFTER_LAST: internal use
13331338 */
@@ -1583,6 +1588,8 @@ enum nl80211_commands { · 249 unmodified lines
15831588
15841589 NL80211_CMD_LINKS_REMOVED,
15851590
1591+ NL80211_CMD_SET_TID_TO_LINK_MAPPING,
1592+
15861593 /* add new commands above here */
15871594
15881595 /* used to define NL80211_CMD_MAX below */
@@ -2835,6 +2842,15 @@ enum nl80211_commands { · 1246 unmodified lines
28352842 * include BSSes that can only be used in restricted scenarios and/or
28362843 * cannot be used at all.
28372844 *
2845+ * @NL80211_ATTR_MLO_TTLM_DLINK: Binary attribute specifying the downlink TID to
2846+ * link mapping. The length is 8 * sizeof(u16). For each TID the link
2847+ * mapping is as defined in section 9.4.2.314 (TID-To-Link Mapping element)
2848+ * in Draft P802.11be_D4.0.
2849+ * @NL80211_ATTR_MLO_TTLM_ULINK: Binary attribute specifying the uplink TID to
2850+ * link mapping. The length is 8 * sizeof(u16). For each TID the link
2851+ * mapping is as defined in section 9.4.2.314 (TID-To-Link Mapping element)
2852+ * in Draft P802.11be_D4.0.
2853+ *
28382854 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
28392855 * @NL80211_ATTR_MAX: highest attribute number currently defined
28402856 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3375,6 +3391,9 @@ enum nl80211_attrs { · 534 unmodified lines
33753391
33763392 NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA,
33773393
3394+ NL80211_ATTR_MLO_TTLM_DLINK,
3395+ NL80211_ATTR_MLO_TTLM_ULINK,
3396+
33783397 /* add attributes here, update the policy in nl80211.c */
33793398
33803399 __NL80211_ATTR_AFTER_LAST,
net/wireless/nl80211.c+37−0
@@ -819,6 +819,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 818 unmodified lines
819819 [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED },
820820 [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG },
821821 [NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA] = { .type = NLA_FLAG },
822+ [NL80211_ATTR_MLO_TTLM_DLINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8),
823+ [NL80211_ATTR_MLO_TTLM_ULINK] = NLA_POLICY_EXACT_LEN(sizeof(u16) * 8),
822824 };
823825
824826 /* policy for the key attributes */
@@ -16298,6 +16300,35 @@ static int nl80211_set_hw_timestamp(struct sk_buff *skb, · 15473 unmodified lines
1629816300 return rdev_set_hw_timestamp(rdev, dev, &hwts);
1629916301 }
1630016302
16303+static int
16304+nl80211_set_ttlm(struct sk_buff *skb, struct genl_info *info)
16305+{
16306+ struct cfg80211_ttlm_params params = {};
16307+ struct cfg80211_registered_device *rdev = info->user_ptr[0];
16308+ struct net_device *dev = info->user_ptr[1];
16309+ struct wireless_dev *wdev = dev->ieee80211_ptr;
16310+
16311+ if (wdev->iftype != NL80211_IFTYPE_STATION &&
16312+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
16313+ return -EOPNOTSUPP;
16314+
16315+ if (!wdev->connected)
16316+ return -ENOLINK;
16317+
16318+ if (!info->attrs[NL80211_ATTR_MLO_TTLM_DLINK] ||
16319+ !info->attrs[NL80211_ATTR_MLO_TTLM_ULINK])
16320+ return -EINVAL;
16321+
16322+ nla_memcpy(params.dlink,
16323+ info->attrs[NL80211_ATTR_MLO_TTLM_DLINK],
16324+ sizeof(params.dlink));
16325+ nla_memcpy(params.ulink,
16326+ info->attrs[NL80211_ATTR_MLO_TTLM_ULINK],
16327+ sizeof(params.ulink));
16328+
16329+ return rdev_set_ttlm(rdev, dev, &params);
16330+}
16331+
1630116332 #define NL80211_FLAG_NEED_WIPHY 0x01
1630216333 #define NL80211_FLAG_NEED_NETDEV 0x02
1630316334 #define NL80211_FLAG_NEED_RTNL 0x04
@@ -17479,6 +17510,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { · 1175 unmodified lines
1747917510 .flags = GENL_UNS_ADMIN_PERM,
1748017511 .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
1748117512 },
17513+ {
17514+ .cmd = NL80211_CMD_SET_TID_TO_LINK_MAPPING,
17515+ .doit = nl80211_set_ttlm,
17516+ .flags = GENL_UNS_ADMIN_PERM,
17517+ .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
17518+ },
1748217519 };
1748317520
1748417521 static struct genl_family nl80211_fam __ro_after_init = {
net/wireless/rdev-ops.h+18−0
@@ -1524,4 +1524,22 @@ rdev_set_hw_timestamp(struct cfg80211_registered_device *rdev, · 1523 unmodified lines
15241524
15251525 return ret;
15261526 }
1527+
1528+static inline int
1529+rdev_set_ttlm(struct cfg80211_registered_device *rdev,
1530+ struct net_device *dev,
1531+ struct cfg80211_ttlm_params *params)
1532+{
1533+ struct wiphy *wiphy = &rdev->wiphy;
1534+ int ret;
1535+
1536+ if (!rdev->ops->set_ttlm)
1537+ return -EOPNOTSUPP;
1538+
1539+ trace_rdev_set_ttlm(wiphy, dev, params);
1540+ ret = rdev->ops->set_ttlm(wiphy, dev, params);
1541+ trace_rdev_return_int(wiphy, ret);
1542+
1543+ return ret;
1544+}
15271545 #endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h+20−0
@@ -3979,6 +3979,26 @@ TRACE_EVENT(cfg80211_links_removed, · 3978 unmodified lines
39793979 __entry->link_mask)
39803980 );
39813981
3982+TRACE_EVENT(rdev_set_ttlm,
3983+ TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
3984+ struct cfg80211_ttlm_params *params),
3985+ TP_ARGS(wiphy, netdev, params),
3986+ TP_STRUCT__entry(
3987+ WIPHY_ENTRY
3988+ NETDEV_ENTRY
3989+ __array(u8, dlink, sizeof(u16) * 8)
3990+ __array(u8, ulink, sizeof(u16) * 8)
3991+ ),
3992+ TP_fast_assign(
3993+ WIPHY_ASSIGN;
3994+ NETDEV_ASSIGN;
3995+ memcpy(__entry->dlink, params->dlink, sizeof(params->dlink));
3996+ memcpy(__entry->ulink, params->ulink, sizeof(params->ulink));
3997+ ),
3998+ TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT,
3999+ WIPHY_PR_ARG, NETDEV_PR_ARG)
4000+);
4001+
39824002 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
39834003
39844004 #undef TRACE_INCLUDE_PATH

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t