cfg80211: add support for advertising multiple radios belonging to a wiphy
Subsystems (2)
RFC 1/2 cfg80211: add support for advertising multiple radios belonging to a wiphy
The prerequisite for MLO support in cfg80211/mac80211 is that all the links participating in MLO must be from the same wiphy/ieee80211_hw. To meet this expectation, some drivers may need to group multiple discrete hardware each acting as a link in MLO under single wiphy.
With this change, the bands and supported frequencies of each individual radio are reported to user space. This allows user space to figure out the limitations of what combination of channels can be used concurrently.
--- include/net/cfg80211.h | 34 ++++++++++++++++ include/uapi/linux/nl80211.h | 48 +++++++++++++++++++++++ net/wireless/nl80211.c | 75 ++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+)
include/net/cfg80211.h +34 -0
@@ -5407,6 +5407,34 @@ struct wiphy_iftype_akm_suites {int n_akm_suites; }; +/** +* struct wiphy_radio_freq_range - wiphy frequency range +* @start_freq: start range edge frequency (kHz) +* @end_freq: end range edge frequency (kHz) +*/ +struct wiphy_radio_freq_range { +u32 start_freq; +u32 end_freq; +}; + + +/** +* struct wiphy_radio - This structure describes a physical radio belonging +* to a wiphy. It is used to describe concurrent-channel capabilities of the +* phy. Only one channel can be active on the radio described by struct +* wiphy_radio. +* +* @band_mask: Mask of enum nl80211_band describing the bands that the radio +* can operate on. +* @num_freq_range: number of elements in @freq_range +* @freq_range: frequency range that the radio can operate on (optional) +*/ +struct wiphy_radio { +u16 band_mask; +u16 n_freq_range; +const struct wiphy_radio_freq_range *freq_range; +}; +#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff/**
@@ -5625,6 +5653,9 @@ struct wiphy_iftype_akm_suites {* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver * supports enabling HW timestamping for all peers (i.e. no need to * specify a mac address). +* +* @radio: radios belonging to this wiphy +* @n_radio: number of radios */ struct wiphy {struct mutex mtx;
@@ -5775,6 +5806,9 @@ struct wiphy {u16 hw_timestamp_max_peers; +const struct wiphy_radio *radio; +int n_radio; +char priv[]__aligned(NETDEV_ALIGN) ; };
include/uapi/linux/nl80211.h +48 -0
58 lines not on this page · raw message
net/wireless/nl80211.c +75 -0
87 lines not on this page · raw message
Signature · 1 line
2.44.0
RFC 2/2 mac80211: ensure that only one channel context is active per radio
With multi-radio hardware, we need to ensure that a radio is not assigned to multiple channels at the same time.
--- include/net/mac80211.h | 2 + net/mac80211/chan.c | 96 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 87 insertions(+), 11 deletions(-)
include/net/mac80211.h +2 -0
@@ -250,6 +250,7 @@ struct ieee80211_chan_req {* @min_def: the minimum channel definition currently required. * @ap: the channel definition the AP actually is operating as, * for use with (wider bandwidth) OFDMA +* @radio_idx: index of the wiphy radio used used for this channel * @rx_chains_static: The number of RX chains that must always be * active on the channel to receive MIMO transmissions * @rx_chains_dynamic: The number of RX chains that must be enabled
@@ -264,6 +265,7 @@ struct ieee80211_chanctx_conf {struct cfg80211_chan_def min_def;struct cfg80211_chan_def ap; +int radio_idx;u8 rx_chains_static, rx_chains_dynamic;bool radar_enabled;
net/mac80211/chan.c +85 -11
174 lines not on this page · raw message
Signature · 1 line
2.44.0
Quoted 40 lines · Felix Fietkau
The prerequisite for MLO support in cfg80211/mac80211 is that all the links participating in MLO must be from the same wiphy/ieee80211_hw. To meet this expectation, some drivers may need to group multiple discrete hardware each acting as a link in MLO under single wiphy.
With this change, the bands and supported frequencies of each individual radio are reported to user space. This allows user space to figure out the limitations of what combination of channels can be used concurrently.Signed-off-by Felix Fietkau <[email protected]>--- include/net/cfg80211.h | 34 ++++++++++++++++ include/uapi/linux/nl80211.h | 48 +++++++++++++++++++++++ net/wireless/nl80211.c | 75 ++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+)include/net/cfg80211.h +17
-0@@ -5407,6 +5407,34 @@ struct wiphy_iftype_akm_suites {int n_akm_suites; }; +/** +* struct wiphy_radio_freq_range - wiphy frequency range +* @start_freq: start range edge frequency (kHz) +* @end_freq: end range edge frequency (kHz) +*/ +struct wiphy_radio_freq_range { +u32 start_freq; +u32 end_freq; +}; + + +/** +* struct wiphy_radio - This structure describes a physical radio belonging +* to a wiphy. It is used to describe concurrent-channel capabilities of the +* phy. Only one channel can be active on the radio described by struct +* wiphy_radio. +*
include/net/cfg80211.h struct wiphy_iftype_akm_suites { · line 5436
Quoted 10 lines
include/net/cfg80211.h +10
-0+* @band_mask: Mask of enum nl80211_band describing the bands that the radio +* can operate on. +* @num_freq_range: number of elements in @freq_range +* @freq_range: frequency range that the radio can operate on (optional) +*/ +struct wiphy_radio { +u16 band_mask; +u16 n_freq_range; +const struct wiphy_radio_freq_range *freq_range; +};
Do you think we might should add the radio_idx in here so that we don't depend on position in the array in case we need to add/remove radios for some reason?
Or radio MAC addr or some other more persistent way to detect exactly what this is in user-space?
Quoted 93 lines
include/net/cfg80211.h +7
-0+#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff/** @@ -5625,6 +5653,9 @@ struct wiphy_iftype_akm_suites {* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver * supports enabling HW timestamping for all peers (i.e. no need to * specify a mac address). +* +* @radio: radios belonging to this wiphy +* @n_radio: number of radios */ struct wiphy {struct mutex mtx;@@ -5775,6 +5806,9 @@ struct wiphy {u16 hw_timestamp_max_peers; +const struct wiphy_radio *radio; +int n_radio; +char priv[]__aligned(NETDEV_ALIGN) ; };include/uapi/linux/nl80211.h +48
-0@@ -3401,6 +3401,8 @@ enum nl80211_attrs {NL80211_ATTR_ASSOC_SPP_AMSDU , +NL80211_ATTR_RADIOS , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,@@ -7999,4 +8001,50 @@ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; +/** +* enum nl80211_wiphy_radio_attrs - wiphy radio attributes +* +* @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_ATTR_BAND_MASK: Bitmask of bands supported by this +* radio. +* +* @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES: Nested array of frequency ranges +* supported by this radio. +* +* @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_attrs { + __NL80211_WIPHY_RADIO_ATTR_INVALID, + +NL80211_WIPHY_RADIO_ATTR_BAND_MASK , +NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES , + +/* keep last */ + __NL80211_WIPHY_RADIO_ATTR_LAST, +NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST -1 , +}; + +/** +* enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start +* @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_freq_range { + __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID, + +NL80211_WIPHY_RADIO_FREQ_ATTR_START , +NL80211_WIPHY_RADIO_FREQ_ATTR_END , + + __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST, +NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST -1 , +}; +#endif /* __LINUX_NL80211_H */ net/wireless/nl80211.c +0
-0
net/wireless/nl80211.c static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) · line 2397
Quoted 6 lines
net/wireless/nl80211.c +3
-0@@ -2392,6 +2392,78 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)return -ENOBUFS ; } +static int nl80211_put_radio (struct wiphy *wiphy,struct sk_buff *msg,int idx) +{ +const struct wiphy_radio *r = &wiphy->radio[idx];
Maybe allow radio[] array to be sparse (ie, idx 0 is there, idx 2 is there, idx 1 is NULL because user wants to remove that radio from MLO consideration for whatever reason?
For what it's worth, I like the general approach.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Quoted 56 lines · Ben Greear
Quoted 40 lines · Felix Fietkau
The prerequisite for MLO support in cfg80211/mac80211 is that all the links participating in MLO must be from the same wiphy/ieee80211_hw. To meet this expectation, some drivers may need to group multiple discrete hardware each acting as a link in MLO under single wiphy.
With this change, the bands and supported frequencies of each individual radio are reported to user space. This allows user space to figure out the limitations of what combination of channels can be used concurrently.Signed-off-by Felix Fietkau <[email protected]>--- include/net/cfg80211.h | 34 ++++++++++++++++ include/uapi/linux/nl80211.h | 48 +++++++++++++++++++++++ net/wireless/nl80211.c | 75 ++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+)include/net/cfg80211.h +17
-0@@ -5407,6 +5407,34 @@ struct wiphy_iftype_akm_suites {int n_akm_suites; }; +/** +* struct wiphy_radio_freq_range - wiphy frequency range +* @start_freq: start range edge frequency (kHz) +* @end_freq: end range edge frequency (kHz) +*/ +struct wiphy_radio_freq_range { +u32 start_freq; +u32 end_freq; +}; + + +/** +* struct wiphy_radio - This structure describes a physical radio belonging +* to a wiphy. It is used to describe concurrent-channel capabilities of the +* phy. Only one channel can be active on the radio described by struct +* wiphy_radio. +* include/net/cfg80211.h struct wiphy_iftype_akm_suites { · line 5436
Quoted 10 lines
include/net/cfg80211.h +10
-0+* @band_mask: Mask of enum nl80211_band describing the bands that the radio +* can operate on. +* @num_freq_range: number of elements in @freq_range +* @freq_range: frequency range that the radio can operate on (optional) +*/ +struct wiphy_radio { +u16 band_mask; +u16 n_freq_range; +const struct wiphy_radio_freq_range *freq_range; +};Do you think we might should add the
radio_idxin here so that we don't depend on position in the array in case we need to add/remove radios for some reason?
Quoted 2 lines
Or radio MAC addr or some other more persistent way to detect exactly what this is in user-space?
Why would radios be added/removed at run time?
Quoted 95 lines
Quoted 95 lines
include/net/cfg80211.h +6
-0#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff/** @@ -5625,6 +5653,9 @@ struct wiphy_iftype_akm_suites {* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver * supports enabling HW timestamping for all peers (i.e. no need to * specify a mac address). +* +* @radio: radios belonging to this wiphy +* @n_radio: number of radios */ struct wiphy {struct mutex mtx;@@ -5775,6 +5806,9 @@ struct wiphy {u16 hw_timestamp_max_peers; +const struct wiphy_radio *radio; +int n_radio; +char priv[]__aligned(NETDEV_ALIGN) ; };include/uapi/linux/nl80211.h +48
-0@@ -3401,6 +3401,8 @@ enum nl80211_attrs {NL80211_ATTR_ASSOC_SPP_AMSDU , +NL80211_ATTR_RADIOS , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,@@ -7999,4 +8001,50 @@ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; +/** +* enum nl80211_wiphy_radio_attrs - wiphy radio attributes +* +* @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_ATTR_BAND_MASK: Bitmask of bands supported by this +* radio. +* +* @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES: Nested array of frequency ranges +* supported by this radio. +* +* @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_attrs { + __NL80211_WIPHY_RADIO_ATTR_INVALID, + +NL80211_WIPHY_RADIO_ATTR_BAND_MASK , +NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES , + +/* keep last */ + __NL80211_WIPHY_RADIO_ATTR_LAST, +NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST -1 , +}; + +/** +* enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start +* @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_freq_range { + __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID, + +NL80211_WIPHY_RADIO_FREQ_ATTR_START , +NL80211_WIPHY_RADIO_FREQ_ATTR_END , + + __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST, +NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST -1 , +}; +#endif /* __LINUX_NL80211_H */ net/wireless/nl80211.c +0
-0@@ -2392,6 +2392,78 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)return -ENOBUFS ; }
Quoted 6 lines
net/wireless/nl80211.c static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) · line 2397
Quoted 3 lines
net/wireless/nl80211.c +3
-0+static int nl80211_put_radio (struct wiphy *wiphy,struct sk_buff *msg,int idx) +{ +const struct wiphy_radio *r = &wiphy->radio[idx];Maybe allow radio[] array to be sparse (ie, idx 0 is there, idx 2 is there, idx 1 is NULL because user wants to remove that radio from MLO consideration for whatever reason?
Why should the user want to do this?
- Felix
Quoted 56 lines · Felix Fietkau
Quoted 55 lines · Ben Greear
Quoted 39 lines · Felix Fietkau
The prerequisite for MLO support in cfg80211/mac80211 is that all the links participating in MLO must be from the same wiphy/ieee80211_hw. To meet this expectation, some drivers may need to group multiple discrete hardware each acting as a link in MLO under single wiphy.
With this change, the bands and supported frequencies of each individual radio are reported to user space. This allows user space to figure out the limitations of what combination of channels can be used concurrently.Signed-off-by Felix Fietkau <[email protected]>---
include/net/cfg80211.h | 34 ++++++++++++++++include/uapi/linux/nl80211.h| 48 +++++++++++++++++++++++ net/wireless/nl80211.c | 75 ++++++++++++++++++++++++++++++++++++3 files changed, 157 insertions(+)include/net/cfg80211.h +17
-0@@ -5407,6 +5407,34 @@ struct wiphy_iftype_akm_suites { int n_akm_suites; }; +/** +* struct wiphy_radio_freq_range - wiphy frequency range +* @start_freq: start range edge frequency (kHz) +* @end_freq: end range edge frequency (kHz) +*/ +struct wiphy_radio_freq_range { + u32 start_freq; + u32 end_freq; +}; + + +/** +* struct wiphy_radio - This structure describes a physical radio belonging +* to a wiphy. It is used to describe concurrent-channel capabilities of the +* phy. Only one channel can be active on the radio described by struct +* wiphy_radio. +* include/net/cfg80211.h struct wiphy_iftype_akm_suites { · line 5435
Quoted 10 lines
include/net/cfg80211.h +10
-0+* @band_mask: Mask of enum nl80211_band describing the bands that the radio +* can operate on. +* @num_freq_range: number of elements in @freq_range +* @freq_range: frequency range that the radio can operate on (optional) +*/ +struct wiphy_radio { + u16 band_mask; + u16 n_freq_range; + const struct wiphy_radio_freq_range *freq_range; +};Do you think we might should add the
radio_idxin here so that we don't depend on position in the array in case we need to add/remove radios for some reason?
Quoted 4 lines
Quoted 2 lines
Or radio MAC addr or some other more persistent way to detect exactly what this is in user-space?
Why would radios be added/removed at run time?
I'm thinking I might want to have radio(s) work in legacy mode sometimes and then change to combined mode.
Another possibility is unrecoverable firmware/radio crashes, where maybe only one of them dies and so system could remove the wedged hardware from the radio list
if it cannot recover.
If putting radios in/out of combined mode is not feasible, then I will instead want to be able to pin legacy STA/VAP/monitor ports to specific radios. It would be nice if the radios could be reliably addressed from user-space without having to query the frequency band and use that as unique identifier. Especially if someone manages to make something like an mtk7996 that can do more than one radio per frequency range.
And, is the hardware discrete enough that if you had two mtk7996 3-radio NICs, could you actually do a 6-radio OFDMA configuration with a 'fake' virtual wiphy device to hold the underlying wiphys/radios? If so, having better radio identifier would be required at that point I think.
Quoted 94 lines
Quoted 85 lines
Quoted 85 lines
include/net/cfg80211.h +6
-0#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff /**@@ -5625,6 +5653,9 @@ struct wiphy_iftype_akm_suites {* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver * supports enabling HW timestamping for all peers (i.e. no need to * specify a mac address). +* +* @radio: radios belonging to this wiphy +* @n_radio: number of radios */ struct wiphy { struct mutex mtx;@@ -5775,6 +5806,9 @@ struct wiphy { u16 hw_timestamp_max_peers; + const struct wiphy_radio *radio; + int n_radio; + char priv[] __aligned(NETDEV_ALIGN); };include/uapi/linux/nl80211.h +48
-0@@ -3401,6 +3401,8 @@ enum nl80211_attrs { NL80211_ATTR_ASSOC_SPP_AMSDU, + NL80211_ATTR_RADIOS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,@@ -7999,4 +8001,50 @@ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; +/** +* enum nl80211_wiphy_radio_attrs - wiphy radio attributes +* +* @__NL80211_WIPHY_RADIO_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_ATTR_BAND_MASK: Bitmask of bands supported by this +* radio. +* +* @NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES: Nested array of frequency ranges +* supported by this radio. +* +* @__NL80211_WIPHY_RADIO_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_attrs { + __NL80211_WIPHY_RADIO_ATTR_INVALID, + + NL80211_WIPHY_RADIO_ATTR_BAND_MASK, + NL80211_WIPHY_RADIO_ATTR_FREQ_RANGES, + + /* keep last */ + __NL80211_WIPHY_RADIO_ATTR_LAST, + NL80211_WIPHY_RADIO_ATTR_MAX = __NL80211_WIPHY_RADIO_ATTR_LAST - 1, +}; + +/** +* enum nl80211_wiphy_radio_freq_range - wiphy radio frequency range +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID: Invalid +* +* @NL80211_WIPHY_RADIO_FREQ_ATTR_START: Frequency range start +* @NL80211_WIPHY_RADIO_FREQ_ATTR_END: Frequency range end +* +* @__NL80211_WIPHY_RADIO_FREQ_ATTR_LAST: Internal +* @NL80211_WIPHY_RADIO_FREQ_ATTR_MAX: Highest attribute +*/ +enum nl80211_wiphy_radio_freq_range { + __NL80211_WIPHY_RADIO_FREQ_ATTR_INVALID, + + NL80211_WIPHY_RADIO_FREQ_ATTR_START, + NL80211_WIPHY_RADIO_FREQ_ATTR_END, + + __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST, + NL80211_WIPHY_RADIO_FREQ_ATTR_MAX = __NL80211_WIPHY_RADIO_FREQ_ATTR_LAST - 1, +}; + #endif /* __LINUX_NL80211_H */net/wireless/nl80211.c +0
-0@@ -2392,6 +2392,78 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)Quoted 8 lines
net/wireless/nl80211.c static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) · line 2397
Quoted 5 lines
net/wireless/nl80211.c +3
-0return -ENOBUFS; } +static int nl80211_put_radio (struct wiphy *wiphy,struct sk_buff *msg,int idx) +{ + const struct wiphy_radio *r = &wiphy->radio[idx];Maybe allow radio[] array to be sparse (ie, idx 0 is there, idx 2 is there, idx 1 is NULL because user wants to remove that radio from MLO consideration for whatever reason?
Quoted 1 line
Why should the user want to do this?
unrecoverable radio failures and putting radio into legacy mode...
Thanks,
Ben
Quoted 3 lines
- Felix
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com