Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Felix Fietkau <nbd@nbd.name>
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
Date: Sun, 29 Nov 2026 21:51:30 +0100	[thread overview]
Message-ID: <awyQUr9xDmJQ5JXx@lore-desk> (raw)
In-Reply-To: <20261129193131.3367661-2-nbd@nbd.name>

[-- Attachment #1: Type: text/plain, Size: 4327 bytes --]

> 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 <nbd@nbd.name>

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
>  .../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
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-11-29 20:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 19:31 [PATCH mt76-next 01/20] wifi: mt76: mt7996: hold the wiphy lock in the L1 SER reset work Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 02/20] wifi: mt76: mt7996: report the TX statistics of each link of a station Felix Fietkau
2026-11-29 20:51   ` Lorenzo Bianconi [this message]
2026-11-29 19:31 ` [PATCH mt76-next 03/20] wifi: mt76: mt7996: stop the hardware when the probe fails Felix Fietkau
2026-11-29 20:45   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 04/20] wifi: mt76: mt7996: clean up the DMA when the NPU RX queue init fails Felix Fietkau
2026-11-29 20:36   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 05/20] wifi: mt76: mt7996: name the link and the error of a failed key install Felix Fietkau
2026-11-29 20:42   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 06/20] wifi: mt76: mt7925: send the HE capabilities of each link of a peer Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 07/20] wifi: mt76: connac: mask the LDPC capabilities of an AP peer Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 08/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 09/20] wifi: mt76: mt7996: read the EHT capabilities of a station as LE Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 10/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-29 20:47   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 11/20] wifi: mt76: mt7615: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 20:43   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 12/20] wifi: mt76: connac: drop a first fragment without an Ethernet header Felix Fietkau
2026-11-29 20:43   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 13/20] wifi: mt76: mt7915: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 20:47   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 14/20] wifi: mt76: mt7921: " Felix Fietkau
2026-11-29 20:47   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-29 20:51   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 16/20] wifi: mt76: mt7925: bound the header gap by the linear data of a frame Felix Fietkau
2026-11-29 20:45   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 17/20] wifi: mt76: mt7921: fix out-of-bounds read in mt7921_mac_add_txs Felix Fietkau
2026-11-29 20:42   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 18/20] wifi: mt76: mt7925: fix out-of-bounds read in mt7925_mac_add_txs Felix Fietkau
2026-11-29 20:41   ` Lorenzo Bianconi
2026-11-29 19:31 ` [PATCH mt76-next 19/20] wifi: mt76: mt7925: apply the dwell time of a scan request Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 20/20] wifi: mt76: connac: apply the dwell time of a scan request on mt7663 Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awyQUr9xDmJQ5JXx@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox