1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 26 Sep 2024 14:07:50 +0200
3 Subject: [PATCH] wifi: mac80211: use vif radio mask to limit creating chanctx
5 Reject frequencies not supported by any radio that the vif is allowed to use.
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 --- a/net/mac80211/chan.c
11 +++ b/net/mac80211/chan.c
12 @@ -1167,7 +1167,7 @@ ieee80211_replace_chanctx(struct ieee802
14 ieee80211_find_available_radio(struct ieee80211_local *local,
15 const struct ieee80211_chan_req *chanreq,
17 + u32 radio_mask, int *radio_idx)
19 struct wiphy *wiphy = local->hw.wiphy;
20 const struct wiphy_radio *radio;
21 @@ -1178,6 +1178,9 @@ ieee80211_find_available_radio(struct ie
24 for (i = 0; i < wiphy->n_radio; i++) {
25 + if (!(radio_mask & BIT(i)))
28 radio = &wiphy->radio[i];
29 if (!cfg80211_radio_chandef_valid(radio, &chanreq->oper))
31 @@ -1211,7 +1214,9 @@ int ieee80211_link_reserve_chanctx(struc
32 new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode);
34 if (ieee80211_can_create_new_chanctx(local, -1) &&
35 - ieee80211_find_available_radio(local, chanreq, &radio_idx))
36 + ieee80211_find_available_radio(local, chanreq,
37 + sdata->wdev.radio_mask,
39 new_ctx = ieee80211_new_chanctx(local, chanreq, mode,
42 @@ -1881,7 +1886,9 @@ int _ieee80211_link_use_channel(struct i
43 /* Note: context is now reserved */
46 - else if (!ieee80211_find_available_radio(local, chanreq, &radio_idx))
47 + else if (!ieee80211_find_available_radio(local, chanreq,
48 + sdata->wdev.radio_mask,
50 ctx = ERR_PTR(-EBUSY);
52 ctx = ieee80211_new_chanctx(local, chanreq, mode,