From patchwork Wed Jul 19 09:00:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Quan X-Patchwork-Id: 705006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F1EBC0015E for ; Wed, 19 Jul 2023 09:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbjGSJCr (ORCPT ); Wed, 19 Jul 2023 05:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbjGSJCa (ORCPT ); Wed, 19 Jul 2023 05:02:30 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9578F2682; Wed, 19 Jul 2023 02:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kr3GRnIjecA5ZkCRS1clnePbbdRkCtTaVQmS0ixJNq3Wj27UufElnKftn1e+ihCO7jj1UBsSLXpIPEwbaDgyhW580ishR3zjjt5jkPxpDnLRNWF/YElE2DaC2yZPSbT4y0QTLdAnRWx0VQXzXbLzAuvNm5FHkfQ3QlvQQ7XNEchpjb2pXgOQz4YP3prZFcOGuqUBNi0MMnbB3uD9S0rWlmu4iB0dZdj484ye6YI6aHL4s4ozN+l2xnY9ZftHrahoGHRlayq6qhTGjSntD+15KbWQHE8q4zTnL0LbFSgi7YbsSWI+u4MON1iNMd+mvt6hQB25jhRYhrHm0Ub9AdlmKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V2W7MeeYoJAjHpnZBPrbz+KWPIKBQOAP/ttwqdtMG0c=; b=c1Q7ToFbfZjBprJ6hIqirOeEh+bMZEoCjdUOEI5SBUyJlinpIBcROkIwnDLX9oQBPNpMlfDJPWJLy9PqHhvLbfgU+XGkLUoqUAc7MnhUhbgpn6QXovFhiwRQzNq3TomesETI+Tx4Iw0AUF7cYfjvzRC2PA6H2NUWuIdlGGacUYVyeUISlIJoXhz5Rgjp6fvxOGajvz5JSB4dtFTbEfG7dR2h4ocz89ZHI1xyFSCNTitNoqrtBfZ0rlqKJejEg1MvlG/OR5R88kMBP+oA0ryahtmdTAvgSYvf7h+XxtIJIMC6BK1VetjSh+ooEOctNrfKhfD9bgUv4cjxgkSGgg3+mQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V2W7MeeYoJAjHpnZBPrbz+KWPIKBQOAP/ttwqdtMG0c=; b=pvXT7HyrCiS2MaTiL95EYKwZ+h4t2kKC+59z69pSLo6VUC1aPpcFaUoLFHU41oRFc9koTkzyElzpUqBY+7g6CiLr0V9AeQzq8yg8V7Gg2EguCmuGHmj7fnFhEnVnHZisowgcNUTL2RRoj7eSG7+X/fVeQIuATGfd6tSIpwDqLj8= Received: from DM6PR02CA0134.namprd02.prod.outlook.com (2603:10b6:5:1b4::36) by SN7PR12MB7912.namprd12.prod.outlook.com (2603:10b6:806:341::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Wed, 19 Jul 2023 09:02:11 +0000 Received: from DM6NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::32) by DM6PR02CA0134.outlook.office365.com (2603:10b6:5:1b4::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 09:02:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT008.mail.protection.outlook.com (10.13.172.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.33 via Frontend Transport; Wed, 19 Jul 2023 09:02:10 +0000 Received: from equan-buildpc.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 19 Jul 2023 04:02:01 -0500 From: Evan Quan To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Evan Quan Subject: [PATCH V7 3/9] cfg80211: expose nl80211_chan_width_to_mhz for wide sharing Date: Wed, 19 Jul 2023 17:00:14 +0800 Message-ID: <20230719090020.2716892-4-evan.quan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230719090020.2716892-1-evan.quan@amd.com> References: <20230719090020.2716892-1-evan.quan@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT008:EE_|SN7PR12MB7912:EE_ X-MS-Office365-Filtering-Correlation-Id: 69e64922-df82-4643-0409-08db8836d65e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XkqYWIHyvW+yhVC9sD+wM6uRybl6on0CtwZxllqw1pLj2+/Ih1aey9A39IT/bIaILEDSqt7TnhuZKn2UO4RvWb3w9ebgYXL5OUK93Gk2VpLIR7g6Juvs7njz7GtaJ2+C043rtkpZug834uV8yDszbLpqz5uqpqsKFO40H23qe3Z+e4i0TlThwAtNw1voUJ5nLpgapGcRG1o4y7IQmg/JkGsMEJfOkxBNog4bR54/tsAHetWSp5VXz0t4czIW3q8IFRcb2vdX6PCwYdZwUiXjjfZ3EZJQaLF5SaGpQ9VfKu2fWBeAqsvZwnpuoIPzeS+lPqpB0CTkAdEiXfHMB3UEO849HkPwVNG+LJINIXPLe4eP9xVdFNvOPq+sozsydrvSv3aAVbwpNWc49eD2HoHGUedl+KTMvVrWirD1K4QMFq797dM3TMitBgsoNTBsiSelqQdJT1DMLdp4SGg3AfLThAKVujROi3uE+4xjaZrNuFk3Pt2JJ9/z5Esg3cG1RuMX7sL491+6ov2swLhCwT+gH+j1qnCwBJCq/dtVxNAmzSQs9NcCKil0GhO7BF0C0uAu9HX+Hh2PLvcqRgW0uFzHdzWR8+e7Jz0VnHw1onOoxoZMtcGEfvXHqs9Zq/+msxGbaXZ9etohLw7GjP76mqA1be9vPWyO9J2Q7+OrGNpljeSNNPalqlx+/bgUqMy28kVSkdLHQxwiSEp9moC/ZABshWwg7LD7pvmE/xiX3HegSrI1yDBZOFkLwjE1Si7uQW7GP3FFsxLovd4h9h7REWb12ql/p2Gjwo4F93fQBwKxeN2ZLFYSYR/Kn5gJZpvc2WB7yBA87w+V/RXlOPp+b3Y+8A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(39860400002)(396003)(136003)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(2906002)(110136005)(478600001)(921005)(356005)(186003)(81166007)(426003)(82740400003)(336012)(47076005)(16526019)(2616005)(83380400001)(5660300002)(1076003)(36860700001)(26005)(40480700001)(40460700003)(86362001)(36756003)(8676002)(4326008)(44832011)(7416002)(7696005)(54906003)(6666004)(316002)(70586007)(8936002)(70206006)(41300700001)(83996005)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 09:02:10.8216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69e64922-df82-4643-0409-08db8836d65e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7912 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The newly added WBRF feature needs this interface for channel width calculation. Signed-off-by: Evan Quan --- include/net/cfg80211.h | 8 ++++++++ net/wireless/chan.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9e04f69712b1..c6dc337eafce 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -920,6 +920,14 @@ const struct cfg80211_chan_def * cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, const struct cfg80211_chan_def *chandef2); +/** + * nl80211_chan_width_to_mhz - get the channel width in Mhz + * @chan_width: the channel width from &enum nl80211_chan_width + * Return: channel width in Mhz if the chan_width from &enum nl80211_chan_width + * is valid. -1 otherwise. + */ +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_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 0b7e81db383d..227db04eac42 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -141,7 +141,7 @@ static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef) return true; } -static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) { int mhz; @@ -190,6 +190,7 @@ static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) } return mhz; } +EXPORT_SYMBOL(nl80211_chan_width_to_mhz); static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c) {