Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1092852pxk; Fri, 18 Sep 2020 03:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxEUL6fA5GfmdEmRfgyYRSaxHlwcK2IwcFFWhPL6M42xxyvGOjDLmPN9b1z7dTol3l6JR8 X-Received: by 2002:a17:906:4685:: with SMTP id a5mr35459185ejr.446.1600425547559; Fri, 18 Sep 2020 03:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600425547; cv=none; d=google.com; s=arc-20160816; b=DIGuEqqKP3eNaTtG4FuOlmY9PSKIpCnh/pRq98z3o1wfmkdECFYWh8VwiodiFAEmdr KoIBifyguc+c8PwT7bVElHg37uoH7dtCkJdjDbVO5ULk/qEUIN61/NqHLTFL51e+Z4NT HVrvde/hdhI8nd2L34Vg/G4iVhtR78toKMXHdTaxaM6CCXVMHj6CAcVktVrD6435XwEo 8thuLnnSyILw6cj9273vraH0pc+x2EUgSGTFx3mmr5P4AP75M3FNkcQ2IL0Phpobxy1L KcIKZQcH96dcvibXo57myvFULUf8v3rA5i1Dhv1C6Wepm9Uf052wiV55PfhVJ1IklUlR BY5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=RDOzS/jjujTN5CsdS+EHTosyeLmXq+NbkErkJ4E3tZc=; b=KL+HSpU371zkUSzqGANIoMTTTkZId7MK5dM9tiuovJjaI5pCrYDhttVy/ayLwyGK9i vVrdMNZoPBGPNAGxPTQ0trF/0I7nYJlbXvR0T08oGRIdZZg8B5H4mKV/RP7IG7tdfhr/ 3z3ejfBH0T2VzOmwx/5hTbES4EM2j2TpqPiAXkamoVnpYvpXgrYUYIM5Pt5KzMFCoeCS vnmsLc7wzRRHuJ6HBhTlWqnU7iNYsf0ZPo1hHefIL2yK/8DFCo/eWlNkWrERiFwda1dY 85KXYEXWud6VHSbMVYrzoWxaIVge5tOMfcLekyC04RzRkEeCST9fHjYFDcPhgdw4whcX /Q1g== 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 cf14si1897024ejb.441.2020.09.18.03.38.41; Fri, 18 Sep 2020 03:39:07 -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 S1726299AbgIRKiM (ORCPT + 99 others); Fri, 18 Sep 2020 06:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbgIRKiM (ORCPT ); Fri, 18 Sep 2020 06:38:12 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19F3FC06174A for ; Fri, 18 Sep 2020 03:38:11 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kJDmL-006CNL-JC; Fri, 18 Sep 2020 12:38:09 +0200 Message-ID: Subject: Re: [PATCH v2 06/22] {cfg,mac}80211: get correct default channel width for S1G From: Johannes Berg To: Thomas Pedersen Cc: linux-wireless Date: Fri, 18 Sep 2020 12:38:08 +0200 In-Reply-To: <20200831205600.21058-7-thomas@adapt-ip.com> References: <20200831205600.21058-1-thomas@adapt-ip.com> <20200831205600.21058-7-thomas@adapt-ip.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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, 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); code. 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. johannes