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.
Unified · Split
| @@ -1673,6 +1673,21 @@ struct link_station_del_parameters { · 1672 unmodified lines | ||
| 1673 | 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 | + */ | |
| 1686 | +struct cfg80211_ttlm_params { | |
| 1687 | + u16 dlink[8]; | |
| 1688 | + u16 ulink[8]; | |
| 1689 | +}; | |
| 1690 | + | |
| 1676 | 1691 | /** |
| 1677 | 1692 | * struct station_parameters - station parameters |
| 1678 | 1693 | * |
| @@ -4523,6 +4538,7 @@ struct mgmt_frame_regs { · 2844 unmodified lines | ||
| 4523 | 4538 | * @del_link_station: Remove a link of a station. |
| 4524 | 4539 | * |
| 4525 | 4540 | * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. |
| 4541 | + * @set_ttlm: set the TID to link mapping. | |
| 4526 | 4542 | */ |
| 4527 | 4543 | struct cfg80211_ops { |
| 4528 | 4544 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
| @@ -4882,6 +4898,8 @@ struct cfg80211_ops { · 353 unmodified lines | ||
| 4882 | 4898 | struct link_station_del_parameters *params); |
| 4883 | 4899 | int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev, |
| 4884 | 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 | /* |
| @@ -1328,6 +1328,11 @@ · 1327 unmodified lines | ||
| 1328 | 1328 | * Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide |
| 1329 | 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 | 1336 | * @NL80211_CMD_MAX: highest used command number |
| 1332 | 1337 | * @__NL80211_CMD_AFTER_LAST: internal use |
| 1333 | 1338 | */ |
| @@ -1583,6 +1588,8 @@ enum nl80211_commands { · 249 unmodified lines | ||
| 1583 | 1588 | |
| 1584 | 1589 | NL80211_CMD_LINKS_REMOVED, |
| 1585 | 1590 | |
| 1591 | + NL80211_CMD_SET_TID_TO_LINK_MAPPING, | |
| 1592 | + | |
| 1586 | 1593 | /* add new commands above here */ |
| 1587 | 1594 | |
| 1588 | 1595 | /* used to define NL80211_CMD_MAX below */ |
| @@ -2835,6 +2842,15 @@ enum nl80211_commands { · 1246 unmodified lines | ||
| 2835 | 2842 | * include BSSes that can only be used in restricted scenarios and/or |
| 2836 | 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 | 2854 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
| 2839 | 2855 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
| 2840 | 2856 | * @__NL80211_ATTR_AFTER_LAST: internal use |
| @@ -3375,6 +3391,9 @@ enum nl80211_attrs { · 534 unmodified lines | ||
| 3375 | 3391 | |
| 3376 | 3392 | NL80211_ATTR_BSS_DUMP_INCLUDE_USE_DATA, |
| 3377 | 3393 | |
| 3394 | + NL80211_ATTR_MLO_TTLM_DLINK, | |
| 3395 | + NL80211_ATTR_MLO_TTLM_ULINK, | |
| 3396 | + | |
| 3378 | 3397 | /* add attributes here, update the policy in nl80211.c */ |
| 3379 | 3398 | |
| 3380 | 3399 | __NL80211_ATTR_AFTER_LAST, |
| @@ -819,6 +819,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { · 818 unmodified lines | ||
| 819 | 819 | [NL80211_ATTR_EMA_RNR_ELEMS] = { .type = NLA_NESTED }, |
| 820 | 820 | [NL80211_ATTR_MLO_LINK_DISABLED] = { .type = NLA_FLAG }, |
| 821 | 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 | 826 | /* policy for the key attributes */ |
| @@ -16298,6 +16300,35 @@ static int nl80211_set_hw_timestamp(struct sk_buff *skb, · 15473 unmodified lines | ||
| 16298 | 16300 | return rdev_set_hw_timestamp(rdev, dev, &hwts); |
| 16299 | 16301 | } |
| 16300 | 16302 | |
| 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, ¶ms); | |
| 16330 | +} | |
| 16331 | + | |
| 16301 | 16332 | #define NL80211_FLAG_NEED_WIPHY 0x01 |
| 16302 | 16333 | #define NL80211_FLAG_NEED_NETDEV 0x02 |
| 16303 | 16334 | #define NL80211_FLAG_NEED_RTNL 0x04 |
| @@ -17479,6 +17510,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { · 1175 unmodified lines | ||
| 17479 | 17510 | .flags = GENL_UNS_ADMIN_PERM, |
| 17480 | 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 | |
| 17484 | 17521 | static struct genl_family nl80211_fam __ro_after_init = { |
| @@ -1524,4 +1524,22 @@ rdev_set_hw_timestamp(struct cfg80211_registered_device *rdev, · 1523 unmodified lines | ||
| 1524 | 1524 | |
| 1525 | 1525 | return ret; |
| 1526 | 1526 | } |
| 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 | +} | |
| 1527 | 1545 | #endif /* __CFG80211_RDEV_OPS */ |
| @@ -3979,6 +3979,26 @@ TRACE_EVENT(cfg80211_links_removed, · 3978 unmodified lines | ||
| 3979 | 3979 | __entry->link_mask) |
| 3980 | 3980 | ); |
| 3981 | 3981 | |
| 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 | + | |
| 3982 | 4002 | #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ |
| 3983 | 4003 | |
| 3984 | 4004 | #undef TRACE_INCLUDE_PATH |