Search Linux Wireless

Re: [RFC v3 6/8] wifi: mac80211: extend ifcomb check functions for multi-radio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 6/6/2024 11:37 PM, Felix Fietkau wrote:
Add support for counting global and per-radio max/current number of
channels, as well as checking radio-specific interface combinations.

Signed-off-by: Felix Fietkau <nbd@xxxxxxxx>
---
  net/mac80211/cfg.c         |   7 +-
  net/mac80211/chan.c        |  17 +++--
  net/mac80211/ibss.c        |   2 +-
  net/mac80211/ieee80211_i.h |   6 +-
  net/mac80211/iface.c       |   2 +-
  net/mac80211/util.c        | 131 +++++++++++++++++++++++++++-----------
  6 files changed, 116 insertions(+), 49 deletions(-)


...

+static u32
+__ieee80211_get_radio_mask(struct ieee80211_sub_if_data *sdata)
+{
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_chanctx_conf *conf;
+	struct ieee80211_link_data *link;
+	u32 mask = 0;
+
+	for_each_sdata_link(local, link) {
+		conf = rcu_dereference(link->conf->chanctx_conf);
+		if (!conf || conf->radio_idx < 0)
+			continue;
+
+		mask |= BIT(conf->radio_idx);
+	}
+
+	return mask;
+}
+

I believe __ieee80211_get_radio_mask(sdata) should return the radio mask
used by this sdata right ?

if so, then you should not use "for_each_sdata_link(local, link)" because it iterate for all the sdata in the given local and give the radio mask. So always return all the radio (bitmap mask) used by the wiphy currently.

You can use either of below one

for_each_vif_active_link()

 or

for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++)


+int ieee80211_get_radio_mask(struct wiphy *wiphy, struct net_device *dev,
+			     u32 *mask)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+	*mask = __ieee80211_get_radio_mask(sdata);
+
+	return 0;
+}
+
+static bool
+ieee80211_sdata_uses_radio(struct ieee80211_sub_if_data *sdata, int radio_idx)
+{
+	if (radio_idx < 0)
+		return true;
+
+	return __ieee80211_get_radio_mask(sdata) & BIT(radio_idx);

same here __ieee80211_get_radio_mask(sdata) usage

+}
+
--
Karthikeyan Periyasamy
--
கார்த்திகேயன் பெரியசாமி




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux