mac80211: rate control status only for controlled packets
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 23 Mar 2009 13:10:22 +0000 (14:10 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Mar 2009 00:13:15 +0000 (20:13 -0400)
This patch changes mac80211 to not notify the rate control algorithm's
tx_status() method when reporting status for a packet that didn't go
through the rate control algorithm's get_rate() method.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/net/mac80211.h
net/mac80211/rate.c
net/mac80211/rate.h

index d881ed8ad2c1b114a68a346e43c4dd648f9fc75b..6f3bc4cc53e550a6f53cafe1ac903854e6f5c079 100644 (file)
@@ -245,6 +245,9 @@ struct ieee80211_bss_conf {
  * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
  *     set by rate control algorithms to indicate probe rate, will
  *     be cleared for fragmented frames (except on the last fragment)
+ * @IEEE80211_TX_INTFL_RCALGO: mac80211 internal flag, do not test or
+ *     set this flag in the driver; indicates that the rate control
+ *     algorithm was used and should be notified of TX status
  */
 enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_REQ_TX_STATUS          = BIT(0),
@@ -260,6 +263,7 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_STAT_AMPDU                 = BIT(10),
        IEEE80211_TX_STAT_AMPDU_NO_BACK         = BIT(11),
        IEEE80211_TX_CTL_RATE_CTRL_PROBE        = BIT(12),
+       IEEE80211_TX_INTFL_RCALGO               = BIT(13),
 };
 
 /**
index 3fa7ab285066a46c5200d49c4ca06e4c56ff5456..4641f00a1e5cbfd005d4719d4925ac5a61fb58e0 100644 (file)
@@ -219,10 +219,12 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
                info->control.rates[i].count = 1;
        }
 
-       if (sta && sdata->force_unicast_rateidx > -1)
+       if (sta && sdata->force_unicast_rateidx > -1) {
                info->control.rates[0].idx = sdata->force_unicast_rateidx;
-       else
+       } else {
                ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
+               info->flags |= IEEE80211_TX_INTFL_RCALGO;
+       }
 
        /*
         * try to enforce the maximum rate the user wanted
index b9164c9a9563750ebd1f604931d0548b3242be07..2ab5ad9e71ce206a7c93efce93c80a4ce75c42b5 100644 (file)
@@ -44,8 +44,10 @@ static inline void rate_control_tx_status(struct ieee80211_local *local,
        struct rate_control_ref *ref = local->rate_ctrl;
        struct ieee80211_sta *ista = &sta->sta;
        void *priv_sta = sta->rate_ctrl_priv;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 
-       ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
+       if (likely(info->flags & IEEE80211_TX_INTFL_RCALGO))
+               ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
 }