1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 6 Jun 2024 12:19:08 +0200
3 Subject: [PATCH] wifi: mac80211: add support for DFS with multiple
6 DFS can be supported with multi-channel combinations, as long as each DFS
7 capable radio only supports one channel.
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 --- a/net/mac80211/main.c
13 +++ b/net/mac80211/main.c
14 @@ -1084,6 +1084,27 @@ static int ieee80211_init_cipher_suites(
19 +ieee80211_ifcomb_check(const struct ieee80211_iface_combination *c, int n_comb)
23 + for (i = 0; i < n_comb; i++, c++) {
24 + /* DFS is not supported with multi-channel combinations yet */
25 + if (c->radar_detect_widths &&
26 + c->num_different_channels > 1)
29 + /* mac80211 doesn't support more than one IBSS interface */
30 + for (j = 0; j < c->n_limits; j++)
31 + if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
32 + c->limits[j].max > 1)
39 int ieee80211_register_hw(struct ieee80211_hw *hw)
41 struct ieee80211_local *local = hw_to_local(hw);
42 @@ -1173,17 +1194,20 @@ int ieee80211_register_hw(struct ieee802
43 if (comb->num_different_channels > 1)
47 - /* DFS is not supported with multi-channel combinations yet */
48 - for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
49 - const struct ieee80211_iface_combination *comb;
52 - comb = &local->hw.wiphy->iface_combinations[i];
53 + if (hw->wiphy->n_radio) {
54 + for (i = 0; i < hw->wiphy->n_radio; i++) {
55 + const struct wiphy_radio *radio = &hw->wiphy->radio[i];
57 - if (comb->radar_detect_widths &&
58 - comb->num_different_channels > 1)
59 + if (!ieee80211_ifcomb_check(radio->iface_combinations,
60 + radio->n_iface_combinations))
64 + if (!ieee80211_ifcomb_check(hw->wiphy->iface_combinations,
65 + hw->wiphy->n_iface_combinations))
69 /* Only HW csum features are currently compatible with mac80211 */
70 @@ -1313,18 +1337,6 @@ int ieee80211_register_hw(struct ieee802
71 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
72 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
74 - /* mac80211 doesn't support more than one IBSS interface right now */
75 - for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
76 - const struct ieee80211_iface_combination *c;
79 - c = &hw->wiphy->iface_combinations[i];
81 - for (j = 0; j < c->n_limits; j++)
82 - if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
83 - c->limits[j].max > 1)
87 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
88 sizeof(void *) * channels, GFP_KERNEL);