Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp77732yba; Mon, 20 May 2019 05:19:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR33Z9AgGdMHAXs3nv1InI4gK/8aIUC0wIu58JeBribBMbFml74jQOJCfVeduFFyMK5P/T X-Received: by 2002:aa7:83d4:: with SMTP id j20mr59010406pfn.90.1558354742558; Mon, 20 May 2019 05:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558354742; cv=none; d=google.com; s=arc-20160816; b=mms3BWxjej54Bmcp2gp6oeqv/peKn/E1sm2inDUofNIXMI+TUYyZC8KdbtMn7Sqil9 bB8ae3h8J4HPiwBrmoahYE2Y4L4M4VOc67hjiCt0tXulvSdIND1bl1RtSLenCs6hGGxd weVO+HsSskvho3+IsLkJspcmegRVECSdc7OjcD2Yo1iaPLJVJgjebD4Ah9W48RfWhI8a Sqknf6ayCmwKiGCdv3Iun+IhDHXeJk3oTMN5A/CdHTEyjhuoJ+pnZydG8t4o3E41Ib88 KJ942mvKvf0ZzaoTMtB8zhe96MPOs8aA91D86Kt78I8+gcEPT1Jn6CVXBnSB/eZVI07a +IXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=Vgsjk5a+3RABw97bkHZNe9/iAeql+h4soy1rzbYx/f0=; b=LeGGXf5ghS1DTGIWW4m1LyAGf6m0pMX0zMVu1YEYAQ7Wk6XDOL7Ee31Pa+AY9/uFsg z7A3zLCwnYkKWMJXe2XyntY/mBjst5NIlXaphrYiBWhhR/tH4Fdw98LwKvSiGZylgrtU nQIIVnMMwlAdh2ztt8utcXbd0RE7qdjMQu5dQxNjqf10jC0RWN62fUNda9Y27Tn2kpQI DkVBcM+DY/1Mj43esPmGZRfcPSMoP906eeZ/83Ik91V6EVSGwr8EIqsYvsOljerE9WQS KFXln1TXiz6ifkBV/3Qx49Y+ZomU1HjJBovOMA2eVtm6HyIOI+9fQfLOYmydi96C+DRm znYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=QWEwD6gF; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn2si121672plb.34.2019.05.20.05.18.38; Mon, 20 May 2019 05:19:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=QWEwD6gF; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732425AbfETMA5 (ORCPT + 99 others); Mon, 20 May 2019 08:00:57 -0400 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:35388 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732290AbfETMAz (ORCPT ); Mon, 20 May 2019 08:00:55 -0400 Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id CFE9630C0A1; Mon, 20 May 2019 05:00:53 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com CFE9630C0A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1558353653; bh=+zfkG1l3OrC8wcXOVwJk+kbcHvGZVXhVLoCaq6HA4ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWEwD6gFTMeenGsYPl/AA8QTstTSr3zI6SWAt/6e/fZGMEb6upIVj4AhS7v5g0Hmo axcJyYDAviIdmnVPej+Nb4hXN5UWEUJFRaQ2QkTh9l0ETXE58uB+gmdSsedFqgp1Il aeIzrtugTUAP+4BMuKDJ7pJegzP/Xp31av1i6px0= Received: from bld-bun-01.bun.broadcom.com (bld-bun-01.bun.broadcom.com [10.176.128.83]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id D44AE60D77; Mon, 20 May 2019 05:00:53 -0700 (PDT) Received: by bld-bun-01.bun.broadcom.com (Postfix, from userid 25152) id F11D1B02AC0; Mon, 20 May 2019 14:00:50 +0200 (CEST) From: Arend van Spriel To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Arend van Spriel Subject: [RFC 3/8] cfg80211: util: add 6GHz channel to freq conversion and vice versa Date: Mon, 20 May 2019 14:00:40 +0200 Message-Id: <1558353645-18119-4-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com> References: <1558353645-18119-1-git-send-email-arend.vanspriel@broadcom.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Extend the functions ieee80211_channel_to_frequency() and ieee80211_frequency_to_channel() to support 6GHz band according specification in 802.11ax D4.1 27.3.22.2. Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Leon Zegers Signed-off-by: Arend van Spriel --- net/wireless/util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/wireless/util.c b/net/wireless/util.c index cf63b63..081637e 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -91,6 +91,11 @@ int ieee80211_channel_to_frequency(int chan, enum nl80211_band band) else return 5000 + chan * 5; break; + case NL80211_BAND_6GHZ: + /* see 802.11ax D4.1 27.3.22.2 */ + if (chan <= 253) + return 5940 + chan * 5; + break; case NL80211_BAND_60GHZ: if (chan < 7) return 56160 + chan * 2160; @@ -111,8 +116,11 @@ int ieee80211_frequency_to_channel(int freq) return (freq - 2407) / 5; else if (freq >= 4910 && freq <= 4980) return (freq - 4000) / 5; - else if (freq <= 45000) /* DMG band lower limit */ + else if (freq < 5940) return (freq - 5000) / 5; + else if (freq <= 45000) /* DMG band lower limit */ + /* see 802.11ax D4.1 27.3.22.2 */ + return (freq - 5940) / 5; else if (freq >= 58320 && freq <= 70200) return (freq - 56160) / 2160; else -- 1.9.1