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
1673 u32 link_id;1673 u32 link_id;
1674};1674};
1675 1675
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 */
1686struct cfg80211_ttlm_params {
1687 u16 dlink[8];
1688 u16 ulink[8];
1689};
1690
1676/**1691/**
1677 * struct station_parameters - station parameters1692 * struct station_parameters - station parameters
1678 *1693 *
@@ -4523,6 +4538,7 @@ struct mgmt_frame_regs { · 2844 unmodified lines
4523 * @del_link_station: Remove a link of a station.4538 * @del_link_station: Remove a link of a station.
4524 *4539 *
4525 * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.4540 * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
4541 * @set_ttlm: set the TID to link mapping.
4526 */4542 */
4527struct cfg80211_ops {4543struct cfg80211_ops {
4528 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);4544 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -4882,6 +4898,8 @@ struct cfg80211_ops { · 353 unmodified lines
4882 struct link_station_del_parameters *params);4898 struct link_station_del_parameters *params);
4883 int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,4899 int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
4884 struct cfg80211_set_hw_timestamp *hwts);4900 struct cfg80211_set_hw_timestamp *hwts);
4901 int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
4902 struct cfg80211_ttlm_params *params);
4885};4903};
4886 4904
4887/*4905/*
include/uapi/linux/nl80211.h+19−0
@@ -1328,6 +1328,11 @@ · 1327 unmodified lines
1328 * Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide1328 * Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide
1329 * information about the removed STA MLD setup links.1329 * information about the removed STA MLD setup links.
1330 *1330 *
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 *
1331 * @NL80211_CMD_MAX: highest used command number1336 * @NL80211_CMD_MAX: highest used command number
1332 * @__NL80211_CMD_AFTER_LAST: internal use1337 * @__NL80211_CMD_AFTER_LAST: internal use
1333 */1338 */
@@ -1583,6 +1588,8 @@ enum nl80211_commands { · 249 unmodified lines
1583 1588
1584 NL80211_CMD_LINKS_REMOVED,1589 NL80211_CMD_LINKS_REMOVED,
1585 1590
1591 NL80211_CMD_SET_TID_TO_LINK_MAPPING,
1592
1586 /* add new commands above here */1593 /* add new commands above here */
1587 1594
1588 /* used to define NL80211_CMD_MAX below */1595 /* used to define NL80211_CMD_MAX below */
@@ -2835,6 +2842,15 @@ enum nl80211_commands { · 1246 unmodified lines
2835 * include BSSes that can only be used in restricted scenarios and/or2842 * include BSSes that can only be used in restricted scenarios and/or
2836 * cannot be used at all.2843 * cannot be used at all.
2837 *2844 *
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 *
2838 * @NUM_NL80211_ATTR: total number of nl80211_attrs available2854 * @NUM_NL80211_ATTR: total number of nl80211_attrs available
2839 * @NL80211_ATTR_MAX: highest attribute number currently defined2855 * @NL80211_ATTR_MAX: highest attribute number currently defined
2840 * @__NL80211_ATTR_AFTER_LAST: internal use2856 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3375,6 +3391,9 @@ enum nl80211_attrs { · 534 unmodified lines
3375 3391
3376 NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA,3392 NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA,
3377 3393
3394 NL80211_ATTR_MLO_TTLM_DLINK,
3395 NL80211_ATTR_MLO_TTLM_ULINK,
3396
3378 /* add attributes here, update the policy in nl80211.c */3397 /* add attributes here, update the policy in nl80211.c */
3379 3398
3380 __NL80211_ATTR_AFTER_LAST,3399 __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
819 [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED },819 [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED },
820 [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG },820 [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG },
821 [NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA] = { .type = NLA_FLAG },821 [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),
822};824};
823 825
824/* policy for the key attributes */826/* policy for the key attributes */
@@ -16298,6 +16300,35 @@ static int nl80211_set_hw_timestamp(struct sk_buff *skb, · 15473 unmodified lines
16298 return rdev_set_hw_timestamp(rdev, dev, &hwts);16300 return rdev_set_hw_timestamp(rdev, dev, &hwts);
16299}16301}
16300 16302
16303static int
16304nl80211_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
16301#define NL80211_FLAG_NEED_WIPHY 0x0116332#define NL80211_FLAG_NEED_WIPHY 0x01
16302#define NL80211_FLAG_NEED_NETDEV 0x0216333#define NL80211_FLAG_NEED_NETDEV 0x02
16303#define NL80211_FLAG_NEED_RTNL 0x0416334#define NL80211_FLAG_NEED_RTNL 0x04
@@ -17479,6 +17510,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { · 1175 unmodified lines
17479 .flags = GENL_UNS_ADMIN_PERM,17510 .flags = GENL_UNS_ADMIN_PERM,
17480 .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),17511 .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
17481 },17512 },
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 },
17482};17519};
17483 17520
17484static struct genl_family nl80211_fam __ro_after_init = {17521static 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
1524 1524
1525 return ret;1525 return ret;
1526}1526}
1527
1528static inline int
1529rdev_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}
1527#endif /* __CFG80211_RDEV_OPS */1545#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h+20−0
@@ -3979,6 +3979,26 @@ TRACE_EVENT(cfg80211_links_removed, · 3978 unmodified lines
3979 __entry->link_mask)3979 __entry->link_mask)
3980);3980);
3981 3981
3982TRACE_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
3982#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */4002#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
3983 4003
3984#undef TRACE_INCLUDE_PATH4004#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