Allow some multi-channel interface combinations along with
DFS master support, if there is only a single AP/GO.

Allowing other interface types at the same time is fine
(as long as the device supports them), and doesn't require
additional code.

Update ieee80211_dfs_radar_detected_work() to consider
this case, and look specifically for the chanctx with
radar_enabled.

Signed-off-by: Eliad Peller <el...@wizery.com>
---
 net/mac80211/main.c | 11 -----------
 net/mac80211/util.c |  3 +++
 net/wireless/core.c | 23 +++++++++++++++++------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d9ce336..78d8c6d 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -792,17 +792,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                 */
                if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
                        return -EINVAL;
-
-               /* DFS is not supported with multi-channel combinations yet */
-               for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
-                       const struct ieee80211_iface_combination *comb;
-
-                       comb = &local->hw.wiphy->iface_combinations[i];
-
-                       if (comb->radar_detect_widths &&
-                           comb->num_different_channels > 1)
-                               return -EINVAL;
-               }
        }
 
        /* Only HW csum features are currently compatible with mac80211 */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 974ebe7..61affe6 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2625,6 +2625,9 @@ void ieee80211_dfs_radar_detected_work(struct work_struct 
*work)
                if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER)
                        continue;
 
+               if (!ctx->conf.radar_enabled)
+                       continue;
+
                num_chanctx++;
                chandef = ctx->conf.def;
        }
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 4910758..8bcadd9 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -453,7 +453,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
        int i, j;
 
        for (i = 0; i < wiphy->n_iface_combinations; i++) {
-               u32 cnt = 0;
+               u32 cnt = 0, dfs_cnt = 0;
                u16 all_iftypes = 0;
 
                c = &wiphy->iface_combinations[i];
@@ -477,11 +477,6 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
                                CFG80211_MAX_NUM_DIFFERENT_CHANNELS))
                        return -EINVAL;
 
-               /* DFS only works on one channel. */
-               if (WARN_ON(c->radar_detect_widths &&
-                           (c->num_different_channels > 1)))
-                       return -EINVAL;
-
                if (WARN_ON(!c->n_limits))
                        return -EINVAL;
 
@@ -505,6 +500,22 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
                                    c->limits[j].max > 1))
                                return -EINVAL;
 
+                       if (types & (BIT(NL80211_IFTYPE_AP) |
+                                    BIT(NL80211_IFTYPE_P2P_GO) |
+                                    BIT(NL80211_IFTYPE_ADHOC) |
+                                    BIT(NL80211_IFTYPE_MESH_POINT))) {
+                               dfs_cnt += c->limits[j].max;
+
+                               /*
+                                * Multiple DFS masters on multiple channels
+                                * are not supported yet.
+                                */
+                               if (WARN_ON(c->radar_detect_widths &&
+                                           c->num_different_channels > 1 &&
+                                           dfs_cnt > 1))
+                                       return -EINVAL;
+                       }
+
                        cnt += c->limits[j].max;
                        /*
                         * Don't advertise an unsupported type
-- 
1.8.5.1.109.g3d252a9

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to