Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: implement ieee80211_tx_rate_update to update rate

Current mac80211 has provision to update tx status through
ieee80211_tx_status() and ieee80211_tx_status_ext(). But
drivers like ath10k updates the tx status from the skb except
txrate, txrate will be updated from a different path, peer stats.

Using ieee80211_tx_status_ext() in two different paths
(one for the stats, one for the tx rate) would duplicate
the stats instead.

To avoid this stats duplication, ieee80211_tx_rate_update()
is implemented.

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
[minor commit message editing, use initializers in code]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Anilkumar Kolli and committed by
Johannes Berg
f8252e7b 0d4e14a3

+34
+15
include/net/mac80211.h
··· 4380 4380 u32 thr); 4381 4381 4382 4382 /** 4383 + * ieee80211_tx_rate_update - transmit rate update callback 4384 + * 4385 + * Drivers should call this functions with a non-NULL pub sta 4386 + * This function can be used in drivers that does not have provision 4387 + * in updating the tx rate in data path. 4388 + * 4389 + * @hw: the hardware the frame was transmitted by 4390 + * @pubsta: the station to update the tx rate for. 4391 + * @info: tx status information 4392 + */ 4393 + void ieee80211_tx_rate_update(struct ieee80211_hw *hw, 4394 + struct ieee80211_sta *pubsta, 4395 + struct ieee80211_tx_info *info); 4396 + 4397 + /** 4383 4398 * ieee80211_tx_status - transmit status callback 4384 4399 * 4385 4400 * Call this function for all transmitted frames after they have been
+19
net/mac80211/status.c
··· 987 987 } 988 988 EXPORT_SYMBOL(ieee80211_tx_status_ext); 989 989 990 + void ieee80211_tx_rate_update(struct ieee80211_hw *hw, 991 + struct ieee80211_sta *pubsta, 992 + struct ieee80211_tx_info *info) 993 + { 994 + struct ieee80211_local *local = hw_to_local(hw); 995 + struct ieee80211_supported_band *sband = hw->wiphy->bands[info->band]; 996 + struct sta_info *sta = container_of(pubsta, struct sta_info, sta); 997 + struct ieee80211_tx_status status = { 998 + .info = info, 999 + .sta = pubsta, 1000 + }; 1001 + 1002 + rate_control_tx_status(local, sband, &status); 1003 + 1004 + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) 1005 + sta->tx_stats.last_rate = info->status.rates[0]; 1006 + } 1007 + EXPORT_SYMBOL(ieee80211_tx_rate_update); 1008 + 990 1009 void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets) 991 1010 { 992 1011 struct sta_info *sta = container_of(pubsta, struct sta_info, sta);