From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=46.4.11.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795980702; b=Ga+Rq8kNLDqzEi+07W1WWigCvRq9jkLvAdrwQRyL6wRQbh2Xg3bQSd+zhsAsY+xIZUTk P5EDSfH9jhIaZpqXTZKcT3iy36I0TdC/v+pMqFOMpJmK13oan0nXhWZG8ifqo8MNE2wQt GFq8D7TA+64CFuYmXCd9/TLCLfE6IxmJFtFmgS5s99oHL2fsbcxm1zNtJ6Hsrn63zCTDG a3Ri1SICS+FHVhCRrkWRLlAInn327Pi0oBBd41Ujaea7zCIFe/E75B5y3L+0DzlTLaR77 pQOz4HpzPtznfzljKYWxFS5w8kmVd2r5saWS0a7kLh2+AbO1I9qoMYcojxEQUWSK4SQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795980702; h=DMARC-Filter:DKIM-Signature:Received:From:To:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=s+BuS5VS3mx5jEgNh5dygZE6Gg91q26AtS2psJEs+ws=; b=PjixngqWB5ZwZAY5IetrLE2UX7MUCCpmODjbBRRDTmXGntKQ1ga1mDR1YKJ9JkZwYiUj DFwsVdH90l7Z/5mXOUS3hDAMn5dLc+c8M7D5NrGN+gZBNPlmqV+X9b0XgRJ+ckUAl24fn DmRiw1JH713h+Pw6Ngel/DyVW/YXYfPAvBPWqCtefnMhqn9EUeGiD8DtHlMrFP2HJzi/l hZ0uWqe/kGcj6NQThIsANe/KOnKWgcYX+zbNYLmXQ/w7CPjEesXy8jEQAoU2DLpZJcMl3 hK+ubzrOT83yUsEAHZQKHcV2fQwfeKD5HvakGFvRQeYAKijQn44E/NG065dSVxnLqgw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=nbd.name; spf=pass smtp.mailfrom=nbd.name; dkim=pass header.d=nbd.name header.i=@nbd.name header.a=rsa-sha256 header.s=20160729 header.b=LyLPLJCr; arc=none smtp.remote-ip=46.4.11.11 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B192606A327 for ; Sun, 29 Nov 2026 19:31:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B192606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nbd.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nbd.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nbd.name header.i=@nbd.name header.a=rsa-sha256 header.s=20160729 header.b=LyLPLJCr DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=s+BuS5VS3mx5jEgNh5dygZE6Gg91q26AtS2psJEs+ws=; b=LyLPLJCr5oWzUg8HgfCBrHpYwn cxiijnPJU4ALSEZQEc9BcLGulDzMckMPBYhPVvZVKCukJmKdI65L16prniyliuAb8wJlErgWOGsAy E9X9IlBLBF+24OFtI6fClh/8JCzKEQBlu7Xc/G8/ob682eeRVB0R3CgZ3Eq52G08lTSc=; Received: from p200300cadf03580000000000000005bb.dip0.t-ipconnect.de ([2003:ca:df03:5800::5bb] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xXkcX-009vfL-25 for linux-wireless@vger.kernel.org; Sun, 29 Nov 2026 20:31:33 +0100 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH mt76-next 02/20] wifi: mt76: mt7996: report the TX statistics of each link of a station Date: Sun, 29 Nov 2026 20:31:12 +0100 Message-ID: <20261129193131.3367661-2-nbd@nbd.name> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261129193131.3367661-1-nbd@nbd.name> References: <20261129193131.3367661-1-nbd@nbd.name> X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The TXD of QoS data of an MLD peer names the wcid of one of two links. Even TIDs take the default link, and odd TIDs take the secondary link. The TX free and the TX status count on the wcid of the TXD. With WED, the firmware also reports the byte and packet counts per link wcid. mt7996_sta_statistics() and mt7996_ethtool_worker() read the counters of the default link alone, so the counts of the other links are lost. Report the sum over the link wcids of the station, in the station info and in the ethtool statistics. Fixes: 85cd5534a3f2 ("wifi: mt76: mt7996: use correct link_id when filling TXD and TXP") Signed-off-by: Felix Fietkau --- .../net/wireless/mediatek/mt76/mt7996/main.c | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 7e5bf40c257d..5b0f6f931de4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -2575,10 +2575,13 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct station_info *sinfo) { + u32 tx_packets = 0, rx_packets = 0, tx_failed = 0, tx_retries = 0; struct mt7996_dev *dev = mt7996_hw_dev(hw); struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; struct mt7996_sta_link *msta_link; + u64 tx_bytes = 0, rx_bytes = 0; struct rate_info *txrate; + unsigned int link_id; rcu_read_lock(); @@ -2603,10 +2606,24 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); } - sinfo->tx_failed = msta_link->wcid.stats.tx_failed; + for (link_id = 0; link_id < ARRAY_SIZE(msta->link); link_id++) { + struct mt7996_sta_link *iter = mt7996_sta_link(msta, link_id); + + if (!iter) + continue; + + tx_failed += iter->wcid.stats.tx_failed; + tx_retries += iter->wcid.stats.tx_retries; + tx_bytes += iter->wcid.stats.tx_bytes; + rx_bytes += iter->wcid.stats.rx_bytes; + tx_packets += iter->wcid.stats.tx_packets; + rx_packets += iter->wcid.stats.rx_packets; + } + + sinfo->tx_failed = tx_failed; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED); - sinfo->tx_retries = msta_link->wcid.stats.tx_retries; + sinfo->tx_retries = tx_retries; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES); sinfo->ack_signal = (s8)msta_link->ack_signal; @@ -2617,16 +2634,16 @@ static void mt7996_sta_statistics(struct ieee80211_hw *hw, sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); if (mtk_wed_device_active(&dev->mt76.mmio.wed)) { - sinfo->tx_bytes = msta_link->wcid.stats.tx_bytes; + sinfo->tx_bytes = tx_bytes; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64); - sinfo->rx_bytes = msta_link->wcid.stats.rx_bytes; + sinfo->rx_bytes = rx_bytes; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES64); - sinfo->tx_packets = msta_link->wcid.stats.tx_packets; + sinfo->tx_packets = tx_packets; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS); - sinfo->rx_packets = msta_link->wcid.stats.rx_packets; + sinfo->rx_packets = rx_packets; sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS); } @@ -2919,15 +2936,16 @@ static void mt7996_ethtool_worker(void *wi_data, struct ieee80211_sta *sta) struct mt76_ethtool_worker_info *wi = wi_data; struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv; struct mt7996_sta_link *msta_link; + unsigned int link_id; if (msta->vif->deflink.mt76.idx != wi->idx) return; - msta_link = mt7996_sta_link(msta, msta->deflink_id); - if (!msta_link) - return; - - mt76_ethtool_worker(wi, &msta_link->wcid.stats, true); + for (link_id = 0; link_id < ARRAY_SIZE(msta->link); link_id++) { + msta_link = mt7996_sta_link(msta, link_id); + if (msta_link) + mt76_ethtool_worker(wi, &msta_link->wcid.stats, true); + } } static -- 2.47.3