Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3444138pxk; Mon, 5 Oct 2020 09:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpz1CduM7CCxSCpnhXKkS3FX0rpomUKnFmlnYjMBQBlPXIvy3KXbLBvAJfFqNcpnLDN8OS X-Received: by 2002:a05:6402:3c1:: with SMTP id t1mr503935edw.231.1601916407783; Mon, 05 Oct 2020 09:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601916407; cv=none; d=google.com; s=arc-20160816; b=JnHSgmc+62BxT1iWQRuRxX1cNpcsns7Ma6gQaQ0jSojxp/5mofZy2t9unocmDwrIJi FX3bJFNS5eM8gQp/9zFCYlE/hX2pxfiZYIGo2Ecr69Yw/h1TjaCam+lENJAOJm6OU3nA QhQfeqNzgAAtBQll8bZQ9D5qL9p3rmhQ7223TnqFbaxHyWzsGkpxm3RkJTzjryqnHDKT EFK88e3JgZ0+9EwUGAFibUtWmaxnuP1rBG6qBKCAZ257ABCLK6z22JYLATd1d5SKyJXx j0BDOiCZsBEG9qb0grMRMjKBCjaaIDUkQexYHrIh5qVrcPA6GvHUmlAtUEluo4UcE8ws sNBg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NaJFeA8jbfTMJvXBCV/lzQGKTyi2AlT3DKc2hi1JnPI=; b=y5I4wr65XcV/vHv2s60TifwBc4E1y6Ltvh37fqnKMlDQOp6TEkulB5mHv1LO9JYyLx N8T/O71xkL25fonOwHxBvacUUY3bnPCTFkghEQjiltNT6hTvYqVx7DtcbKvrDw/9Vlru vZQ384uVdVZIAuKJyumXYv2ToJrDcNYHckehzh4UPxPGdp4GUc5ZQH8P6zoQJ+tuMEgu tKD7iDqjcxSnYR8rSFnMYGTcMHijvtSTJDTyHkzFGfVv6Ub8WCOyC9efKLSmkb+W8O5q XSzfbKVvnNQJyCXBozNOKC9bBZkRTjVwLdDNn1HmbDXzxW8F2KfNFNMGKEdzTvYGJqz7 hQTQ== 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 br19si120387ejb.151.2020.10.05.09.46.13; Mon, 05 Oct 2020 09:46:47 -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 S1727114AbgJEQpY (ORCPT + 99 others); Mon, 5 Oct 2020 12:45:24 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:36758 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726772AbgJEQpY (ORCPT ); Mon, 5 Oct 2020 12:45:24 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id B778C4FA158; Mon, 5 Oct 2020 16:45:23 +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 02cO4AYn6efP; Mon, 5 Oct 2020 16:45:20 +0000 (UTC) Received: from atlas.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 AFD1B4FA15B; Mon, 5 Oct 2020 16:45:20 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v2 2/2] mac80211: initialize last_rate for S1G STAs Date: Mon, 5 Oct 2020 09:45:22 -0700 Message-Id: <20201005164522.18069-2-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201005164522.18069-1-thomas@adapt-ip.com> References: <20201005164522.18069-1-thomas@adapt-ip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org last_rate is initialized to zero by sta_info_alloc(), but this indicates legacy bitrate for the last TX rate (and invalid for the last RX rate). To avoid a warning when decoding the last rate as legacy (before a data frame has been sent), initialize them as S1G MCS. Signed-off-by: Thomas Pedersen --- net/mac80211/Makefile | 1 + net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/mlme.c | 4 +++- net/mac80211/rate.c | 1 + net/mac80211/s1g.c | 17 +++++++++++++++++ net/mac80211/sta_info.h | 1 + 6 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 net/mac80211/s1g.c diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index 6cbb1286d6c0..ad04c361cba5 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile @@ -13,6 +13,7 @@ mac80211-y := \ ht.o agg-tx.o agg-rx.o \ vht.o \ he.o \ + s1g.o \ ibss.o \ iface.o \ rate.o \ diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c3e3578574a6..d9d7a34480b0 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1928,6 +1928,9 @@ void ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, const struct ieee80211_he_operation *he_op_ie_elem); +/* S1G */ +void ieee80211_s1g_sta_init(struct sta_info *sta); + /* Spectrum management */ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index e9a8e8e94ee6..fe6cfb8d477f 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5190,8 +5190,10 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, int shift = ieee80211_vif_get_shift(&sdata->vif); /* TODO: S1G Basic Rate Set is expressed elsewhere */ - if (cbss->channel->band == NL80211_BAND_S1GHZ) + if (cbss->channel->band == NL80211_BAND_S1GHZ) { + ieee80211_s1g_sta_init(new_sta); goto skip_rates; + } ieee80211_get_rates(sband, bss->supp_rates, bss->supp_rates_len, diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 0cba7fed28cf..723762a4052b 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -53,6 +53,7 @@ void rate_control_rate_init(struct sta_info *sta) /* TODO: check for minstrel_s1g ? */ if (sband->band == NL80211_BAND_S1GHZ) { + ieee80211_s1g_sta_init(sta); rcu_read_unlock(); return; } diff --git a/net/mac80211/s1g.c b/net/mac80211/s1g.c new file mode 100644 index 000000000000..dbc216ad0a6e --- /dev/null +++ b/net/mac80211/s1g.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +/* S1G handling + * Copyright(c) 2020 Adapt-IP + */ + +#include +#include + +#include "ieee80211_i.h" + +void ieee80211_s1g_sta_init(struct sta_info *sta) +{ + /* avoid indicating legacy bitrates for S1G STAs */ + sta->tx_stats.last_rate.flags |= IEEE80211_TX_RC_S1G_MCS; + sta->rx_stats.last_rate = + STA_STATS_FIELD(TYPE, STA_STATS_RATE_TYPE_S1G); +} diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 91a61b44b4e0..00ae81e9e1a1 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -823,6 +823,7 @@ enum sta_stats_type { STA_STATS_RATE_TYPE_HT, STA_STATS_RATE_TYPE_VHT, STA_STATS_RATE_TYPE_HE, + STA_STATS_RATE_TYPE_S1G, }; #define STA_STATS_FIELD_HT_MCS GENMASK( 7, 0) -- 2.20.1