Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp385590pxb; Thu, 12 Aug 2021 19:33:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOcTHRowSNkZPy1UigqfEScK9CL/xwpag99nU2m+gvrQhm32C7LZOqWjwO3vHj7NptLEVC X-Received: by 2002:a17:906:49d5:: with SMTP id w21mr283773ejv.30.1628822036338; Thu, 12 Aug 2021 19:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628822036; cv=none; d=google.com; s=arc-20160816; b=QRwkj82w84TjYnheq+PSe3oTSlRyDZU5kzCTvGsWkkdTPOdSMsimMP5upK6iMG7MR7 pW3ZBZr7tVRJ03DemMWDTXusRtqsw6xsmi3/X/RFqSqW28ycbpvojn37Av76TMSD0Y88 tgw0eqNHBJoZqo8WQKaMPPxFqprgDvJnQY70xHmsUFj87kRgoTwhqOKH2Uh/HCXCKQhS UFFjN4bXget13F4qUV0FAcYA0KUGNkvvPCgK2NuPpUn2O0qKKXRCAkoRA3OKd/6Smzpj sytBB5pGjDf+4Ci3XNu6UQfd/1UKl3Xx4yELGGlZJWy0MkQIpZaE0TT2Vmj6syBZaMMj /UbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=KNkbYQaArCmk9cda50rUbOQYGWp03MjS2XYypWvcEnE=; b=qGcZLxIE3F5xA9biVf1mLHZCos5dKO/5598csoozFd1nURX3YxanCaq2L9tYx0fLEE rtcuLNgGu0tw5dOfl44U7xL2jDcTUm9Te4yhYLAglbVIc2ElcyAHFjFrigBwKfKS5mLL 4M6vAC/kD0Yz3m9sOUjXMkph/JB5yXByxvepJ2+HMpVBFBKFP0UBpIb+XBILd10Sl/Z8 6NjCymsBShYOBSA41kVqiNPaW0hkr29oJ7mNTjhffv+Q9frqeqNWgvk9IlHIdUmupgJg v0TXBQ0eCoLs7lJ2GaXlVXyiZ9bUua8SxH8XdF9GN+6wbxnjXzNX2+jXaIKL9zDGvs2X ytng== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si251744edw.295.2021.08.12.19.33.23; Thu, 12 Aug 2021 19:33:56 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238060AbhHMCdD (ORCPT + 99 others); Thu, 12 Aug 2021 22:33:03 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:40754 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237040AbhHMCdD (ORCPT ); Thu, 12 Aug 2021 22:33:03 -0400 X-UUID: b48e3d07b7494116931afa4d87f1e4f4-20210813 X-UUID: b48e3d07b7494116931afa4d87f1e4f4-20210813 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1685313060; Fri, 13 Aug 2021 10:32:34 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Aug 2021 10:32:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 Aug 2021 10:32:34 +0800 From: Ryder Lee To: Felix Fietkau CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , , Ryder Lee Subject: [PATCH v2 1/3] mt76: mt7915: remove mt7915_mcu_add_he() Date: Fri, 13 Aug 2021 10:32:31 +0800 Message-ID: <1c3fc7ff6d5ab129a58160cd878787d9fbeba9c2.1628821139.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Make mt7915_mcu_sta_he_tlv() as a part of mt7915_mcu_add_rate_ctrl() as firmware rate control should get HE rate information from sta_rec_he, and reduce a global function accordingly. Signed-off-by: Ryder Lee --- .../net/wireless/mediatek/mt76/mt7915/mac.c | 6 +-- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 45 +++++++------------ .../wireless/mediatek/mt76/mt7915/mt7915.h | 4 +- 3 files changed, 19 insertions(+), 36 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 667ccb2dab78..5349736eac73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1933,10 +1933,8 @@ void mt7915_mac_sta_rc_work(struct work_struct *work) if (changed & (IEEE80211_RC_SUPP_RATES_CHANGED | IEEE80211_RC_NSS_CHANGED | - IEEE80211_RC_BW_CHANGED)) { - mt7915_mcu_add_he(dev, vif, sta); - mt7915_mcu_add_rate_ctrl(dev, vif, sta); - } + IEEE80211_RC_BW_CHANGED)) + mt7915_mcu_add_rate_ctrl(dev, vif, sta, true); if (changed & IEEE80211_RC_SMPS_CHANGED) mt7915_mcu_add_smps(dev, vif, sta); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index 030d6fba59e9..028ee5bb0532 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2141,41 +2141,27 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev, } int mt7915_mcu_add_rate_ctrl(struct mt7915_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) -{ - struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; - struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; - struct sk_buff *skb; - int len = sizeof(struct sta_req_hdr) + sizeof(struct sta_rec_ra); - - skb = mt7915_mcu_alloc_sta_req(dev, mvif, msta, len); - if (IS_ERR(skb)) - return PTR_ERR(skb); - - mt7915_mcu_sta_rate_ctrl_tlv(skb, dev, vif, sta); - - return mt76_mcu_skb_send_msg(&dev->mt76, skb, - MCU_EXT_CMD(STA_REC_UPDATE), true); -} - -int mt7915_mcu_add_he(struct mt7915_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_sta *sta, bool changed) { struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; struct sk_buff *skb; int len; - if (!sta->he_cap.has_he) - return 0; - - len = sizeof(struct sta_req_hdr) + sizeof(struct sta_rec_he); - + len = sizeof(struct sta_req_hdr) + sizeof(struct sta_rec_ra) + + sizeof(struct sta_rec_he); skb = mt7915_mcu_alloc_sta_req(dev, mvif, msta, len); if (IS_ERR(skb)) return PTR_ERR(skb); - mt7915_mcu_sta_he_tlv(skb, sta); + /* firmware rate control algorithm refers to sta_rec_he for HE rate + * control, so when dev->rc_work changes the settings driver should + * update sta_rec_he here as well. + */ + if (sta->he_cap.has_he && changed) + mt7915_mcu_sta_he_tlv(skb, sta); + + mt7915_mcu_sta_rate_ctrl_tlv(skb, dev, vif, sta); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_EXT_CMD(STA_REC_UPDATE), true); @@ -2214,7 +2200,7 @@ mt7915_mcu_add_mu(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; struct sk_buff *skb; - int ret; + int len, ret; if (!sta->vht_cap.vht_supported && !sta->he_cap.has_he) return 0; @@ -2223,8 +2209,9 @@ mt7915_mcu_add_mu(struct mt7915_dev *dev, struct ieee80211_vif *vif, if (ret) return ret; - skb = mt7915_mcu_alloc_sta_req(dev, mvif, msta, - MT7915_STA_UPDATE_MAX_SIZE); + len = sizeof(struct sta_req_hdr) + sizeof(struct sta_rec_muru) + + sizeof(struct sta_rec_vht); + skb = mt7915_mcu_alloc_sta_req(dev, mvif, msta, len); if (IS_ERR(skb)) return PTR_ERR(skb); @@ -2256,7 +2243,7 @@ int mt7915_mcu_add_sta_adv(struct mt7915_dev *dev, struct ieee80211_vif *vif, if (ret) return ret; - return mt7915_mcu_add_rate_ctrl(dev, vif, sta); + return mt7915_mcu_add_rate_ctrl(dev, vif, sta, false); } int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index 1f5065ed6a59..f842452af897 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -324,9 +324,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int mt7915_mcu_add_obss_spr(struct mt7915_dev *dev, struct ieee80211_vif *vif, bool enable); int mt7915_mcu_add_rate_ctrl(struct mt7915_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); -int mt7915_mcu_add_he(struct mt7915_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); + struct ieee80211_sta *sta, bool changed); int mt7915_mcu_add_smps(struct mt7915_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta); int mt7915_set_channel(struct mt7915_phy *phy); -- 2.29.2