Skip to contentSkip to conversation

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

PATCH Superseded [email protected] 1 participant 2 messages Sep 9, 2024

Subsystems (2)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

If mac80211 sets the link-id, and driver does not change that value, then the tx-stats will be applied against the link-id set by mac80211.

---
 include/net/mac80211.h |  2 ++
 net/mac80211/status.c  | 82 ++++++++++++++++++++++++++++--------------
 2 files changed, 58 insertions(+), 26 deletions(-)
include/net/mac80211.h +2 -0
index 0a04eaf5343c..49d4f3c4faa3 100644
@@ -1320,6 +1320,7 @@ struct ieee80211_rate_status {
  * @info: Basic tx status information
  * @skb: Packet skb (can be NULL if not provided by the driver)
  * @rates: Mrr stages that were used when sending the packet
+ * @link_sta: link that attempted to transmit the skb
  * @n_rates: Number of mrr stages (count of instances for @rates)
  * @free_list: list where processed skbs are stored to be free'd by the driver
  * @ack_hwtstamp: Hardware timestamp of the received ack in nanoseconds
@@ -1331,6 +1332,7 @@ struct ieee80211_tx_status {
 	struct ieee80211_tx_info *info;
 	struct sk_buff *skb;
 	struct ieee80211_rate_status *rates;
+	struct link_sta_info *link_sta;
 	ktime_t ack_hwtstamp;
 	u8 n_rates;
 
net/mac80211/status.c +56 -26

200 lines not on this page · raw message

Signature · 1 line
2.42.0
#1 lore raw

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

---
 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 7ff5ea5e7aca..105f9029be2f 100644
@@ -1707,6 +1707,9 @@ 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;
+
+	link_sta = rcu_dereference(mvm->fw_id_to_link_sta[sta_id]);
 
 	__skb_queue_head_init(&skbs);
 
@@ -1730,6 +1733,10 @@ 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);
+		if (link_sta) {
+			info->control.flags &= ~(u32_encode_bits(0xF, IEEE80211_TX_CTRL_MLO_LINK));
+			info->control.flags |= u32_encode_bits(link_sta->link_id, IEEE80211_TX_CTRL_MLO_LINK);
+		}
 
 		/* inform mac80211 about what happened with the frame */
 		switch (status & TX_STATUS_MSK) {
@@ -2046,6 +2053,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,
@@ -2062,6 +2070,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);
 
 	/*
@@ -2085,6 +2095,11 @@ 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->control.flags &= ~(u32_encode_bits(0xF, IEEE80211_TX_CTRL_MLO_LINK));
+			info->control.flags |= u32_encode_bits(link_sta->link_id, IEEE80211_TX_CTRL_MLO_LINK);
+		}
 	}
 
 	/*
Signature · 1 line
2.42.0