From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795985493; b=tKAzbNAblWNkjvImPLFzVY6qz0ZHEwxti/djNy1TAKPnzyimmYszC1C0f5wsv+U9M7Zx tuNqp1G6Ic2CXpfSTSpUlxzWQNFzW5yhjyCAETjFfaJO/ziwJ3gwzagk4+sy/FTlQNGNG G+UNYZvo6kymQcbAyr311ZGMgmlY3B/HSsuqgXF3T3+eOxrN4upcY0xEaIm4/OZppCAHH QRSe2apc5juPlscSIT5lUdDqbzAOB/nAuAY5DfPJA9rnLp/ycySK8NwkiOatMpjGfvdKV 4gltPmyeSzJyYFS7ppckF3pbS2nzQKc0wOUvHIpIL/n9sI6+aH10uzBgO9stCv01i4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795985493; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=owjal6rrlW530nVykWdGbXbIq8Iqz+WnwE9YCTNDiCA=; b=qK8U8x+M8LoI/rwgTnBnmyb/hE2zHqHlt/07PflZAAlcMHtnLRl1CyIEmJJ7xggUWbHa TLI4/D0mnH4MVUmCcHR3hWlJJuiSqFptwcGyH0tw26M2H5pV/aIZA9elfJDxqHxn0rtpJ ohPjip3hUB3ph6cT13T4Beu0Vu1MP0QiTI1LmHMnDQkS8EuqvCxm0r7+lpYjiYmy0qMTp e/Om7QQd3uHXHA6JnV1Ws+8XRekCo2//bjw7KYCm0BDu+D5VLGvY8vJSUlYqKOUy5uT3K DryCX/DsHyf3RyhJLcTOIPryRAOGUyVd7c/u24GR205ScO04kX0wBbzpqmGsHeXUL1Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="dd/COF45"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F3D3606A31C for ; Sun, 29 Nov 2026 20:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dd/COF45 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 864881F00897; Sun, 29 Nov 2026 20:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795985493; bh=owjal6rrlW530nVykWdGbXbIq8Iqz+WnwE9YCTNDiCA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dd/COF45xttKDX0mRncYppr9DEsTaN02MmWGdoe8LHqIJtOJ4/RbHpoubt4tiXvL1 JYDrIbhfN9rS/AswHxYB15OJRaiXe9cp5DxCD20LhN75oTk4vkiyOxiHz9H3ia6LyY 024GcywaR4aYpiBujgixaNqljoskdvvjMDCYxq4nzCb20W3vgYS9s+mllLhG9Dc9cM I/KJfI/E3qqBTzQcSIap7r1C3htpMGd3QHbhBpqp85sC9fTt9M4xVBhE2rWcQ9zzBk 1ifF/lmpH+yuPOC2T8qjMWZR4KJRALu6BPm+spXQYSqufhaDXPs9sC8tcyNuWoZruR dgGHHWJ7S8reg== Date: Sun, 29 Nov 2026 21:51:30 +0100 From: Lorenzo Bianconi To: Felix Fietkau Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCH mt76-next 02/20] wifi: mt76: mt7996: report the TX statistics of each link of a station Message-ID: References: <20261129193131.3367661-1-nbd@nbd.name> <20261129193131.3367661-2-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-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f3WzfHtLzzS44vXc" Content-Disposition: inline In-Reply-To: <20261129193131.3367661-2-nbd@nbd.name> --f3WzfHtLzzS44vXc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > 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. >=20 > Report the sum over the link wcids of the station, in the station info > and in the ethtool statistics. >=20 > Fixes: 85cd5534a3f2 ("wifi: mt76: mt7996: use correct link_id when fillin= g TXD and TXP") > Signed-off-by: Felix Fietkau Reviewed-by: Lorenzo Bianconi > --- > .../net/wireless/mediatek/mt76/mt7996/main.c | 40 ++++++++++++++----- > 1 file changed, 29 insertions(+), 11 deletions(-) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/n= et/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 ieee8021= 1_hw *hw, > struct ieee80211_sta *sta, > struct station_info *sinfo) > { > + u32 tx_packets =3D 0, rx_packets =3D 0, tx_failed =3D 0, tx_retries =3D= 0; > struct mt7996_dev *dev =3D mt7996_hw_dev(hw); > struct mt7996_sta *msta =3D (struct mt7996_sta *)sta->drv_priv; > struct mt7996_sta_link *msta_link; > + u64 tx_bytes =3D 0, rx_bytes =3D 0; > struct rate_info *txrate; > + unsigned int link_id; > =20 > rcu_read_lock(); > =20 > @@ -2603,10 +2606,24 @@ static void mt7996_sta_statistics(struct ieee8021= 1_hw *hw, > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_TX_BITRATE); > } > =20 > - sinfo->tx_failed =3D msta_link->wcid.stats.tx_failed; > + for (link_id =3D 0; link_id < ARRAY_SIZE(msta->link); link_id++) { > + struct mt7996_sta_link *iter =3D mt7996_sta_link(msta, link_id); > + > + if (!iter) > + continue; > + > + tx_failed +=3D iter->wcid.stats.tx_failed; > + tx_retries +=3D iter->wcid.stats.tx_retries; > + tx_bytes +=3D iter->wcid.stats.tx_bytes; > + rx_bytes +=3D iter->wcid.stats.rx_bytes; > + tx_packets +=3D iter->wcid.stats.tx_packets; > + rx_packets +=3D iter->wcid.stats.rx_packets; > + } > + > + sinfo->tx_failed =3D tx_failed; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_TX_FAILED); > =20 > - sinfo->tx_retries =3D msta_link->wcid.stats.tx_retries; > + sinfo->tx_retries =3D tx_retries; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_TX_RETRIES); > =20 > sinfo->ack_signal =3D (s8)msta_link->ack_signal; > @@ -2617,16 +2634,16 @@ static void mt7996_sta_statistics(struct ieee8021= 1_hw *hw, > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG); > =20 > if (mtk_wed_device_active(&dev->mt76.mmio.wed)) { > - sinfo->tx_bytes =3D msta_link->wcid.stats.tx_bytes; > + sinfo->tx_bytes =3D tx_bytes; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_TX_BYTES64); > =20 > - sinfo->rx_bytes =3D msta_link->wcid.stats.rx_bytes; > + sinfo->rx_bytes =3D rx_bytes; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_RX_BYTES64); > =20 > - sinfo->tx_packets =3D msta_link->wcid.stats.tx_packets; > + sinfo->tx_packets =3D tx_packets; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_TX_PACKETS); > =20 > - sinfo->rx_packets =3D msta_link->wcid.stats.rx_packets; > + sinfo->rx_packets =3D rx_packets; > sinfo->filled |=3D BIT_ULL(NL80211_STA_INFO_RX_PACKETS); > } > =20 > @@ -2919,15 +2936,16 @@ static void mt7996_ethtool_worker(void *wi_data, = struct ieee80211_sta *sta) > struct mt76_ethtool_worker_info *wi =3D wi_data; > struct mt7996_sta *msta =3D (struct mt7996_sta *)sta->drv_priv; > struct mt7996_sta_link *msta_link; > + unsigned int link_id; > =20 > if (msta->vif->deflink.mt76.idx !=3D wi->idx) > return; > =20 > - msta_link =3D mt7996_sta_link(msta, msta->deflink_id); > - if (!msta_link) > - return; > - > - mt76_ethtool_worker(wi, &msta_link->wcid.stats, true); > + for (link_id =3D 0; link_id < ARRAY_SIZE(msta->link); link_id++) { > + msta_link =3D mt7996_sta_link(msta, link_id); > + if (msta_link) > + mt76_ethtool_worker(wi, &msta_link->wcid.stats, true); > + } > } > =20 > static > --=20 > 2.47.3 >=20 >=20 --f3WzfHtLzzS44vXc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCawyQUgAKCRA6cBh0uS2t rBcEAQC0exnFZ4M9nRS/MxJVWXVtSzDqxHc1e+17g2g1BHD65AD+O8w8WOESLBVJ j82a4Efu+tb+XwgsrF7NGHedQoh9RgM= =rB91 -----END PGP SIGNATURE----- --f3WzfHtLzzS44vXc--