Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1406965rdh; Fri, 24 Nov 2023 11:48:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2Piz7dvpgq4sf97yRLzk0WKW7VB+BBcijxJKXJYdIqBSwLegUiUOLmtsXZWf0xCakWt2W X-Received: by 2002:a05:6a20:9382:b0:18b:962c:1ead with SMTP id x2-20020a056a20938200b0018b962c1eadmr4494887pzh.3.1700855312882; Fri, 24 Nov 2023 11:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700855312; cv=none; d=google.com; s=arc-20160816; b=Zf7N7u+mU9O1Fj1vHfR9uYNfECvoiscpZXUJC4uqVkdwFM0S8hNxp6G5QEo1eJ3hH1 MFMzLttZoSDBHAXwevTxwH5Ty3p6uJIUeagJhvyBgXNhkA3FdiL0lQP/Ekm62ZCdPUL6 vwhfIF/VFzzlBFyQeD7WUdT/Xr8l4hKqTegX4poXHXLQHLNNaKBajVyiaEQZzwkZ3mb2 ndN77jJo3ZinAwDbyK67YrwtIW/1aEbpR+ys3uk8osHS3sk8aMeLqkhD7bgYIAEnZSqd gLnyF4tYhrUsnH0jo+fo1XDwrWmEUd/8juKSTseK3oqBlw8tpaYHhE3rPE6E0uH8BmAZ Dybg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=4dR4MEH7xKCu1higgA12F2eKeCLmZwqk+iO8UpgP8k8=; fh=Cq/FSrGK4WmKxjdFfY1qpO1ogJW+sTH5LSvlfNfDQcw=; b=Sj+Mkdn5d+LwcKIRj911Hl50zsIbODIp8y6cTlqgQrLQtKnA53lWV0++ujTgxT5rCQ 8C4NHCzx+frHcSc1byt9OlmhCRtNsewFNaLZGQoR/JLFTERzhhT11jGmLFC2v3QdrEPZ c6keskXnlRHoO2T9L74D2z0E2rZL06SBCQ7+xJdedA3sVYuMOn52EAx9ED7TsvPdXrHB pywlzM01SUSDlAparOfLaEygPBKq2b2NMxZjCRiyjhbfgdFSzjt7osqwRGIjWPJW/LmT aSVTJF0pxLRS22xB2f4ZEljT+yVm/hvUtLgWYfKKu4Yi5jn6t/GFAvLEQXUHsdRgr2h/ 8ixw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=X3lqrdxV; spf=pass (google.com: domain of linux-wireless+bounces-66-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-66-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b7-20020a63d307000000b005bda050625fsi3960035pgg.455.2023.11.24.11.48.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 11:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-66-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=X3lqrdxV; spf=pass (google.com: domain of linux-wireless+bounces-66-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-66-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D045EB2582E for ; Fri, 24 Nov 2023 19:31:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 669C12C1BA; Fri, 24 Nov 2023 19:31:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="X3lqrdxV" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F06E52D79 for ; Fri, 24 Nov 2023 11:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=4dR4MEH7xKCu1higgA12F2eKeCLmZwqk+iO8UpgP8k8=; t=1700853963; x=1702063563; b=X3lqrdxV1eUEydApa3jo8sLIi+cBfouH+23N0Zz4uvOCCOF 7VkGvED01xNVyM+SE5R/VF5HfkQ1bJR+uq1YHBVMQuCkUQQiz8HxlUll+uXFJhPZAXsnai0VPUkxg 3zqndEyl/y6ig93laFzlDdbeORAyUqis2dN4IT6uXCg72Dco/uyQ+hWa1sJQk2CvDYkbapuhvRNdw 62jlgzSz7XIhkClOcTAQx1M5rgDVcsBmL3ZGP5fBrVW4KT/c7ywXIpwedfiNGSMSpKi8qaXKIWRsN bMqxcN2RsU2Yap+BmcwnkxcxDXlS4fnGFKS8nBuZVF1SDToiYr6leqQC4wbscGQA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1r6boN-00000002k4e-1kpz; Fri, 24 Nov 2023 20:25:59 +0100 Message-ID: Subject: Re: [PATCH v2,1/2] wifi: mac80211: Add utilities for converting op_class From: Johannes Berg To: Michael-CY Lee , linux-wireless Cc: Felix Fietkau , Lorenzo Bianconi , Evelyn Tsai , Money Wang , linux-mediatek Date: Fri, 24 Nov 2023 20:25:58 +0100 In-Reply-To: <20231113021107.13110-1-michael-cy.lee@mediatek.com> References: <20231113021107.13110-1-michael-cy.lee@mediatek.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned Btw, I ended looking at this again... On Mon, 2023-11-13 at 10:11 +0800, Michael-CY Lee wrote:=20 > +/** > + * ieee80211_operating_class_to_center_freq - convert operating class to > + * center frequency > + * > + * @operating_class: the operating class to convert > + * @chan: the ieee80211_channel to convert > + * @center_freq1: cneter frequency 1 pointer to fill > + * @center_freq2: cneter frequency 2 pointer to fill typos here ("center") But maybe it'd be better to fill (or update, we could pass the channel pointer in it) a chandef struct? Then it could also be more easily extended to understand more opclasses in the future, perhaps S1G or DMG? > + * > + * Returns %true if the conversion was successful, %false otherwise. > + */ > +bool ieee80211_operating_class_to_center_freq(u8 operating_class, > + struct ieee80211_channel *chan, > + u32 *center_freq1, > + u32 *center_freq2); > + > +/** > + * ieee80211_operating_class_to_chan_width - convert operating class to > + * nl80211 channel width > + * > + * @operating_class: the operating class to convert > + */ > +enum nl80211_chan_width > +ieee80211_operating_class_to_chan_width(u8 operating_class); And you'd actually get both in one function call? The chan -> center_freq anyway implies you know the width, no? Is this really needed separately? > /** > * ieee8 0211_chandef_to_operating_class - convert chandef to operation = class This also converts the other way around, btw. > + case 135: /* 6 GHz band; 80+80 MHz; channels 1,5,..,229 */ > + /* TODO How to know the center_freq2 of 80+80 MHz?*/ > + *center_freq1 =3D 0; Well, you don't, from this. I'm actually a bit surprised 80+80 exists in 6 GHz, I thought it was treated more or less as a dead end. johannes