diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-11-19 19:08:13 (GMT) |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-11-28 14:01:51 (GMT) |
commit | f027c2aca0cf43e0f15fc8de8841f7b566163d94 (patch) | |
tree | 932656a5a8d8b1048d287dea276c9cf5a29fb10c /net | |
parent | 7e1cdcbb092458f7b0cc247004c43f0b228fc970 (diff) | |
download | linux-f027c2aca0cf43e0f15fc8de8841f7b566163d94.tar.xz |
mac80211: add ieee80211_tx_status_noskb
This can be used by drivers that cannot reliably map tx status
information onto specific skbs.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/rate.h | 18 | ||||
-rw-r--r-- | net/mac80211/status.c | 54 |
2 files changed, 72 insertions, 0 deletions
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h index dd25964..38652f0 100644 --- a/net/mac80211/rate.h +++ b/net/mac80211/rate.h @@ -48,6 +48,24 @@ static inline void rate_control_tx_status(struct ieee80211_local *local, ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info); } +static inline void +rate_control_tx_status_noskb(struct ieee80211_local *local, + struct ieee80211_supported_band *sband, + struct sta_info *sta, + struct ieee80211_tx_info *info) +{ + struct rate_control_ref *ref = local->rate_ctrl; + struct ieee80211_sta *ista = &sta->sta; + void *priv_sta = sta->rate_ctrl_priv; + + if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) + return; + + if (WARN_ON_ONCE(!ref->ops->tx_status_noskb)) + return; + + ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info); +} static inline void rate_control_rate_init(struct sta_info *sta) { diff --git a/net/mac80211/status.c b/net/mac80211/status.c index fee9c5e..bb146f3 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c @@ -656,6 +656,60 @@ static int ieee80211_tx_get_rates(struct ieee80211_hw *hw, return rates_idx; } +void ieee80211_tx_status_noskb(struct ieee80211_hw *hw, + struct ieee80211_sta *pubsta, + struct ieee80211_tx_info *info) +{ + struct ieee80211_local *local = hw_to_local(hw); + struct ieee80211_supported_band *sband; + int retry_count; + int rates_idx; + bool acked; + + rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); + + sband = hw->wiphy->bands[info->band]; + + acked = !!(info->flags & IEEE80211_TX_STAT_ACK); + if (pubsta) { + struct sta_info *sta; + + sta = container_of(pubsta, struct sta_info, sta); + + if (!acked) + sta->tx_retry_failed++; + sta->tx_retry_count += retry_count; + + if (acked) { + sta->last_rx = jiffies; + + if (sta->lost_packets) + sta->lost_packets = 0; + + /* Track when last TDLS packet was ACKed */ + if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) + sta->last_tdls_pkt_time = jiffies; + } else { + ieee80211_lost_packet(sta, info); + } + + rate_control_tx_status_noskb(local, sband, sta, info); + } + + if (acked) { + local->dot11TransmittedFrameCount++; + if (!pubsta) + local->dot11MulticastTransmittedFrameCount++; + if (retry_count > 0) + local->dot11RetryCount++; + if (retry_count > 1) + local->dot11MultipleRetryCount++; + } else { + local->dot11FailedCount++; + } +} +EXPORT_SYMBOL(ieee80211_tx_status_noskb); + void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) { struct sk_buff *skb2; |