Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp686190ybk; Fri, 15 May 2020 10:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBgdpxbAYn8EBJtQbI29O/6aWUH4dbM7wKJSAboPGqCqg6Hx3cjddgq8Uh09zIzkdKrrQI X-Received: by 2002:a17:906:970e:: with SMTP id k14mr4021878ejx.202.1589565188473; Fri, 15 May 2020 10:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589565188; cv=none; d=google.com; s=arc-20160816; b=hKGB76+xIYxD0dmJllCHcdlKc7EUAKR8U2k2jBzI+yw4htVENU2xSw8t7KEGXjQe0n MGg1Tphr2srgUWBc0td1U3VLB49clmCiQVTqlfxufocmVnNk9z2wGhUomTZ/lUsvz6fW JE16dcRlCh/kUKLSaoEq813cfH03jxCzt0RYIng3zHfJFQkiuBzmghyYnLN5zaAg2naD 5oDMTHQHkbYXvfMh18k3yTt8fLD0cKOm8/L29H6LiMe6iorP+AaHm2DONlJ2KXFYwKho C9kQTIBrm/nqwvw/H+AC2uvIeCRbJFivPvUYGpBNBHlv5WNLSycdSA+t1OVRxo9gdaAY 5iZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=bslKtWCXsJbwrBTfNoUqwKXZl22LdigGSXwOTdE5U4M=; b=h8EaAbWkofQWH/vBi/oZ9fLneky9VUDozrFPSgjYQAaT73OEy45PTEJ5uLNhjRO5xm EWWKyHgqBSYcvz48azWzdtlwvfqOhnQjhxi2jNOoEAwe0hpt4sseZ0ASfIe0EDimjkZk vQmQqynKLx+vhkQLgBaDk8hAvY1GJtiMUvRPBodLcrFCYQ2Cz6a6+UGMcFDGduZoHYJh XO0iZqoyTfbiX7bm5UIlj8EEs5Jv0Qrj3b9IF4RXHaaQiHyfcFactg6oBct+6jir0tGN u1qZCCw4Ky5qhui6nKPYq7an682IspTvqqSIvpC6Vy/vQZmwsV6ltzVGGkgDD8PCUseT P4fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=jVdwAqPh; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d32si1669126edc.454.2020.05.15.10.52.23; Fri, 15 May 2020 10:53:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=jVdwAqPh; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgEORv6 (ORCPT + 99 others); Fri, 15 May 2020 13:51:58 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:11676 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbgEORv5 (ORCPT ); Fri, 15 May 2020 13:51:57 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589565117; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=bslKtWCXsJbwrBTfNoUqwKXZl22LdigGSXwOTdE5U4M=; b=jVdwAqPhdZxZh2O6DerSo69km+op9a8xZWtk7rIaldGFxMMLyy9Ty2E6obCp/yLAI1Eisrx7 BdUS7uDkUKhs4kinfINuqclxplCDS9b2rYA85bMTpMzlMMLxXzeYGh3AlSuapAoF/ZXfGfqG R/m72Wff6mTYTfpjc/N8SAf60rI= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 5ebed6bc75dd50406ea7b967 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 15 May 2020 17:51:56 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 99CFEC44788; Fri, 15 May 2020 17:51:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from pradeepc2-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pradeepc) by smtp.codeaurora.org (Postfix) with ESMTPSA id 79584C43636; Fri, 15 May 2020 17:51:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 79584C43636 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pradeepc@codeaurora.org From: Pradeep Kumar Chitrapu To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Pradeep Kumar Chitrapu Subject: [PATCH] iw: sync frequency to channel mapping with kernel for 6GHz band Date: Fri, 15 May 2020 10:51:45 -0700 Message-Id: <20200515175145.30080-1-pradeepc@codeaurora.org> X-Mailer: git-send-email 2.17.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This enables support for channel to frequency conversion and vice versa for 6GHz channels and frequencies. Channel numbers of 6GHz band might overlap with those of 5G and 2G bands. Signed-off-by: Pradeep Kumar Chitrapu --- util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/util.c b/util.c index 886fef2b5e2c..ac6a96dc2851 100644 --- a/util.c +++ b/util.c @@ -180,6 +180,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 < 5) return 56160 + chan * 2160; @@ -199,9 +204,12 @@ 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 < 5945) return (freq - 5000) / 5; - else if (freq >= 58320 && freq <= 64800) + 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 return 0; -- 2.17.1