Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp329279pxj; Tue, 1 Jun 2021 23:41:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUL+kdSOD1UZw+jVHUCTGUBdg2cb90DnBj23OTU3vQqvaV0at/JR+72jrzd/0ulq0N/vNT X-Received: by 2002:a05:6402:3594:: with SMTP id y20mr37010993edc.63.1622616117887; Tue, 01 Jun 2021 23:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622616117; cv=none; d=google.com; s=arc-20160816; b=EX+Ug/638g/mpzw6dN/3gmmrCeeidIabR0o95gP8oFGlYgXPMh8Djuta1tXyK88nl8 4Z2UelbAMWAgSJy1DFf6ckcQu7qQtK3z+Kgv14VOG6MQlmj914HC+vgWlMWt7N70Tfbr 9M9ism0/jTmH2stgc5B0DjFIvOmXt/ohyliEl0YxAYJikSofddTt/x/NP+C0vIQLMDba GFqreGKGyR6+RF+PLJz0GuK8tv/khQLLWEN8shBpgZ9kpyuBDhkf0Uc3tXg8m/6wkQXH I9xHYGLFSRF902jjX1oiEBNkHc9IK6pdT+ZPMuv+njiVE0TrhYJ4/nPNhLfMpoliwU+A zIBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=SYMSVEEcus5HJs1m1TJJPbWhwes2aJwknKgCPzkmOCc=; b=YCLBKTMcNAwX8BPfaWvzfs2LawwCzvbR5mwBkgGhVN4Xz9p/7hjoVfRFlF8ElRfMsf yGmperb+/KwW2zcfc99AZ2TD35u0DAb8AaWWxSZEr43nYTo73sKpm1Zm2gixFNTxpLg1 e9af23QDwD1fEajIC8sRsWlbl155/n+8usC/HkATpTLFI8rmkn0ASYrFofI4/Hu0wkbi dNGQia/xcy2WzaK1x3reabXWvVIl+mSy4VEJXhItKPP0lLAvtaBqncZNWKcWNDRXEJ7O 9vH52zVqMHWDh6ix2/yFdd6pJtcIdfRqZcdpmX8EynG0OYxtBz+qM3IiLIYYuBtMhB94 +K7w== 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 z27si18148593ejc.287.2021.06.01.23.41.32; Tue, 01 Jun 2021 23:41:57 -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 S229981AbhFBF0t (ORCPT + 99 others); Wed, 2 Jun 2021 01:26:49 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:33042 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229637AbhFBF0s (ORCPT ); Wed, 2 Jun 2021 01:26:48 -0400 X-UUID: 67648dd547c04139900e449759fae694-20210602 X-UUID: 67648dd547c04139900e449759fae694-20210602 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 661833872; Wed, 02 Jun 2021 13:25:03 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 2 Jun 2021 13:25:01 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 2 Jun 2021 13:25:01 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH v2 2/3] mt76: mt7921: add mt7921_mcu_sta_update support Date: Wed, 2 Jun 2021 13:24:52 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Add mt7921_mcu_sta_update support to make we are able to update the station record with the current state the station has into the mt7921 firmware at runtime. That is the prerequisite patch to fix .sta_state incorrect implementation for the mt7921 driver. Signed-off-by: Sean Wang --- v1->v2: no change --- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 20 +++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index 631f408520c9..3f53bd9b2b55 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -1342,6 +1342,26 @@ int mt7921_mcu_sta_add(struct mt7921_dev *dev, struct ieee80211_sta *sta, return mt76_connac_mcu_add_sta_cmd(&dev->mphy, &info); } +int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta, + struct ieee80211_vif *vif, u8 state) +{ + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + int rssi = -ewma_rssi_read(&mvif->rssi); + struct mt76_sta_cmd_info info = { + .sta = sta, + .vif = vif, + .enable = true, + .state = state, + .cmd = MCU_UNI_CMD_STA_REC_UPDATE, + .rcpi = to_rcpi(rssi), + }; + struct mt7921_sta *msta; + + msta = sta ? (struct mt7921_sta *)sta->drv_priv : NULL; + info.wcid = msta ? &msta->wcid : &mvif->sta.wcid; + return mt76_connac_mcu_update_sta_cmd(&dev->mphy, &info); +} + int __mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev) { struct mt76_phy *mphy = &dev->mt76.phy; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h index 694f85e52222..13d0f472b043 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -262,6 +262,8 @@ int mt7921_mcu_add_key(struct mt7921_dev *dev, struct ieee80211_vif *vif, int mt7921_set_channel(struct mt7921_phy *phy); int mt7921_mcu_sta_add(struct mt7921_dev *dev, struct ieee80211_sta *sta, struct ieee80211_vif *vif, bool enable, u8 state); +int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta, + struct ieee80211_vif *vif, u8 state); int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd); int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif); int mt7921_mcu_set_eeprom(struct mt7921_dev *dev); -- 2.25.1