From patchwork Wed Jul 19 09:00:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Quan X-Patchwork-Id: 122477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2310948vqt; Wed, 19 Jul 2023 02:29:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlHd96TGiQdq8q4BAoH1849VlWCJmtRaIHQf3oDVUW5wUOKUD3GjpDgNacLCuOOv5Lj0oIik X-Received: by 2002:a05:6871:5224:b0:1b0:83f5:e82a with SMTP id ht36-20020a056871522400b001b083f5e82amr2252187oac.29.1689758944649; Wed, 19 Jul 2023 02:29:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689758944; cv=pass; d=google.com; s=arc-20160816; b=aupG3Vj6gZ25tnK7tvoysdXOaIOWSZ6tM6IjeosLlx4Ss+t4BKB7mjXl4o5h7QZLqw bXYq0JqmflC98jgPZxB35K6tSJCI+XNeXV3kkA8vrs1yEvw919F+l+R1x8K7AOJjN8+r PZN7M3VPxzT77lTqTUSYYG+cEhIo/hlWERUBBoBMJkiUtj/cX1T4J+6Fd2d4XfghouGM 7yLOYoRpZbS3pu6PESO014AFCJKZz2lAIYjkgooHZPy+2v5qvVJT4qvEoy9yYRxGYggx R9Fcpd2eoIjHphCiE6A72jQGhrhHpuObpNHsUzaNNqYn6THwp5Y8pll0R2PO1eoyAw2j qiSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5J0Cz5Cadlw65Bzx+SEzLMeK7AP7NhydWrQ7o5Xd/xE=; fh=WpfgbTJceSODJ2RxjBwoHNUpZn2apRLDTiiS5YGrd/M=; b=wizOotxzZ9fsEuV1HT/Dn8nbZWwAOMI68QprfufP5O0BPS0r/dC409rAfM9BY6zU1R ojjLYW3w8UeX1JN1VucLPJvhNn9F9XB2KOxaOf3v0a3DBcNjyMqV4l/Ylce6rVb2Mhma gurOz9A0QnCxyZ70qdlkKQRbBb0kHBEw65g3HL6ubn9MhSNfWeBRHCIUUFNMEYF44kna lJDzv9mt1XDzsTmbkJyMbxtA+dwox7YmEA1Rx2iPeXochAhZGMoXgKgVisI1w/y2m8sY 9+4at8VblwyMxiNGknmb4rblYeZf8DMmtIReUp0zU7ew1EoUS8cAsZA4DoBPyWgXHb2R g7cQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="OSVkfm/o"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a056a0023d000b006829969e393si3281026pfc.189.2023.07.19.02.28.51; Wed, 19 Jul 2023 02:29:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="OSVkfm/o"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231176AbjGSJDN (ORCPT + 99 others); Wed, 19 Jul 2023 05:03:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbjGSJCg (ORCPT ); Wed, 19 Jul 2023 05:02:36 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6372319F; Wed, 19 Jul 2023 02:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SxfaOX6I8Qm2pG4HxxpB0V7gOn8HABj8VNxPBwX/NcRdwAsT9UFnl7CBNdBs4533XHUiYc7Ac0WYb85aUIgRpv7fCrzFlUZyiHkwwsC3ivhFjRavixlLmAOyV9khIPQnEhoLl0cgLzihwlHOLdJtuYBnkh1daXa2j4jhWl4PLp1W6DkjSgRXK7uF0Wo9rdMyzKVhthy+PA17iHk4CMJyhW/PAmATJ64rn68WllqW8mFOwGvzmAtehtG1pN9ZZH6FScUM6EIoDOgoQFtdWZ/aOV/uKUce0WDyaVuN83UC/FzGzLpOGNSwtVOQnkgL7MKgX7LqYEfcG5Uwww2fcW9G/w== 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=5J0Cz5Cadlw65Bzx+SEzLMeK7AP7NhydWrQ7o5Xd/xE=; b=nlfO9XfA/g7kjw8E1GQVln51u2KMMa8YKC+jun3n3vRPHv/FLyGZK25oSmZmtAwlkNu2s5q7LiEgGoiXdnYYRj6Qh/aozcUuDscU2+ZurOEv9MWOMU5ZMkMomtytMF+t3wTSKKJwp/4CShoWXTaqHUwbdXbCXMcK4BLSMUMwakHRajdt4moTiz2KPpHtfJU/gerWQKHsCrgwaETh2FVIoXKs6PPbLcie5uMeE0TfvIaQMNMiszQgbb+N3fSBXrMfbMyWsGIpZHy+z5T8S8AZuK/pU4ZMz3Hp29I1wgSQtdiCPO4pn5VqtUF+wHWUIjagSUxBH2E+VC73fk67XtlvYA== 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=5J0Cz5Cadlw65Bzx+SEzLMeK7AP7NhydWrQ7o5Xd/xE=; b=OSVkfm/oOfXavHJoM4CAyabzYUAJK/2soTQ8ta/SKu/PUjfxP1JQMelPawRn5CVdQ26sv0ML6XKYdzmtTukVYlV0Wrcvw1dyR6H2kqU/tibyzUjgW8J39C1toIRnGshj04TVAovnQEinf476XJ1ZHeH3pQk3dBriixMrz4zpmv0= Received: from DS0PR17CA0014.namprd17.prod.outlook.com (2603:10b6:8:191::10) by SA1PR12MB7341.namprd12.prod.outlook.com (2603:10b6:806:2ba::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 09:02:30 +0000 Received: from DM6NAM11FT069.eop-nam11.prod.protection.outlook.com (2603:10b6:8:191:cafe::16) by DS0PR17CA0014.outlook.office365.com (2603:10b6:8:191::10) 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:30 +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 DM6NAM11FT069.mail.protection.outlook.com (10.13.173.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.35 via Frontend Transport; Wed, 19 Jul 2023 09:02:29 +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:10 -0500 From: Evan Quan To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , Evan Quan , Mario Limonciello Subject: [PATCH V7 4/9] wifi: mac80211: Add support for ACPI WBRF Date: Wed, 19 Jul 2023 17:00:15 +0800 Message-ID: <20230719090020.2716892-5-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: DM6NAM11FT069:EE_|SA1PR12MB7341:EE_ X-MS-Office365-Filtering-Correlation-Id: 35d972cc-24cf-4314-dfee-08db8836e1c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YFG3ssqBdL4zeRiUeSRKmWuvEpwe6MZMkM+EZLyA0MYWmRdImcFG811/eiesXSKf1Lfp3tXudn0+2nPFEAYVmd05l3IzVnSJZvDpHUIYOqvMXk9qPSmFrgVI8tGid6+4EhansnLruZ4Nq0FsZBI42C2hcz9lMO1D8zuDKJI1f4HcWQQD4DHYERvWbMI+Bk0eoQo99SwsseG04DqsKViacBVa30AfoOiYA+NWubHXcmiO/jcTA9rND3IjoLxJVxhJv5JGV9tAo/32aKBZHL1ypzEKzmiwyqmvbWtoG1uyxZ7OlUBLixwMd/mSMw7OaIE0CWNSt1XcyDZmv0dkg8t70T74vsz2I7GvXiMsBPyZwb+kfhfKmG2tASzSfDA6KmwBP2hoS+3MdU+mxqujqD5m6ckuuDjdrFgx2X8Z/8+akBXy5gVwNKLffvruP5wanhrGgXiotwJ6HIBbtHRDHTQaQUOq6FjT7FKT2fS1HbrCuCUBHwOZpEbQ56zjZFmzEsC1niN+I1nKoolQipJF7lAKYdVl70/QR0uqqAiObo66U65AQIMyfxRn53sgia9/s6bzfufEHn5z0b+okUpomjLMFEuTyzzeP0RlMiVLemERUGgJ/gGDIcKRUpR9MHJ2Fk2Lq6aN/7m4neHw8WOUJuv/hT/du07omV3j2ksh5IyHmNixDYcHe4E8QuDRNoaOudKUKmlY0boUDjmwXIuDMyv08UmA4uQ505C4X61qg8HEAzWSQhU8N2DhBcTHamjdfKfWTN6mAzmwkf7sJA2+b0Skk+Ly4IUeRwyDeX7zjk7LhxuArCvZc8orQ+6BK59rFTwTW8FhV8g+Os4kSnnSUSftFw== 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)(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:29.9597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35d972cc-24cf-4314-dfee-08db8836e1c3 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: DM6NAM11FT069.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7341 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771840674845640638 X-GMAIL-MSGID: 1771840674845640638 To support AMD's WBRF interference mitigation mechanism, Wifi adapters utilized in the system must register the frequencies in use(or unregister those frequencies no longer used) via the dedicated APCI calls. So that, other drivers responding to the frequencies can take proper actions to mitigate possible interference. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Co-developed-by: Evan Quan Signed-off-by: Evan Quan --- v1->v2: - place the new added member(`wbrf_supported`) in ieee80211_local(Johannes) - handle chandefs change scenario properly(Johannes) - some minor fixes around code sharing and possible invalid input checks(Johannes) v2->v3: - drop unnecessary input checks and intermediate APIs(Mario) - Separate some mac80211 common code(Mario, Johannes) v3->v4: - some minor fixes around return values(Johannes) --- include/linux/ieee80211.h | 1 + net/mac80211/Makefile | 2 + net/mac80211/chan.c | 9 ++++ net/mac80211/ieee80211_i.h | 19 +++++++ net/mac80211/main.c | 2 + net/mac80211/wbrf.c | 103 +++++++++++++++++++++++++++++++++++++ 6 files changed, 136 insertions(+) create mode 100644 net/mac80211/wbrf.c diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index c4cf296e7eaf..0703921547f5 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -4319,6 +4319,7 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size) /* convert frequencies */ #define MHZ_TO_KHZ(freq) ((freq) * 1000) #define KHZ_TO_MHZ(freq) ((freq) / 1000) +#define KHZ_TO_HZ(freq) ((freq) * 1000) #define PR_KHZ(f) KHZ_TO_MHZ(f), f % 1000 #define KHZ_F "%d.%03d" diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index b8de44da1fb8..8f8ac567e7c8 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile @@ -65,4 +65,6 @@ rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += \ mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) +mac80211-$(CONFIG_WBRF) += wbrf.o + ccflags-y += -DDEBUG diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 77c90ed8f5d7..9887471028dc 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -506,11 +506,16 @@ static void _ieee80211_change_chanctx(struct ieee80211_local *local, WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef)); + ieee80211_remove_wbrf(local, &ctx->conf.def); + ctx->conf.def = *chandef; /* check if min chanctx also changed */ changed = IEEE80211_CHANCTX_CHANGE_WIDTH | _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for); + + ieee80211_add_wbrf(local, &ctx->conf.def); + drv_change_chanctx(local, ctx, changed); if (!local->use_chanctx) { @@ -668,6 +673,8 @@ static int ieee80211_add_chanctx(struct ieee80211_local *local, lockdep_assert_held(&local->mtx); lockdep_assert_held(&local->chanctx_mtx); + ieee80211_add_wbrf(local, &ctx->conf.def); + if (!local->use_chanctx) local->hw.conf.radar_enabled = ctx->conf.radar_enabled; @@ -748,6 +755,8 @@ static void ieee80211_del_chanctx(struct ieee80211_local *local, } ieee80211_recalc_idle(local); + + ieee80211_remove_wbrf(local, &ctx->conf.def); } static void ieee80211_free_chanctx(struct ieee80211_local *local, diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4159fb65038b..fb984ce7038c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1591,6 +1591,10 @@ struct ieee80211_local { /* extended capabilities provided by mac80211 */ u8 ext_capa[8]; + +#if IS_ENABLED(CONFIG_WBRF) + bool wbrf_supported; +#endif }; static inline struct ieee80211_sub_if_data * @@ -2615,4 +2619,19 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata, const struct ieee80211_eht_cap_elem *eht_cap_ie_elem, u8 eht_cap_len, struct link_sta_info *link_sta); + +#if IS_ENABLED(CONFIG_WBRF) +void ieee80211_check_wbrf_support(struct ieee80211_local *local); +void ieee80211_add_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef); +void ieee80211_remove_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef); +#else +static inline void ieee80211_check_wbrf_support(struct ieee80211_local *local) { } +static inline void ieee80211_add_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef) { } +static inline void ieee80211_remove_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef) { } +#endif /* CONFIG_WBRF */ + #endif /* IEEE80211_I_H */ diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 55cdfaef0f5d..0a55626b1546 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1395,6 +1395,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) debugfs_hw_add(local); rate_control_add_debugfs(local); + ieee80211_check_wbrf_support(local); + rtnl_lock(); wiphy_lock(hw->wiphy); diff --git a/net/mac80211/wbrf.c b/net/mac80211/wbrf.c new file mode 100644 index 000000000000..7ddb29d128b1 --- /dev/null +++ b/net/mac80211/wbrf.c @@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Wifi Band Exclusion Interface for WWAN + * Copyright (C) 2023 Advanced Micro Devices + * + */ + +#include +#include +#include "ieee80211_i.h" + +void ieee80211_check_wbrf_support(struct ieee80211_local *local) +{ + struct wiphy *wiphy = local->hw.wiphy; + struct device *dev; + + if (!wiphy) + return; + + dev = wiphy->dev.parent; + if (!dev) + return; + + local->wbrf_supported = wbrf_supported_producer(dev); + dev_dbg(dev, "WBRF is %s supported\n", + local->wbrf_supported ? "" : "not"); +} + +static void get_chan_freq_boundary(u32 center_freq, + u32 bandwidth, + u64 *start, + u64 *end) +{ + bandwidth = MHZ_TO_KHZ(bandwidth); + center_freq = MHZ_TO_KHZ(center_freq); + + *start = center_freq - bandwidth / 2; + *end = center_freq + bandwidth / 2; + + /* Frequency in HZ is expected */ + *start = KHZ_TO_HZ(*start); + *end = KHZ_TO_HZ(*end); +} + +static void wbrf_get_ranges_from_chandef(struct cfg80211_chan_def *chandef, + struct wbrf_ranges_in *ranges_in) +{ + u64 start_freq1, end_freq1; + u64 start_freq2, end_freq2; + int bandwidth; + + bandwidth = nl80211_chan_width_to_mhz(chandef->width); + + get_chan_freq_boundary(chandef->center_freq1, + bandwidth, + &start_freq1, + &end_freq1); + + ranges_in->band_list[0].start = start_freq1; + ranges_in->band_list[0].end = end_freq1; + + if (chandef->width == NL80211_CHAN_WIDTH_80P80) { + get_chan_freq_boundary(chandef->center_freq2, + bandwidth, + &start_freq2, + &end_freq2); + + ranges_in->band_list[1].start = start_freq2; + ranges_in->band_list[1].end = end_freq2; + } +} + +void ieee80211_add_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef) +{ + struct wbrf_ranges_in ranges_in = {0}; + struct device *dev; + + if (!local->wbrf_supported) + return; + + dev = local->hw.wiphy->dev.parent; + + wbrf_get_ranges_from_chandef(chandef, &ranges_in); + + wbrf_add_exclusion(dev, &ranges_in); +} + +void ieee80211_remove_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef) +{ + struct wbrf_ranges_in ranges_in = {0}; + struct device *dev; + + if (!local->wbrf_supported) + return; + + dev = local->hw.wiphy->dev.parent; + + wbrf_get_ranges_from_chandef(chandef, &ranges_in); + + wbrf_remove_exclusion(dev, &ranges_in); +}