From patchwork Tue Mar 11 11:25:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 14011522 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 1AA342505AF for ; Tue, 11 Mar 2025 11:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741692350; cv=none; b=JrtrPVZBPFhURMmAqraqsnblwpUxSJEeOOBmVnvciYdvirooglpVzX2yJbNWlTKP0vZepneg5pjLnFykpd22VdqeM4mfFUr1cJ4BhvfaQBnF/CW46sR7akc0FbZKH8MPNkcam5KiiML66jl0iBNkY4plov5B6aBDGz3gK/YG/hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741692350; c=relaxed/simple; bh=qmV/51nMzil95N7jO2Vss5glDfmbd2sGisxzrHlUOeo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BFv0PrKFcrUS15mwfC4WIeNd9dFC7eENsoANhkQo5+k7rkPBgencc/sg9lRp3elwJM/PV/znJqAyNuOMRvms/RjrrR+wCjEog5mFL+jeXns31Ah44KGs63BlN2hmsOMwK+DPLfK4qjsaUj8LU327sD6/42Zv61nNfdWBxsA2Gns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=XPYcaLPE; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="XPYcaLPE" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=DG8hw/8mcxksQnUVaY4542MmKEpS5h2wXccKasru3JM=; t=1741692349; x=1742901949; b=XPYcaLPEWAH2MJTDtqAQdIqmPR6mUkeFabCcglPMkOmH5ZuyZF+qsZ3PeUyWC9EpEYAZ/L3nHv+ bzr/BgWkBND5pq2ZgSb+iekrynrgJoAfv6MMgrkm/1Xj+zteywwmOUXUlvUc+QdLUziiIvs8ziLsq FbPzdTRCf8nVI++ljSjjMGu3gnrnYqglvfyjPwQ07Uj/4vC26A+FHT57LBoDDscUWpqnT74Xp7WJr q+YNg3XuuBaH/HOwnVlds7XldMQi/JSeYe6B+xLeWc65i7Da27EYYQK4vqnCwpGkBfcCpG0eA1/8R 8VjrHQqBQwsd6tlfFIQYefTPpZ72rim2p1ag==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.98) (envelope-from ) id 1trxk1-00000007pEA-4825; Tue, 11 Mar 2025 12:25:46 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless-next 1/2] wifi: cfg80211: expose cfg80211_chandef_get_width() Date: Tue, 11 Mar 2025 12:25:34 +0100 Message-ID: <20250311122534.c5c3b4af9a74.Ib25cf60f634dc359961182113214e5cdc3504e9c@changeid> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg This can be just a trivial inline, to simplify some code. Expose it, and also use it in util.c where it wasn't previously available. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- include/net/cfg80211.h | 11 +++++++++++ net/wireless/chan.c | 5 ----- net/wireless/util.c | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 73f0e75cc814..efbd79c67be2 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1008,6 +1008,17 @@ cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, */ int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width); +/** + * cfg80211_chandef_get_width - return chandef width in MHz + * @c: chandef to return bandwidth for + * Return: channel width in MHz for the given chandef; note that it returns + * 80 for 80+80 configurations + */ +static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c) +{ + return nl80211_chan_width_to_mhz(c->width); +} + /** * cfg80211_chandef_valid - check if a channel definition is valid * @chandef: the channel definition to check diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 4cdb74a3f38c..193734b7f9dc 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -55,11 +55,6 @@ void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, } EXPORT_SYMBOL(cfg80211_chandef_create); -static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c) -{ - return nl80211_chan_width_to_mhz(c->width); -} - static u32 cfg80211_get_start_freq(const struct cfg80211_chan_def *chandef, u32 cf) { diff --git a/net/wireless/util.c b/net/wireless/util.c index 60157943d351..ed868c0f7ca8 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -5,7 +5,7 @@ * Copyright 2007-2009 Johannes Berg * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2017 Intel Deutschland GmbH - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2023, 2025 Intel Corporation */ #include #include @@ -2908,7 +2908,7 @@ bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio, u32 freq, width; freq = ieee80211_chandef_to_khz(chandef); - width = nl80211_chan_width_to_mhz(chandef->width); + width = cfg80211_chandef_get_width(chandef); if (!ieee80211_radio_freq_range_valid(radio, freq, width)) return false; From patchwork Tue Mar 11 11:25:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 14011523 X-Patchwork-Delegate: johannes@sipsolutions.net Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 79D40254866 for ; Tue, 11 Mar 2025 11:25:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741692352; cv=none; b=JOenOd1p9E2Wf+Gizrgbl3BefBzstahQ9eFcf4/FirQM9xngeHg32mZeVlx/kgbpmKMjFJ1/SAq0z6SBLDVpe4y+Kejq9v2JJU7fMcqpDZ1c0WkteXFaFESK0wLcma05jNQxVqqNfwBHn+fF9Bc+eduAHFMJpebk3HjpkxXnXdc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741692352; c=relaxed/simple; bh=RcpSIGeCFjU2WQ3OaAGIrqrD4Gebkr6we94BDK88jak=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lx+B3ZvL+ypRORnMnhhqlUznqz5r1EIUpPzjLC+fM3dfLF5a1bqj04sYh+jM3Qvyq9vzYPLlF7xAxSJ0G1ysDDm7/DhQqFG2WwF5SaAQcUjJrdfN4L1nUuvk4orTe0iO11eh463mLZAAPF2UFIARz3UlLRSvQdWCKTxoPvWN9iA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=w6MsRvmh; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="w6MsRvmh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=IJMYeVJVn6kaiIhFUayKGm4J3PT8SSJ7YIb5R21OePY=; t=1741692350; x=1742901950; b=w6MsRvmhmwVWRVvUWvi4Lueg7WUeGwZjDVYei0DGXI4dxjA 1RxeiCVPZaGZbBFzTxT2hgRHEWLVU3URYoKDKyAOUDFUzAuwYmvm9zP5v3IZgp00knUxR2TLdj/0e GfNEw9FhtHudFyMI1Qkvf+aLgB+YX3qa7BfCW+wHM9vUd8g1OPb2a/x7y2W91G3ga5VLwfIgsUh6Q MRj8hm2QberEdXgDOfj6FRLoLw7M1UWYV0fMBw5rd4Viky+NWov9qoJjyCqyQqcA3b2YazvkurBVR tK8MXWSQ6tysYnoElnp8rqVgfOcu+Yj7gMSJR/BUHl7H3yN5q2Nc3fSRo/kI46VA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.98) (envelope-from ) id 1trxk3-00000007pEA-0Zsf; Tue, 11 Mar 2025 12:25:47 +0100 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless-next 2/2] wifi: mac80211: use cfg80211_chandef_get_width() Date: Tue, 11 Mar 2025 12:25:35 +0100 Message-ID: <20250311122534.0a1d24a1a763.I51a52a67587a7eee65c80b9c5cf132820ebb9dd9@changeid> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250311122534.c5c3b4af9a74.Ib25cf60f634dc359961182113214e5cdc3504e9c@changeid> References: <20250311122534.c5c3b4af9a74.Ib25cf60f634dc359961182113214e5cdc3504e9c@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg We can now use this helper here and simplify some code. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 2 +- net/mac80211/wbrf.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index bfd3653a5b84..59acacfaaa73 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -788,7 +788,7 @@ static int ieee80211_chandef_num_subchans(const struct cfg80211_chan_def *c) if (c->width == NL80211_CHAN_WIDTH_80P80) return 4 + 4; - return nl80211_chan_width_to_mhz(c->width) / 20; + return cfg80211_chandef_get_width(c) / 20; } static int ieee80211_chandef_num_widths(const struct cfg80211_chan_def *c) diff --git a/net/mac80211/wbrf.c b/net/mac80211/wbrf.c index 3a8612309137..478b34b81919 100644 --- a/net/mac80211/wbrf.c +++ b/net/mac80211/wbrf.c @@ -2,6 +2,7 @@ /* * Wifi Band Exclusion Interface for WLAN * Copyright (C) 2023 Advanced Micro Devices + * Copyright (C) 2025 Intel Corporation * */ @@ -45,7 +46,7 @@ static void get_ranges_from_chandef(struct cfg80211_chan_def *chandef, u64 start_freq2, end_freq2; int bandwidth; - bandwidth = nl80211_chan_width_to_mhz(chandef->width); + bandwidth = cfg80211_chandef_get_width(chandef); get_chan_freq_boundary(chandef->center_freq1, bandwidth, &start_freq1, &end_freq1);