openwrt/package/kernel/mac80211/patches/subsys/352-wifi-mac80211-use-vif-radio-mask-to-limit-chanctx-an.patch
Felix Fietkau 87033c3a0b mac80211: improve single-wiphy multi-radio support
- add support for configuring allowed radios for a vif
- add support for monitor mode on multiple channels

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-10-22 14:40:42 +02:00

53 lines
1.8 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 26 Sep 2024 14:07:50 +0200
Subject: [PATCH] wifi: mac80211: use vif radio mask to limit creating chanctx
Reject frequencies not supported by any radio that the vif is allowed to use.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1167,7 +1167,7 @@ ieee80211_replace_chanctx(struct ieee802
static bool
ieee80211_find_available_radio(struct ieee80211_local *local,
const struct ieee80211_chan_req *chanreq,
- int *radio_idx)
+ u32 radio_mask, int *radio_idx)
{
struct wiphy *wiphy = local->hw.wiphy;
const struct wiphy_radio *radio;
@@ -1178,6 +1178,9 @@ ieee80211_find_available_radio(struct ie
return true;
for (i = 0; i < wiphy->n_radio; i++) {
+ if (!(radio_mask & BIT(i)))
+ continue;
+
radio = &wiphy->radio[i];
if (!cfg80211_radio_chandef_valid(radio, &chanreq->oper))
continue;
@@ -1211,7 +1214,9 @@ int ieee80211_link_reserve_chanctx(struc
new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode);
if (!new_ctx) {
if (ieee80211_can_create_new_chanctx(local, -1) &&
- ieee80211_find_available_radio(local, chanreq, &radio_idx))
+ ieee80211_find_available_radio(local, chanreq,
+ sdata->wdev.radio_mask,
+ &radio_idx))
new_ctx = ieee80211_new_chanctx(local, chanreq, mode,
false, radio_idx);
else
@@ -1881,7 +1886,9 @@ int _ieee80211_link_use_channel(struct i
/* Note: context is now reserved */
if (ctx)
reserved = true;
- else if (!ieee80211_find_available_radio(local, chanreq, &radio_idx))
+ else if (!ieee80211_find_available_radio(local, chanreq,
+ sdata->wdev.radio_mask,
+ &radio_idx))
ctx = ERR_PTR(-EBUSY);
else
ctx = ieee80211_new_chanctx(local, chanreq, mode,