Skip to contentSkip to conversation

ath10k: report tx rate using ieee80211_tx_status()

RFC Superseded Anilkumar Kolli 1 participant 1 message Mar 8, 2018 Qualcomm Atheros ATH10K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 ath10k: report tx rate using ieee80211_tx_status()

Mesh path metric needs txrate information from ieee80211_tx_status() call but in ath10k there is no mechanism to report tx rate information via ieee80211_tx_status(), the rate is only accessible via sta_statiscs() op.

Per peer stats has tx rate info available, this patch stores per peer last tx rate and updates the tx rate info structures in tx completition. The rate updated in ieee80211_tx_status() is not exactly for the last transmitted frame since the actual rate is available in HTT_T2H_MSG_TYPE_PEER_STATS.

Per peer txrate information is updated through per peer statistics and is available for QCA9888/QCA9984/QCA4019/QCA998X only

Tested on QCA9984 with firmware-5.bin_10.4-3.5.3-00053 Tested on QCA998X with firmware-5.bin_10.2.4-1.0-00036

---
 drivers/net/wireless/ath/ath10k/core.h   |    1 +
 drivers/net/wireless/ath/ath10k/htt_rx.c |   97 +++++++++++++++++++++---------
 drivers/net/wireless/ath/ath10k/mac.c    |   13 ----
 drivers/net/wireless/ath/ath10k/txrx.c   |   25 ++++++++
 drivers/net/wireless/ath/ath10k/wmi.h    |    1 +
 5 files changed, 94 insertions(+), 43 deletions(-)
drivers/net/wireless/ath/ath10k/core.h +1 -0
index fe6b30356d3b..d69f0340b487 100644
@@ -346,6 +346,7 @@ struct ath10k_peer {
 
 	/* protected by ar->data_lock */
 	struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
+	struct ieee80211_tx_info tx_info;
 };
 
 struct ath10k_txq {
drivers/net/wireless/ath/ath10k/htt_rx.c +67 -30

150 lines not on this page · raw message

drivers/net/wireless/ath/ath10k/mac.c +0 -13
index ebb3f1b046f3..9cac14a60796 100644
@@ -7655,19 +7655,6 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
 
 	sinfo->rx_duration = arsta->rx_duration;
 	sinfo->filled |= 1ULL << NL80211_STA_INFO_RX_DURATION;
-
-	if (!arsta->txrate.legacy && !arsta->txrate.nss)
-		return;
-
-	if (arsta->txrate.legacy) {
-		sinfo->txrate.legacy = arsta->txrate.legacy;
-	} else {
-		sinfo->txrate.mcs = arsta->txrate.mcs;
-		sinfo->txrate.nss = arsta->txrate.nss;
-		sinfo->txrate.bw = arsta->txrate.bw;
-	}
-	sinfo->txrate.flags = arsta->txrate.flags;
-	sinfo->filled |= 1ULL << NL80211_STA_INFO_TX_BITRATE;
 }
 
 static const struct ieee80211_ops ath10k_ops = {
drivers/net/wireless/ath/ath10k/txrx.c +25 -0
index 70e23bbf7171..408634fa8e12 100644
@@ -60,6 +60,9 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 	struct ath10k_skb_cb *skb_cb;
 	struct ath10k_txq *artxq;
 	struct sk_buff *msdu;
+	struct ieee80211_hdr *hdr;
+	struct ieee80211_vif *vif;
+	struct ath10k_peer *peer;
 
 	ath10k_dbg(ar, ATH10K_DBG_HTT,
 		   "htt tx completion msdu_id %u status %d\n",
@@ -82,6 +85,7 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 
 	skb_cb = ATH10K_SKB_CB(msdu);
 	txq = skb_cb->txq;
+	vif = skb_cb->vif;
 
 	if (txq) {
 		artxq = (void *)txq->drv_priv;
@@ -119,6 +123,27 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 			info->flags &= ~IEEE80211_TX_STAT_ACK;
 	}
 
+	spin_lock_bh(&ar->data_lock);
+	list_for_each_entry(peer, &ar->peers, list) {
+		hdr = (struct ieee80211_hdr *) msdu->data;
+
+		if (ether_addr_equal(peer->addr, vif->addr))
+			continue;
+
+		if (!ether_addr_equal(peer->addr, hdr->addr1))
+			continue;
+
+		info->status.rates[0].idx =
+			peer->tx_info.status.rates[0].idx;
+
+		info->status.rates[0].count =
+			peer->tx_info.status.rates[0].count;
+
+		info->status.rates[0].flags =
+			peer->tx_info.status.rates[0].flags;
+	}
+	spin_unlock_bh(&ar->data_lock);
+
 	ieee80211_tx_status(htt->ar->hw, msdu);
 	/* we do not own the msdu anymore */
 
drivers/net/wireless/ath/ath10k/wmi.h +1 -0
index c7b30ed9015d..1bea1a2c3157 100644
@@ -4819,6 +4819,7 @@ enum wmi_rate_preamble {
 #define ATH10K_HW_GI(flags)		(((flags) >> 5) & 0x1)
 #define ATH10K_HW_RATECODE(rate, nss, preamble) \
 	(((preamble) << 6) | ((nss) << 4) | (rate))
+#define ATH10K_FW_SKIPPED_RATE_CTRL(flags)	(((flags) >> 6) & 0x1)
 
 #define VHT_MCS_NUM     10
 #define VHT_BW_NUM      4
Signature · 1 line
1.7.9.5