Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp202907ybm; Thu, 28 May 2020 00:10:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmxiGrE75MldElaJTqmLF9u1zxNBteK0PMQX2E3lE2YWqvUbDRwY75tfbzYp3OxQvSprkW X-Received: by 2002:a17:906:4c56:: with SMTP id d22mr351132ejw.21.1590649830973; Thu, 28 May 2020 00:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590649830; cv=none; d=google.com; s=arc-20160816; b=wplcPQcfdKZqmd7JvCyZaLKdd4k9L8xPObQ/a1979TQ0TzxswQ2eo0dWRQuOV1yLPL IlhjzpU2esKjt9l59PnMgP0Pr5kfD46AbquApLdm2fHpOhMEyEAs8LEXQXjcTXQ3hOrP R1QfX5+68ypufnxmgt70NJ2t9lBq+6011iXUTKyAkpo7Ho37N+cMzd+h/EKBSNafTcvh FnvkV7arqiM8HSouLWTWMDOnhxJAV1D5Btrm/ZcAuVzL1ZlIUKaxHsjnH/YOYsv7FbNj swx5PipBjf8GQ3L+IWqaYPOUW0IjJu/ijdLz2zfzzG8sr4dR/Od19Wza3hzdy0NRxz6k naVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=oaRblI2ERS7IpgQOhhzh1SegYab/0Quqf8jM0fOR/X8=; b=fwWNu0bD9NxHl9cDKOAWq05G2gAg4xfAReC+etKL6gn9SLpa1oifciS/jVVmj2XeMO +jok3X9C+wxw7fDsFhKSoDsWuZIlShlzMAbpAN9QEkiXTS5sjT00TMOACQ7PjBJPmTo7 bbN/r4NoFJdxBWQWhkc/muH5PX74TzBJ3UVDH5mKbhI+OooTQabuWQkcYb88vEXHzW5F paRMw6KTJ1s/B9fy26NSe8dsYmParWAklIetuSEi4hmiC7bUkkhWSLzBH6Wgg2RyURbE uvj6nH4ELjPcdBor2ZxCGMNPxYNC1YL1uFUuR4JfpHmDb91zcNHSr/nFur19MlN1YTSj +jUg== ARC-Authentication-Results: i=1; mx.google.com; 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 v22si3371766ejx.259.2020.05.28.00.10.01; Thu, 28 May 2020 00:10:30 -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; 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 S1725836AbgE1HIM (ORCPT + 99 others); Thu, 28 May 2020 03:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgE1HIM (ORCPT ); Thu, 28 May 2020 03:08:12 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F398C05BD1E for ; Thu, 28 May 2020 00:08:12 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) (envelope-from ) id 1jeCe7-004hbn-BT; Thu, 28 May 2020 09:08:07 +0200 Message-ID: <643b2e386881de3051f35eaf64d36344cb2df9f6.camel@sipsolutions.net> Subject: Re: [PATCH v3 1/9] cfg80211: Add helper function to identify 6GHz PSC channel From: Johannes Berg To: Pradeep Kumar Chitrapu , ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Date: Thu, 28 May 2020 09:08:06 +0200 In-Reply-To: <20200526224217.11119-2-pradeepc@codeaurora.org> (sfid-20200527_004804_951011_BE3F0562) References: <20200526224217.11119-1-pradeepc@codeaurora.org> <20200526224217.11119-2-pradeepc@codeaurora.org> (sfid-20200527_004804_951011_BE3F0562) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.2 (3.36.2-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, 2020-05-26 at 15:42 -0700, Pradeep Kumar Chitrapu wrote: Hi, Just checked what we had here, and it was the following: > +/** > + * ieee80211_is_channel_psc - is 6ghz channel a Preferred Scanning Channel (PSC) > + * > + * @chan: struct ieee80211_channel to determine > + * Return: True if 6ghz channel is a PSC channel. False for the rest. > + */ > +static inline bool ieee80211_is_channel_psc(struct ieee80211_channel *chan) > +{ > + if (chan->band != NL80211_BAND_6GHZ) > + return false; > + > + /* > + * From IEEE P802.11ax/D6.1: The set of 20 MHz channels in the 6 GHz > + * band, with channel center frequency, ch_a = Channel starting > + * frequency – 55 80 × n (MHz) are referred to as preferred scanning > + * channels (PSCs). Channel starting frequency is defined in 27.3.23.2 > + * (Channel allocation in the 6 GHz band), and n = 1, …, 15. > + */ > + if (!(((chan->center_freq - 5950 + 55) >> 4) % 5)) > + return true; > + > + return false; > +} static inline bool cfg80211_is_psc(struct ieee80211_channel *chan) { int chan_num = ieee80211_frequency_to_channel(chan->center_freq); return chan->band == NL80211_BAND_6GHZ && chan_num % 16 == 5; } Apart from the naming, where I guess I prefer actually cfg80211_channel_is_psc() or so, does that seem reasonable to you? I'd prefer not to hardcode frequencies everywhere, so in that regard I like our version better. Maybe bail out earlier if band != 6 ghz: static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan) { if (chan->band != NL80211_BAND_6GHZ) return false; return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5; } johannes