Skip to contentSkip to conversation

wifi: mac80211: Assign tx-stats to the proper link.

PATCH Superseded [email protected] 1 participant 2 messages Dec 10, 2024

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 wifi: mac80211: Assign tx-stats to the proper link.

From: Ben Greear <[email protected]>

For drivers that can report the tx link-id, account tx stats against that link. If we cannot determine tx link, then use deflink.

---

v4: Reorder patches, use new tx_link_id status field 4 bits wide.

 include/net/mac80211.h |  4 ++-
 net/mac80211/status.c  | 74 ++++++++++++++++++++++++++++++------------
 2 files changed, 56 insertions(+), 22 deletions(-)
include/net/mac80211.h +3 -1
index a97c9f85ae9a..2a90d66f030b 100644
@@ -1276,7 +1276,9 @@ struct ieee80211_tx_info {
 			u8 ampdu_ack_len;
 			u8 ampdu_len;
 			u8 antenna;
-			u8 pad;
+			/* link ID which transmitted + 1 (0 means default or unknown) */
+			u8 tx_link_id:4;
+			u8 pad:4;
 			u16 tx_time;
 			u8 flags;
 			u8 pad2;
net/mac80211/status.c +53 -21

174 lines not on this page · raw message

Signature · 1 line
2.42.0
#1 lore raw

PATCH v4 2/2 wifi: iwlwifi: Report link-id for transmitted frames.

From: Ben Greear <[email protected]>

This will let upper stack properly record stats per link.

---

v4: Reorder patches, use new status tx_link_id field to report what link transmitted the frame.

 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +15 -0
index c9867d26361b..c8b5d5cd3298 100644
@@ -1709,6 +1709,14 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
 	u8 lq_color;
 	u16 next_reclaimed, seq_ctl;
 	bool is_ndp = false;
+	struct ieee80211_link_sta *link_sta;
+	int link_sta_id = -1;
+
+	rcu_read_lock();
+	link_sta = rcu_dereference(mvm->fw_id_to_link_sta[sta_id]);
+	if (link_sta)
+		link_sta_id = link_sta->link_id;
+	rcu_read_unlock();
 
 	__skb_queue_head_init(&skbs);
 
@@ -1732,6 +1740,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
 
 		memset(&info->status, 0, sizeof(info->status));
 		info->flags &= ~(IEEE80211_TX_STAT_ACK | IEEE80211_TX_STAT_TX_FILTERED);
+		info->status.tx_link_id = link_sta_id + 1;
 
 		/* inform mac80211 about what happened with the frame */
 		switch (status & TX_STATUS_MSK) {
@@ -2048,6 +2057,7 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,
 	struct iwl_mvm_sta *mvmsta = NULL;
 	struct sk_buff *skb;
 	int freed;
+	struct ieee80211_link_sta *link_sta;
 
 	if (WARN_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations ||
 		      tid > IWL_MAX_TID_COUNT,
@@ -2064,6 +2074,8 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,
 		return;
 	}
 
+	link_sta = rcu_dereference(mvm->fw_id_to_link_sta[sta_id]);
+
 	__skb_queue_head_init(&reclaimed_skbs);
 
 	/*
@@ -2087,6 +2099,9 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,
 			info->flags |= IEEE80211_TX_STAT_ACK;
 		else
 			info->flags &= ~IEEE80211_TX_STAT_ACK;
+
+		if (link_sta)
+			info->status.tx_link_id = link_sta->link_id + 1;
 	}
 
 	/*
Signature · 1 line
2.42.0