[PATCH 02/10] wifi: cfg80211: add support for advertising multiple radios belonging to a wiphy

Johannes Berg johannes at sipsolutions.net
Fri Jun 28 01:12:55 PDT 2024


On Thu, 2024-06-20 at 13:11 +0200, Felix Fietkau wrote:
> 
> + * @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES: Nested array of frequency ranges
> + *	supported by this radio.

That could point to &enum nl80211_wiphy_radio_freq_range (if it stays
this way)

However, also for new arrays defined in this patchset, which if I'm not
mistaken are

 - NL80211_ATTR_WIPHY_RADIOS
 - NL80211_ATTR_WIPHY_INTERFACE_COMBINATIONS
 - NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES
 - NL80211_WIPHY_RADIO_ATTR_INTERFACE_COMBINATIONS

we should probably go with the times and use the multi-attr array
concept:
https://www.kernel.org/doc/html/latest/userspace-api/netlink/specs.html#multi-attr-arrays


That would change the structure so that each of the attributes listed
above can simply appear multiple times. I would consider at that point
renaming them all to singular (since each individually represents a
single entry), and perhaps at that point using a simple structure for
NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE instead of the nesting. You could
even just move struct wiphy_radio_freq_range to nl80211.h

> +static int nl80211_put_radio(struct wiphy *wiphy, struct sk_buff *msg, int idx)
> +{
> +	const struct wiphy_radio *r = &wiphy->radio[idx];
> +	struct nlattr *radio, *freqs, *freq;
> +	int i;
> +
> +	radio = nla_nest_start(msg, idx);
> +	if (!radio)
> +		return -ENOBUFS;
> +
> +	freqs = nla_nest_start_noflag(msg, NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES);

Either way, however, new code should not use _noflag()

johannes




More information about the ath12k mailing list