Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp346070ybl; Fri, 30 Aug 2019 00:17:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf5n0NVvUgW8UTPlTiQYi2UwAUZhFAJUdy412qo5UXpEDHzXnKX5ZkpHO+8c5/VAWTijZu X-Received: by 2002:a63:f304:: with SMTP id l4mr5277893pgh.66.1567149451881; Fri, 30 Aug 2019 00:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567149451; cv=none; d=google.com; s=arc-20160816; b=m3BKbAVgWF308YC3AMg8Hw40GFn45FZmfPe3QPkja69Yv8gqVe3geCZ/3bqCoCnvcj zaC5aN+u3/oVCWAhTY2Ye8TpGw6hZWSZPBWdt7JnaHxLFbTZ9GjXXE2oRqZmLDtJE4oS D5SqK6aZ9K3YradvRLF+fRsrkTBmQvQiHFLHDe2fNs3wE6wqeLoLFGsgpcxu71Nzn5lq EfP/iWBHbOEx7qcEGcMyviq6peVFWtBib6Mg8AP08CPwDJb4LNvW/4MpdKifZEBGxK4r wcK796VHETTrfZIfTrJEWPNtbSLXWJE2Mb/uPNF7a+nprI2VrSxXLm8W9+4f88mRkPdE jMrg== 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=ULLF+yLkG19vqGn6yRvYI74ip8aRkfts7skciHLUJ8c=; b=gOY01zJMpjUtNtJH3083LTnd3/dcyT91AWJUYEOYRkCHtapz4YJj7WYYP9klUkRhV6 +7pj5/gMn+CwWwDbf5608KWNH5swmLMJKBGybRk4ZfhyWPlaeDp7zTeFrRTw5LRh3DCH WkaBW7CKvAS83zjwQpI9h7oI10dSPvoPGytFcKCBk0lTsoAm02v31aPwKIvG9z6suBvN chIhKuYupOcrlD8huVHHrP7fR7GL5QGZxzAUSzBxr7d3G493+GUmt3btSaH2sWbKrNhE 0AqagKrEebymTSx3Pa49mo9A1cZMWMxw3t66DJGs2C8lbsxpDN4MOSI9MqNW9dr6Gr0h LdKg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 60si3905139plf.398.2019.08.30.00.17.05; Fri, 30 Aug 2019 00:17:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728165AbfH3HRC (ORCPT + 99 others); Fri, 30 Aug 2019 03:17:02 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:59608 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfH3HRC (ORCPT ); Fri, 30 Aug 2019 03:17:02 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.1) (envelope-from ) id 1i3b9Y-0008HG-1K; Fri, 30 Aug 2019 09:17:00 +0200 Message-ID: <94e4db96eb0602dd795cbbc171a7a3b7383a0b37.camel@sipsolutions.net> Subject: Re: [PATCH] cfg80211: Add new helper function for channels From: Johannes Berg To: Amar Singhal , jouni@codeaurora.org Cc: linux-wireless@vger.kernel.org, jjohnson@codeaurora.org, rmanohar@codeaurora.org Date: Fri, 30 Aug 2019 09:16:59 +0200 In-Reply-To: <1567115381-7831-1-git-send-email-asinghal@codeaurora.org> References: <1567115381-7831-1-git-send-email-asinghal@codeaurora.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, 2019-08-29 at 14:49 -0700, Amar Singhal wrote: > Add new helper function to convert (chan_number, oper_class) pair to > frequency. Call this function ieee80211_channel_op_class_to_frequency. > This function would be very useful in the context of 6 GHz channels, > where channel number is not unique. Nit: it is unique within 6 GHz, just not within the overall channel number space, and that was actually already not unique before, it just didn't matter much to us :-) I may reword that when I apply it. > Signed-off-by: Amar Singhal > --- > include/net/cfg80211.h | 10 ++++++++++ > net/wireless/util.c | 23 +++++++++++++++++++++++ > 2 files changed, 33 insertions(+) > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index 6467b60..decafba 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -4914,1 +4914,1 @@ static inline void *wdev_priv(struct wireless_dev *wdev) > int ieee80211_channel_to_frequency(int chan, enum nl80211_band band); > > /** > + * ieee80211_channel_op_class_to_frequency - convert > + * (channel, operating class) to frequency That's formatted badly, the short description must fit on one line. > + if (global_op_class >= 131 && global_op_class <= 135) > + return (5940 + 5 * chan_num); > + else if (global_op_class >= 115 && global_op_class <= 130) > + return (5000 + 5 * chan_num); > + else if (global_op_class >= 112 && global_op_class <= 113) > + return (5000 + 5 * chan_num); > + else if (global_op_class >= 109 && global_op_class <= 110) > + return (4000 + 5 * chan_num); > + else if (global_op_class >= 83 && global_op_class <= 84) > + return (2407 + 5 * chan_num); > + else if (global_op_class == 81) > + return (2407 + 5 * chan_num); > + else if (global_op_class == 82) > + return (2414 + 5 * chan_num); > + else if (global_op_class == 180) > + return (56160 + 5 * chan_num); I think it would be good to have a list of valid channel numbers for them as well. I was wondering about 82 for a second there for example, until I looked up again that it is just for channel 14. I think this is also missing 83/84 and various other operating classes for wider channels. Perhaps in those we don't really need to check the channel numbers precisely, i.e. we could probably treat 81/83/84 all the same. But depending on what you feed to the function, it's possible that you could encounter those other operating classes. johannes