Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1646083pxb; Sat, 23 Jan 2021 00:41:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyf63YVeayfKkcIe/JPhchKmeI/pmuRTDeypMtBRN4GMsfBQvFmMulGr8PB//gsMb9wCc+n X-Received: by 2002:a17:906:174f:: with SMTP id d15mr5515313eje.52.1611391280921; Sat, 23 Jan 2021 00:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611391280; cv=none; d=google.com; s=arc-20160816; b=UmtqS+Q9/GjmVrNnv3iVKcW7pAbDxE4ghSGDLJ888kHBDKqFVZ4ySmKyB3+gtfYKiV 1CTUjyQDFdjaRoUQTQ/l7sWpmCn8VAggdr44yhtF5clyft80/utXa1rMiergq8/oYuB0 9pAf8A9Gi/8a7b+wqlhWvlfFyAx20U+6Hk1likd8wrho3zVUMYKHVdGvLHJWxe+ipA7D 8KAPZqVqcNikXtudUdPSVx6HJDLrFPIi4vapAYQZf4/yTi0jw6vwQo7rTdkayVXbmil4 66yct4hU6Bavl5KOOC11ro3TOTcJGMxd9ry9GYMh02Lv954PXfvXfQm0st9qWIPPGsRQ rI/w== 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=/ByBtzdw7C8aSTjwMQKbQP9dR1/Js7IP+9XNlm27LeY=; b=FYx+h8rd1DZbKiaefa1QaKaDHIfbqbnlQts0S8c0jiVH6ezrb40ftBfM5wbxJZ7xs6 ILq8XtkOMNmPsDuHkswyTPEmgWb3AdXN71S0ueynSlBrjYLAlU9zW8gsN9Wr0e3r0YMR 62oZFk+AfJH2eLdt71FYFAGrHOFNAAFvcO+XLPneSRJvovyyRSPrhOnhbtvDQENdDbfR KoFENw2F5pv43M8nR78uoHxveJk4jvjW4vFoO+Rb4wrLxRd5yEu0+YkSlkxk/rUrqu0h fXmWJnrxmbYM39i0GebBXX8Gnr24Q2mitI8JjbvkqgQA/RoNxvj3mdEnsggImExkoLRk UCiw== 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 jz8si3863835ejb.237.2021.01.23.00.40.58; Sat, 23 Jan 2021 00:41:20 -0800 (PST) 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 S1726991AbhAWIho (ORCPT + 99 others); Sat, 23 Jan 2021 03:37:44 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:50154 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726962AbhAWIhf (ORCPT ); Sat, 23 Jan 2021 03:37:35 -0500 X-UUID: 87d39f144a4c4eaf878f0321610781a5-20210123 X-UUID: 87d39f144a4c4eaf878f0321610781a5-20210123 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1572550422; Sat, 23 Jan 2021 16:35:20 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 23 Jan 2021 16:35:18 +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; Sat, 23 Jan 2021 16:35:18 +0800 From: To: , CC: , , , , , , , , , Subject: [PATCH -next v7 22/22] mt76: mt7921: add sta statistics Date: Sat, 23 Jan 2021 16:35:13 +0800 Message-ID: <8885b6803848b5a4302b523d9cf7430c05478280.1611389300.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: EF34D0D19CA955ACC7A0044D39A2FFDDA87272A98BB2A7346AB4CD4CEA8C427A2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Add sta statistics support to query current tx bitrate Co-developed-by: Soul Huang Signed-off-by: Soul Huang Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7921/main.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index cc1fea7d3bb2..2ec1a1270ae8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -1095,6 +1095,31 @@ static void mt7921_set_rekey_data(struct ieee80211_hw *hw, } #endif /* CONFIG_PM */ +static void mt7921_sta_statistics(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct station_info *sinfo) +{ + struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv; + struct mt7921_sta_stats *stats = &msta->stats; + + if (!stats->tx_rate.legacy && !stats->tx_rate.flags) + return; + + if (stats->tx_rate.legacy) { + sinfo->txrate.legacy = stats->tx_rate.legacy; + } else { + sinfo->txrate.mcs = stats->tx_rate.mcs; + sinfo->txrate.nss = stats->tx_rate.nss; + sinfo->txrate.bw = stats->tx_rate.bw; + sinfo->txrate.he_gi = stats->tx_rate.he_gi; + sinfo->txrate.he_dcm = stats->tx_rate.he_dcm; + sinfo->txrate.he_ru_alloc = stats->tx_rate.he_ru_alloc; + } + sinfo->txrate.flags = stats->tx_rate.flags; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); +} + const struct ieee80211_ops mt7921_ops = { .tx = mt7921_tx, .start = mt7921_start, @@ -1132,4 +1157,5 @@ const struct ieee80211_ops mt7921_ops = { .set_wakeup = mt7921_set_wakeup, .set_rekey_data = mt7921_set_rekey_data, #endif /* CONFIG_PM */ + .sta_statistics = mt7921_sta_statistics, }; -- 2.25.1