Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2879620pxk; Sun, 20 Sep 2020 22:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7k2Utdr8nfHX/NFCcWXGYkWCfyjOz1ULe8ZNuEZNxYdHS4wc8ECYcfeH9aXqXlpHD8QdJ X-Received: by 2002:a17:906:e08f:: with SMTP id gh15mr47200047ejb.443.1600664459527; Sun, 20 Sep 2020 22:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600664459; cv=none; d=google.com; s=arc-20160816; b=aRylW4KChjJmz6AzJ34q/NT72p2wbu5Y9fO/i99RX+wylOj2SUA1y2x9WO0yPXFOZI 5hR8erQWS4/a0EgFHCIBxv/K/CAg9CUcidzvAKcJ834pOQcKjfDehcyLB8DIyUuI2xwX iTl6oUiziojV2Ou+Zi5dn3sJE8eY5nqteCQfP5WYkFKGCVzGda79CSW/RnUn0vsx59dN njrt3uxnNZ7bTbXttKZq+AaqqUdLKwbyQh5CAUQEEee4M0CNhUXi/AcSxYLmFvzLr8Tt ZlrQEA0HKV4tapJJpER27xAASj7BGw5qo2m42wOB5cJPvoaUqOEV17+s00VdimO6Z5AC 4n3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=EitbgobXDrTvJXmdWwIYpRTJg2FLoeTNxjzOHxKMEvE=; b=p58IYwUQR+vmQkXyfdBh5aXbUNfrxMVq8T8vWHnMlOaiHglb9WLbuEMkl8O131XNwH 41pYLTv1vsMnUKAeF+e738p+0AwiK48rta+paNSJ3OjDEqPcU8AlP+S+a9q4Jg+rN0t6 NHgyTMTlOJFeBc71J88ZfTxJvc/ml2sxrNZ/Aw/ETNFk5qAlLIzLBKPsjk6t1KeHjWXb G/+MlwC55NCMtQ9MKtOfdLRJUxYlnxgJh5HqfT7rorVkg3K4ZLVIU3GN8eBsGIsDKR5p bDc1mYqIiN+GSWj50poA3lNwLtqQ7N3uyTSiUVayGAvKCy0Pv8BOWOPFYmoppe+9ZbFU Zpnw== 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 x25si7542488edi.558.2020.09.20.22.00.23; Sun, 20 Sep 2020 22:00:59 -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 S1726228AbgIUE7g (ORCPT + 99 others); Mon, 21 Sep 2020 00:59:36 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:45754 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726211AbgIUE7g (ORCPT ); Mon, 21 Sep 2020 00:59:36 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 9E7424F9809; Mon, 21 Sep 2020 04:59:35 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at web.adapt-ip.com Received: from web.adapt-ip.com ([127.0.0.1]) by localhost (web.adapt-ip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6w7BuDKrXTPr; Mon, 21 Sep 2020 04:59:32 +0000 (UTC) Received: from mail.ibsgaard.io (c-73-223-60-234.hsd1.ca.comcast.net [73.223.60.234]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id A6D064F9297; Mon, 21 Sep 2020 04:59:32 +0000 (UTC) MIME-Version: 1.0 Date: Sun, 20 Sep 2020 21:59:31 -0700 From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless Subject: Re: [PATCH v2 06/22] {cfg,mac}80211: get correct default channel width for S1G In-Reply-To: References: <20200831205600.21058-1-thomas@adapt-ip.com> <20200831205600.21058-7-thomas@adapt-ip.com> User-Agent: Roundcube Webmail/1.4.7 Message-ID: <18730e757068a05f6531ea204791eae8@adapt-ip.com> X-Sender: thomas@adapt-ip.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-09-18 03:38, Johannes Berg wrote: > On Mon, 2020-08-31 at 13:55 -0700, Thomas Pedersen wrote: >> >> +++ b/net/wireless/chan.c >> @@ -33,6 +33,16 @@ void cfg80211_chandef_create(struct >> cfg80211_chan_def *chandef, >> chandef->edmg.bw_config = 0; >> chandef->edmg.channels = 0; >> >> + /* S1G allows a single width per channel, and since chan_type seems >> to >> + * be for backwards compatibility only, ignore it and return the per >> + * frequency width. >> + */ >> + if (chan->band == NL80211_BAND_S1GHZ) { >> + chandef->width = ieee80211_s1g_channel_width(chan); >> + chandef->center_freq1 = chan->center_freq; >> + return; >> + } > > Hmm. I'm not sure I want to let you get away with this? > > It might be ... convenient, but it's also confusing to see something > like > > cfg80211_chandef_create(&out, some_channel, NL80211_CHAN_HT40PLUS); > > actually create an S1G channel width? Yes I agree that looks like it should be an error. > Yes, this is mostly for backward compatibility, but it's also used in > few (21 in the stack) places. Many of those aren't relevant, e.g. in > net/mac80211/ibss.c it would obviously be clearer to handle the new > NL80211_CHAN_WIDTH_* values with e.g. a cfg80211_get_s1g_chandef() > function or so that does this derivation, instead of running into the > > default: > /* fall back to 20 MHz for unsupported modes */ > cfg80211_chandef_create(&chandef, cbss->channel, > NL80211_CHAN_NO_HT); Yes, but then what would we pass to cfg80211_chandef_create()? We should probably avoid adding an additional NL80211_CHAN_S1G if enum nl80211_channel_type is legacy. It seems like NL80211_CHAN_NO_HT is often used as "give me the default channel width". See cfg80211_get_chandef_type() when it throws up its hands and returns NL80211_CHAN_NO_HT when encountering an unknown chandef->width. Also IBSS passes NL80211_CHAN_NO_HT when the BSS is actually 5 or 10MHz. Maybe (instead of adding a new nl80211_channel_type) cfg80211_chandef_create() throws a warning if anything but NL80211_CHAN_NO_HT is passed with an S1G frequency? > IOW, it seems to me that this function should actually instead throw a > warning (and then perhaps configure something sane?), but not be the > default code path. Yes, but I'd also like to avoid making the caller worry about the value of a parameter which only exists for HT reasons (?). -- thomas