From patchwork Mon Jul 1 14:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 13718191 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6913A1662EA for ; Mon, 1 Jul 2024 14:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.4.11.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719843219; cv=none; b=tjw7udtoUqYFRQONIUQmdoY/owiXFwlh5nOwI1ikq1WWS9seYbA3lNeZmOhnelvTvU15PDYXM+2Sj9iXKrK1Tb7EdE41KFlVTzEUgq8m/68yH+AfsWF8myALNppJaCBcjm0JTGpB2lBBZh6DvU9hSVopmOzoEvpzrdv6gecDbR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719843219; c=relaxed/simple; bh=/x8vSRP9mp8qSAw7ijmRsqkuwPSZczOAjaG0Yw/3uGg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UhDB4ir2Us4Cu6fusU1vQ9FieYfJYubP1CCkzoGK9A0GEFeb0Xo3+9oLVJN6JteLq2z4o0MtpjBCbX4lOYcyoPhMpMYpEPIsfy49h+5eIbFflM8YtNGr5wzs+QhTTC3IUgKa5H31JRaGjrIxkNJlPUEoRdg54rAh/mdZxg3QDPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name; spf=none smtp.mailfrom=nbd.name; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b=YgujSCzC; arc=none smtp.client-ip=46.4.11.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="YgujSCzC" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ljvmssrUl7RQrm7QjojuFjX9032UjCCXqzcK657IbnU=; b=YgujSCzCZBtc7/cBAQXihK8sYO HLhYcnVgrKd8jfZ2FClDcHWwydeZiF4IbgJRstD0sT/vubsnCvFGdTyXOLoZ2LvoCIcANMVy+BnAf TIhVT8OheQscD8scv+Invvrb4RIwxUUyh3b8ec4E7bNJMEb9I0SX1BqO8tQQf4DKFqvI=; Received: from p4ff13dca.dip0.t-ipconnect.de ([79.241.61.202] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.96) (envelope-from ) id 1sOHmZ-001Qfu-2f; Mon, 01 Jul 2024 16:13:27 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, quic_adisi@quicinc.com, quic_periyasa@quicinc.com, ath12k@lists.infradead.org Subject: [PATCH v3 05/10] wifi: mac80211: add support for DFS with multiple radios Date: Mon, 1 Jul 2024 16:13:20 +0200 Message-ID: <61899e29de4e0f5437643d578999d2a3d4d7d7b2.1719843147.git-series.nbd@nbd.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DFS can be supported with multi-channel combinations, as long as each DFS capable radio only supports one channel. Signed-off-by: Felix Fietkau --- net/mac80211/main.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 7578ea56c12f..58bebfdaa062 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1091,6 +1091,21 @@ static int ieee80211_init_cipher_suites(struct ieee80211_local *local) return 0; } +static bool +ieee80211_ifcomb_check_radar(const struct ieee80211_iface_combination *comb, + int n_comb) +{ + int i; + + /* DFS is not supported with multi-channel combinations yet */ + for (i = 0; i < n_comb; i++, comb++) + if (comb->radar_detect_widths && + comb->num_different_channels > 1) + return false; + + return true; +} + int ieee80211_register_hw(struct ieee80211_hw *hw) { struct ieee80211_local *local = hw_to_local(hw); @@ -1177,17 +1192,18 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) if (comb->num_different_channels > 1) return -EINVAL; } - } else { - /* 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]; + } else if (hw->wiphy->n_radio) { + for (i = 0; i < hw->wiphy->n_radio; i++) { + const struct wiphy_radio *radio = &hw->wiphy->radio[i]; - if (comb->radar_detect_widths && - comb->num_different_channels > 1) + if (!ieee80211_ifcomb_check_radar(radio->iface_combinations, + radio->n_iface_combinations)) return -EINVAL; } + } else { + if (!ieee80211_ifcomb_check_radar(hw->wiphy->iface_combinations, + hw->wiphy->n_iface_combinations)) + return -EINVAL; } /* Only HW csum features are currently compatible with mac80211 */