Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp485209ybi; Thu, 11 Jul 2019 23:22:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdgwqbeLT2/JE7UV1bbpjQ3227lHkOLDaq5Yb7+4rIA+QhrXopd6c3LTQGkms9LOek+DuC X-Received: by 2002:a65:5144:: with SMTP id g4mr8883192pgq.202.1562912524896; Thu, 11 Jul 2019 23:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562912524; cv=none; d=google.com; s=arc-20160816; b=sgrO5WQ8boKbsuHjSZb3L/oL+/62J0EgjHo8j6vJT5719plFxEubUFw+/wIHmZpmEb aVrk4qN6Qea24iqfrcCJ1fhO0aMseNAb9O16SxMJs85Zj7mIxQiYXeC/Rc23enhbd74H szm6BiI/aJue99Lz5nPRChAWXwXiTU4IXCw2sY3wwU9dnBk15kBe0JSqX4aLuzEPSk+s zTf31JBuOe5dnLOfhROWW937QeXUK7ywost6GNRMQkvhG/CblZi0q42ILZJGZ27SwLFa c8y6eF46PDPAKNFik9eYzUeJ5Y1kEpJ+Xxy0qVnr05n3nmfqPPIr+hy9FdcjyYC6QH80 yVJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=RZg4Y/n6fMQcyzT3pUOphV3aEhZTEHpnRQe5q0QKWCs=; b=W6BMirJ2LSBbfXJMHeemDcp7iuWwisZ2jybN2o6kRUKSTnWxXxCz8ivKncymJ1T1RB NrihU+AeKOKwdgIgrv11ct2eL2gc2CcMJsmwYZGzoo+iLoEhECzEVPTm5mMBS+iTjIQx u/MbOFwzoLAh+Js5gFJP1YRUcniUyUrwSvBHBEsW82jfOv25qpOHhG/m/sTUxZxUhigF LkHS1NYo6makbh0Jeg/7GkEkHkdXTmhVz6qQyF+iOO/1HlqoDaCd3SPuZjRs8Qv3DOcX keD3dBiKqlYniTMkyIpxSZHudyCpj7D3cUflrrPB3U4Xi/MWdwrZlGQmiirIHnRCHR4K SpHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b="gB/sGO/K"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13si1825796pfo.59.2019.07.11.23.21.51; Thu, 11 Jul 2019 23:22:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b="gB/sGO/K"; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726061AbfGLGUs (ORCPT + 99 others); Fri, 12 Jul 2019 02:20:48 -0400 Received: from nbd.name ([46.4.11.11]:33144 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725562AbfGLGUr (ORCPT ); Fri, 12 Jul 2019 02:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RZg4Y/n6fMQcyzT3pUOphV3aEhZTEHpnRQe5q0QKWCs=; b=gB/sGO/KQudpG1Gflp4e6oBTRV xgGHe5OSjNUVuYTwghakriT+opwUbKLhVZtHXU7R4mYi+ouztZbcThCTQ6BZJxEsLmFO3kHwIKZhU ir5wspzpAMfiSEkthZYsf7phJ/rJ94Vi1Xxd84zjguLJI0J/xLzQc59bcXqdk82NIxBo=; Received: from p54ae9abd.dip0.t-ipconnect.de ([84.174.154.189] helo=maeck-3.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hlovG-0003rb-Av for linux-wireless@vger.kernel.org; Fri, 12 Jul 2019 08:20:46 +0200 Received: by maeck-3.local (Postfix, from userid 501) id A161E61C52AB; Fri, 12 Jul 2019 08:20:45 +0200 (CEST) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 1/4] mt76: mt7615: fix using VHT STBC rates Date: Fri, 12 Jul 2019 08:20:42 +0200 Message-Id: <20190712062045.85109-1-nbd@nbd.name> X-Mailer: git-send-email 2.17.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The hardware expects MT_TX_RATE_NSS to be filled with the number of space/time streams. For non-STBC rates, this is equal to nss. For 1-stream STBC, this needs to be set to 2. This is relevant for VHT rates only, on HT, the value is derived from MCS internally. Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7615/mac.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 5bfb4594b8ee..6c21b2df69c4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -254,7 +254,7 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev, bool stbc, u8 *bw) { u8 phy, nss, rate_idx; - u16 rateval; + u16 rateval = 0; *bw = 0; @@ -292,12 +292,14 @@ mt7615_mac_tx_rate_val(struct mt7615_dev *dev, rate_idx = val & 0xff; } - rateval = (FIELD_PREP(MT_TX_RATE_IDX, rate_idx) | - FIELD_PREP(MT_TX_RATE_MODE, phy) | - FIELD_PREP(MT_TX_RATE_NSS, nss - 1)); - - if (stbc && nss == 1) + if (stbc && nss == 1) { + nss++; rateval |= MT_TX_RATE_STBC; + } + + rateval |= (FIELD_PREP(MT_TX_RATE_IDX, rate_idx) | + FIELD_PREP(MT_TX_RATE_MODE, phy) | + FIELD_PREP(MT_TX_RATE_NSS, nss - 1)); return rateval; } @@ -771,6 +773,10 @@ static bool mt7615_fill_txs(struct mt7615_dev *dev, struct mt7615_sta *sta, break; case MT_PHY_TYPE_VHT: final_nss = FIELD_GET(MT_TX_RATE_NSS, final_rate); + + if ((final_rate & MT_TX_RATE_STBC) && final_nss) + final_nss--; + final_rate_flags |= IEEE80211_TX_RC_VHT_MCS; final_rate = (final_rate & MT_TX_RATE_IDX) | (final_nss << 4); break; -- 2.17.0