Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1307665pxk; Mon, 31 Aug 2020 15:58:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE57XFi+RWKxHeJtf9J7ClKkadyZmtCXFEdWwDQ/yWLeZc0i2Dvv4ogOqdN2/drrvjhtAE X-Received: by 2002:a17:906:fb01:: with SMTP id lz1mr2907930ejb.447.1598914683621; Mon, 31 Aug 2020 15:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598914683; cv=none; d=google.com; s=arc-20160816; b=J2NHnjclXEyTx61/wjF+XeRU1x3hdIGbZpZMoo50CZuS3PzmqFkcvrXn6Lb6un5s2T 6LiiZz+oWBMGob3SB5A+8rAH/1YuwqwHrOk+S1WIZ6RtvBD1wI5JUlG4L5y9kdx18FHr 8df3ffRJas5ud+fT38u5IaydqtpC9HvVkF3fw9gtDg+g5TIatBQRmIbKTx0Oggp1q8Mj MxpRecjtDymTC8uTg2CGH0PU57KukoUMKIaMzYNaNNovbOR5wYZzOqPwDWtA0xBA/IHs 7pGwxCwodFEzTpca4dRzoxPGTL1hUZ2gYBxDFb9omaSibBTJmhTohujSqqcH/wN2d/E1 44pQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qOahS7y1360GlqqTIBohqw2AYpJOrl+4BYjxNDKgwCM=; b=K93wvqJTxc8PkAlW7J1xPTOCNhexLxpdyScFB4JhZTnIHAAnJDe7/rSZjgMVH6fPdd 5X2DmzTJQMg+Os81NsZnj9dXtV+NrCRD9bZbtHeeTmSaGoWiXoY/T0eY+O3wSzv03dEX GK4mWpjn1BfU1ZYtyy5yxmta4HRLlPtNJbzxnCn5zN56jVWMcxOTYAi/ZG2bomjHeb/A 1RpfbVEwxHDwxR5v0jXm+AQLGx6jRYl+mS8AQIBqo0BwymkR4fKbswsN7Ydbe9keWpn/ JCIFzKG5BL/0FN3pJE0sGOCc/AdsCCYzjJT/Y/UnwJ1KDewfiaeCIwSH0V8x+wPnDI3M 2sVw== 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 u1si5855918edd.388.2020.08.31.15.57.39; Mon, 31 Aug 2020 15:58:03 -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 S1729591AbgHaU4S (ORCPT + 99 others); Mon, 31 Aug 2020 16:56:18 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:52242 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729462AbgHaU4Q (ORCPT ); Mon, 31 Aug 2020 16:56:16 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 399634F8F92; Mon, 31 Aug 2020 20:56:16 +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 lTTqmStC6uTE; Mon, 31 Aug 2020 20:56:13 +0000 (UTC) Received: from atlas.campbell.adapt-ip.com (gateway.adapt-ip.com [173.164.178.20]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id 58D904EE3BF; Mon, 31 Aug 2020 20:56:08 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v2 06/22] {cfg,mac}80211: get correct default channel width for S1G Date: Mon, 31 Aug 2020 13:55:44 -0700 Message-Id: <20200831205600.21058-7-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200831205600.21058-1-thomas@adapt-ip.com> References: <20200831205600.21058-1-thomas@adapt-ip.com> 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 Until now, the wifi default channels were assumed to be NL80211_CHAN_NO_HT, or NL80211_CHAN_WIDTH_20_NOHT. S1G devices however do not support these channel types/width. When a default channel width is requested (during default chandef init, or chanctx removal when not using channel context), for S1G calculate the correct width. Fixes eg. configuring strange (20Mhz) width during a scan on the S1G band. Signed-off-by: Thomas Pedersen --- net/mac80211/chan.c | 9 ++++++++- net/wireless/chan.c | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index bdc0f29dc6cd..8f48aff74c7b 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -536,7 +536,14 @@ static void ieee80211_del_chanctx(struct ieee80211_local *local, if (!local->use_chanctx) { struct cfg80211_chan_def *chandef = &local->_oper_chandef; - chandef->width = NL80211_CHAN_WIDTH_20_NOHT; + /* S1G doesn't have 20MHz, so get the correct width for the + * current channel. + */ + if (chandef->chan->band == NL80211_BAND_S1GHZ) + chandef->width = + ieee80211_s1g_channel_width(chandef->chan); + else + chandef->width = NL80211_CHAN_WIDTH_20_NOHT; chandef->center_freq1 = chandef->chan->center_freq; chandef->freq1_offset = chandef->chan->freq_offset; chandef->center_freq2 = 0; diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 96e24ee4c7e8..a3bc50e419fd 100644 --- a/net/wireless/chan.c +++ 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; + } + switch (chan_type) { case NL80211_CHAN_NO_HT: chandef->width = NL80211_CHAN_WIDTH_20_NOHT; -- 2.20.1