Skip to content

Commit 8f500fb

Browse files
AyalaBkrjmberg-intel
authored andcommitted
wifi: mac80211: process and save negotiated TID to Link mapping request
An MLD may send TID-to-Link mapping request frame to negotiate TID to link mapping with a peer MLD. Support handling negotiated TID-to-Link mapping request frame by parsing the frame, asking the driver whether it supports the received mapping or not, and sending a TID-to-Link mapping response to the AP MLD. Theoretically, links that became inactive due to the received TID-to-Link mapping request, can be selected to be activated but this would require tearing down the negotiated TID-to-Link mapping, which is still not supported. Signed-off-by: Ayala Beker <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Reviewed-by: Gregory Greenman <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20240102213313.0bc1a24fcc9d.Ie72e47dc6f8c77d4a2f0947b775ef6367fe0edac@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 83e897a commit 8f500fb

File tree

8 files changed

+465
-18
lines changed

8 files changed

+465
-18
lines changed

include/net/mac80211.h

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ struct ieee80211_vif_chanctx_switch {
342342
* status changed.
343343
* @BSS_CHANGED_EHT_PUNCTURING: The channel puncturing bitmap changed.
344344
* @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed.
345+
* @BSS_CHANGED_MLD_TTLM: TID to link mapping was changed
345346
*/
346347
enum ieee80211_bss_change {
347348
BSS_CHANGED_ASSOC = 1<<0,
@@ -378,6 +379,7 @@ enum ieee80211_bss_change {
378379
BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
379380
BSS_CHANGED_EHT_PUNCTURING = BIT_ULL(32),
380381
BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(33),
382+
BSS_CHANGED_MLD_TTLM = BIT_ULL(34),
381383

382384
/* when adding here, make sure to change ieee80211_reconfig */
383385
};
@@ -1845,6 +1847,35 @@ struct ieee80211_vif_cfg {
18451847
u8 ap_addr[ETH_ALEN] __aligned(2);
18461848
};
18471849

1850+
#define IEEE80211_TTLM_NUM_TIDS 8
1851+
1852+
/**
1853+
* struct ieee80211_neg_ttlm - negotiated TID to link map info
1854+
*
1855+
* @downlink: bitmap of active links per TID for downlink, or 0 if mapping for
1856+
* this TID is not included.
1857+
* @uplink: bitmap of active links per TID for uplink, or 0 if mapping for this
1858+
* TID is not included.
1859+
* @valid: info is valid or not.
1860+
*/
1861+
struct ieee80211_neg_ttlm {
1862+
u16 downlink[IEEE80211_TTLM_NUM_TIDS];
1863+
u16 uplink[IEEE80211_TTLM_NUM_TIDS];
1864+
bool valid;
1865+
};
1866+
1867+
/**
1868+
* enum ieee80211_neg_ttlm_res - return value for negotiated TTLM handling
1869+
* @NEG_TTLM_RES_ACCEPT: accept the request
1870+
* @NEG_TTLM_RES_REJECT: reject the request
1871+
* @NEG_TTLM_RES_SUGGEST_PREFERRED: reject and suggest a new mapping
1872+
*/
1873+
enum ieee80211_neg_ttlm_res {
1874+
NEG_TTLM_RES_ACCEPT,
1875+
NEG_TTLM_RES_REJECT,
1876+
NEG_TTLM_RES_SUGGEST_PREFERRED
1877+
};
1878+
18481879
/**
18491880
* struct ieee80211_vif - per-interface data
18501881
*
@@ -1863,6 +1894,11 @@ struct ieee80211_vif_cfg {
18631894
* API calls meant for that purpose.
18641895
* @dormant_links: bitmap of valid but disabled links, or 0 for non-MLO.
18651896
* Must be a subset of valid_links.
1897+
* @suspended_links: subset of dormant_links representing links that are
1898+
* suspended.
1899+
* 0 for non-MLO.
1900+
* @neg_ttlm: negotiated TID to link mapping info.
1901+
* see &struct ieee80211_neg_ttlm.
18661902
* @addr: address of this interface
18671903
* @p2p: indicates whether this AP or STA interface is a p2p
18681904
* interface, i.e. a GO or p2p-sta respectively
@@ -1900,7 +1936,8 @@ struct ieee80211_vif {
19001936
struct ieee80211_vif_cfg cfg;
19011937
struct ieee80211_bss_conf bss_conf;
19021938
struct ieee80211_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
1903-
u16 valid_links, active_links, dormant_links;
1939+
u16 valid_links, active_links, dormant_links, suspended_links;
1940+
struct ieee80211_neg_ttlm neg_ttlm;
19041941
u8 addr[ETH_ALEN] __aligned(2);
19051942
bool p2p;
19061943

@@ -4293,6 +4330,10 @@ struct ieee80211_prep_tx_info {
42934330
* flow offloading for flows originating from the vif.
42944331
* Note that the driver must not assume that the vif driver_data is valid
42954332
* at this point, since the callback can be called during netdev teardown.
4333+
* @can_neg_ttlm: for managed interface, requests the driver to determine
4334+
* if the requested TID-To-Link mapping can be accepted or not.
4335+
* If it's not accepted the driver may suggest a preferred mapping and
4336+
* modify @ttlm parameter with the suggested TID-to-Link mapping.
42964337
*/
42974338
struct ieee80211_ops {
42984339
void (*tx)(struct ieee80211_hw *hw,
@@ -4673,6 +4714,9 @@ struct ieee80211_ops {
46734714
struct net_device *dev,
46744715
enum tc_setup_type type,
46754716
void *type_data);
4717+
enum ieee80211_neg_ttlm_res
4718+
(*can_neg_ttlm)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4719+
struct ieee80211_neg_ttlm *ttlm);
46764720
};
46774721

46784722
/**

net/mac80211/driver-ops.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,4 +1695,23 @@ int drv_change_sta_links(struct ieee80211_local *local,
16951695
struct ieee80211_sta *sta,
16961696
u16 old_links, u16 new_links);
16971697

1698+
static inline enum ieee80211_neg_ttlm_res
1699+
drv_can_neg_ttlm(struct ieee80211_local *local,
1700+
struct ieee80211_sub_if_data *sdata,
1701+
struct ieee80211_neg_ttlm *neg_ttlm)
1702+
{
1703+
enum ieee80211_neg_ttlm_res res = NEG_TTLM_RES_REJECT;
1704+
1705+
might_sleep();
1706+
if (!check_sdata_in_driver(sdata))
1707+
return -EIO;
1708+
1709+
trace_drv_can_neg_ttlm(local, sdata, neg_ttlm);
1710+
if (local->ops->can_neg_ttlm)
1711+
res = local->ops->can_neg_ttlm(&local->hw, &sdata->vif,
1712+
neg_ttlm);
1713+
trace_drv_neg_ttlm_res(local, sdata, res, neg_ttlm);
1714+
1715+
return res;
1716+
}
16981717
#endif /* __MAC80211_DRIVER_OPS */

net/mac80211/ieee80211_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,8 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
26032603
const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
26042604
u8 eht_cap_len,
26052605
struct link_sta_info *link_sta);
2606+
void ieee80211_process_neg_ttlm_req(struct ieee80211_sub_if_data *sdata,
2607+
struct ieee80211_mgmt *mgmt, size_t len);
26062608

26072609
void ieee80211_check_wbrf_support(struct ieee80211_local *local);
26082610
void ieee80211_add_wbrf(struct ieee80211_local *local, struct cfg80211_chan_def *chandef);

net/mac80211/iface.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,18 @@ static void ieee80211_iface_process_skb(struct ieee80211_local *local,
15461546
default:
15471547
break;
15481548
}
1549+
} else if (ieee80211_is_action(mgmt->frame_control) &&
1550+
mgmt->u.action.category == WLAN_CATEGORY_PROTECTED_EHT) {
1551+
if (sdata->vif.type == NL80211_IFTYPE_STATION) {
1552+
switch (mgmt->u.action.u.ttlm_req.action_code) {
1553+
case WLAN_PROTECTED_EHT_ACTION_TTLM_REQ:
1554+
ieee80211_process_neg_ttlm_req(sdata, mgmt,
1555+
skb->len);
1556+
break;
1557+
default:
1558+
break;
1559+
}
1560+
}
15491561
} else if (ieee80211_is_ext(mgmt->frame_control)) {
15501562
if (sdata->vif.type == NL80211_IFTYPE_STATION)
15511563
ieee80211_sta_rx_queued_ext(sdata, skb);

net/mac80211/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
208208
BSS_CHANGED_IBSS |\
209209
BSS_CHANGED_ARP_FILTER |\
210210
BSS_CHANGED_SSID |\
211-
BSS_CHANGED_MLD_VALID_LINKS)
211+
BSS_CHANGED_MLD_VALID_LINKS |\
212+
BSS_CHANGED_MLD_TTLM)
212213

213214
void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
214215
u64 changed)

0 commit comments

Comments
 (0)