aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-11-19 14:08:13 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-11-28 09:01:51 -0500
commitf027c2aca0cf43e0f15fc8de8841f7b566163d94 (patch)
tree932656a5a8d8b1048d287dea276c9cf5a29fb10c
parent7e1cdcbb092458f7b0cc247004c43f0b228fc970 (diff)
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>
-rw-r--r--include/net/mac80211.h20
-rw-r--r--net/mac80211/rate.h18
-rw-r--r--net/mac80211/status.c54
3 files changed, 92 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 01dfd22e45fd..58d719ddaa60 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3619,6 +3619,26 @@ void ieee80211_tx_status(struct ieee80211_hw *hw,
3619 struct sk_buff *skb); 3619 struct sk_buff *skb);
3620 3620
3621/** 3621/**
3622 * ieee80211_tx_status_noskb - transmit status callback without skb
3623 *
3624 * This function can be used as a replacement for ieee80211_tx_status
3625 * in drivers that cannot reliably map tx status information back to
3626 * specific skbs.
3627 *
3628 * Calls to this function for a single hardware must be synchronized
3629 * against each other. Calls to this function, ieee80211_tx_status_ni()
3630 * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
3631 *
3632 * @hw: the hardware the frame was transmitted by
3633 * @sta: the receiver station to which this packet is sent
3634 * (NULL for multicast packets)
3635 * @info: tx status information
3636 */
3637void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
3638 struct ieee80211_sta *sta,
3639 struct ieee80211_tx_info *info);
3640
3641/**
3622 * ieee80211_tx_status_ni - transmit status callback (in process context) 3642 * ieee80211_tx_status_ni - transmit status callback (in process context)
3623 * 3643 *
3624 * Like ieee80211_tx_status() but can be called in process context. 3644 * Like ieee80211_tx_status() but can be called in process context.
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index dd25964a300a..38652f09feaf 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,
48 ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info); 48 ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
49} 49}
50 50
51static inline void
52rate_control_tx_status_noskb(struct ieee80211_local *local,
53 struct ieee80211_supported_band *sband,
54 struct sta_info *sta,
55 struct ieee80211_tx_info *info)
56{
57 struct rate_control_ref *ref = local->rate_ctrl;
58 struct ieee80211_sta *ista = &sta->sta;
59 void *priv_sta = sta->rate_ctrl_priv;
60
61 if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
62 return;
63
64 if (WARN_ON_ONCE(!ref->ops->tx_status_noskb))
65 return;
66
67 ref->ops->tx_status_noskb(ref->priv, sband, ista, priv_sta, info);
68}
51 69
52static inline void rate_control_rate_init(struct sta_info *sta) 70static inline void rate_control_rate_init(struct sta_info *sta)
53{ 71{
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index fee9c5ee51ae..bb146f377ee4 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,
656 return rates_idx; 656 return rates_idx;
657} 657}
658 658
659void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
660 struct ieee80211_sta *pubsta,
661 struct ieee80211_tx_info *info)
662{
663 struct ieee80211_local *local = hw_to_local(hw);
664 struct ieee80211_supported_band *sband;
665 int retry_count;
666 int rates_idx;
667 bool acked;
668
669 rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count);
670
671 sband = hw->wiphy->bands[info->band];
672
673 acked = !!(info->flags & IEEE80211_TX_STAT_ACK);
674 if (pubsta) {
675 struct sta_info *sta;
676
677 sta = container_of(pubsta, struct sta_info, sta);
678
679 if (!acked)
680 sta->tx_retry_failed++;
681 sta->tx_retry_count += retry_count;
682
683 if (acked) {
684 sta->last_rx = jiffies;
685
686 if (sta->lost_packets)
687 sta->lost_packets = 0;
688
689 /* Track when last TDLS packet was ACKed */
690 if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH))
691 sta->last_tdls_pkt_time = jiffies;
692 } else {
693 ieee80211_lost_packet(sta, info);
694 }
695
696 rate_control_tx_status_noskb(local, sband, sta, info);
697 }
698
699 if (acked) {
700 local->dot11TransmittedFrameCount++;
701 if (!pubsta)
702 local->dot11MulticastTransmittedFrameCount++;
703 if (retry_count > 0)
704 local->dot11RetryCount++;
705 if (retry_count > 1)
706 local->dot11MultipleRetryCount++;
707 } else {
708 local->dot11FailedCount++;
709 }
710}
711EXPORT_SYMBOL(ieee80211_tx_status_noskb);
712
659void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) 713void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
660{ 714{
661 struct sk_buff *skb2; 715 struct sk_buff *skb2;