]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mac80211: notify driver of rate control updates
authorJohannes Berg <johannes.berg@intel.com>
Fri, 30 Mar 2012 06:43:32 +0000 (08:43 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 10 Apr 2012 18:54:08 +0000 (14:54 -0400)
Devices that have internal rate control need to be
notified when the bandwidth or SMPS state changes
just like external rate control algorithms get a
notification now.

Add this notification and clarify the change bits
while at it, the HT_CHANGED bit really meant only
bandwidth changed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Documentation/DocBook/80211.tmpl
drivers/net/wireless/ath/ath9k/rc.c
include/net/mac80211.h
net/mac80211/driver-ops.h
net/mac80211/driver-trace.h
net/mac80211/mlme.c
net/mac80211/rate.h

index c5ac6929c41c7cbdd068a095e37c2fef3acc70c5..f3e214f9e25675660257eb25060bd62890b049b7 100644 (file)
 !Finclude/net/mac80211.h ieee80211_start_tx_ba_cb_irqsafe
 !Finclude/net/mac80211.h ieee80211_stop_tx_ba_session
 !Finclude/net/mac80211.h ieee80211_stop_tx_ba_cb_irqsafe
-!Finclude/net/mac80211.h rate_control_changed
+!Finclude/net/mac80211.h ieee80211_rate_control_changed
 !Finclude/net/mac80211.h ieee80211_tx_rate_control
 !Finclude/net/mac80211.h rate_control_send_low
       </chapter>
index 4e39f27af07737be4f3647cf5d91b5d7102f9463..5fff711fba1d415bfef858d0917311dc6355a59e 100644 (file)
@@ -1447,7 +1447,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
 
        /* FIXME: Handle AP mode later when we support CWM */
 
-       if (changed & IEEE80211_RC_HT_CHANGED) {
+       if (changed & IEEE80211_RC_BW_CHANGED) {
                if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
                        return;
 
index 21c653415d8495e0b7220a6b77e620ce976600e8..dc0d3e715759c6820fce75162d1809c51f9d9f9e 100644 (file)
@@ -1779,6 +1779,18 @@ enum ieee80211_frame_release_type {
        IEEE80211_FRAME_RELEASE_UAPSD,
 };
 
+/**
+ * enum ieee80211_rate_control_changed - flags to indicate what changed
+ *
+ * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
+ *     to this station changed.
+ * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
+ */
+enum ieee80211_rate_control_changed {
+       IEEE80211_RC_BW_CHANGED         = BIT(0),
+       IEEE80211_RC_SMPS_CHANGED       = BIT(1),
+};
+
 /**
  * struct ieee80211_ops - callbacks from mac80211 to the driver
  *
@@ -1980,6 +1992,14 @@ enum ieee80211_frame_release_type {
  *     up the list of states.
  *     The callback can sleep.
  *
+ * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
+ *     used to transmit to the station. The changes are advertised with bits
+ *     from &enum ieee80211_rate_control_changed and the values are reflected
+ *     in the station data. This callback should only be used when the driver
+ *     uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
+ *     otherwise the rate control algorithm is notified directly.
+ *     Must be atomic.
+ *
  * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  *     bursting) for a hardware TX queue.
  *     Returns a negative error code on failure.
@@ -2196,6 +2216,10 @@ struct ieee80211_ops {
                         struct ieee80211_sta *sta,
                         enum ieee80211_sta_state old_state,
                         enum ieee80211_sta_state new_state);
+       void (*sta_rc_update)(struct ieee80211_hw *hw,
+                             struct ieee80211_vif *vif,
+                             struct ieee80211_sta *sta,
+                             u32 changed);
        int (*conf_tx)(struct ieee80211_hw *hw,
                       struct ieee80211_vif *vif, u16 queue,
                       const struct ieee80211_tx_queue_params *params);
@@ -3511,19 +3535,6 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
 
 /* Rate control API */
 
-/**
- * enum rate_control_changed - flags to indicate which parameter changed
- *
- * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
- *     changed, rate control algorithm can update its internal state if needed.
- * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
- *     control algorithm needs to adjust accordingly.
- */
-enum rate_control_changed {
-       IEEE80211_RC_HT_CHANGED         = BIT(0),
-       IEEE80211_RC_SMPS_CHANGED       = BIT(1),
-};
-
 /**
  * struct ieee80211_tx_rate_control - rate control information for/from RC algo
  *
index e8dbda1b5b8ae40801cdb7e76521a2c56516ca04..0eb2bc003058cff123a8a5777f7251ab029597d0 100644 (file)
@@ -476,6 +476,21 @@ int drv_sta_state(struct ieee80211_local *local,
        return ret;
 }
 
+static inline void drv_sta_rc_update(struct ieee80211_local *local,
+                                    struct ieee80211_sub_if_data *sdata,
+                                    struct ieee80211_sta *sta, u32 changed)
+{
+       sdata = get_bss_sdata(sdata);
+       check_sdata_in_driver(sdata);
+
+       trace_drv_sta_rc_update(local, sdata, sta, changed);
+       if (local->ops->sta_rc_update)
+               local->ops->sta_rc_update(&local->hw, &sdata->vif,
+                                         sta, changed);
+
+       trace_drv_return_void(local);
+}
+
 static inline int drv_conf_tx(struct ieee80211_local *local,
                              struct ieee80211_sub_if_data *sdata, u16 queue,
                              const struct ieee80211_tx_queue_params *params)
index 21d6f5290a1c67883d004ab5c2215bd9ebdafc54..7ea544d8643665ba07a9d952c96eca3169c9c2b2 100644 (file)
@@ -624,6 +624,34 @@ TRACE_EVENT(drv_sta_state,
        )
 );
 
+TRACE_EVENT(drv_sta_rc_update,
+       TP_PROTO(struct ieee80211_local *local,
+                struct ieee80211_sub_if_data *sdata,
+                struct ieee80211_sta *sta,
+                u32 changed),
+
+       TP_ARGS(local, sdata, sta, changed),
+
+       TP_STRUCT__entry(
+               LOCAL_ENTRY
+               VIF_ENTRY
+               STA_ENTRY
+               __field(u32, changed)
+       ),
+
+       TP_fast_assign(
+               LOCAL_ASSIGN;
+               VIF_ASSIGN;
+               STA_ASSIGN;
+               __entry->changed = changed;
+       ),
+
+       TP_printk(
+               LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " changed: 0x%x",
+               LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->changed
+       )
+);
+
 TRACE_EVENT(drv_sta_add,
        TP_PROTO(struct ieee80211_local *local,
                 struct ieee80211_sub_if_data *sdata,
index 594af5f4079cc7558fa83d96e47eca107d68d544..4974f998c7dd7fe5a18b2cb06219ec72a31a208a 100644 (file)
@@ -219,7 +219,7 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata,
                        sta->sta.ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
 
                rate_control_rate_update(local, sband, sta,
-                                        IEEE80211_RC_HT_CHANGED);
+                                        IEEE80211_RC_BW_CHANGED);
        }
        mutex_unlock(&local->sta_mtx);
 
index 27b66be8ac8f0e8e3de553bec386729b46f4424e..6e4fd32c66171345c399f9eb765809d974068e34 100644 (file)
@@ -17,6 +17,7 @@
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
 #include "sta_info.h"
+#include "driver-ops.h"
 
 struct rate_control_ref {
        struct ieee80211_local *local;
@@ -72,6 +73,7 @@ static inline void rate_control_rate_update(struct ieee80211_local *local,
        if (ref && ref->ops->rate_update)
                ref->ops->rate_update(ref->priv, sband, ista,
                                      priv_sta, changed);
+       drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
 }
 
 static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,