aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-03-30 02:43:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-10 14:54:08 -0400
commit8f727ef3c4859f2c397a7609beb845dcd66729f5 (patch)
tree9843df4721d5510c464f7ea4e1f4da940b247c80
parent7213cf2cb0dfbb4d6b55a1da000d34338f76c0e3 (diff)
mac80211: notify driver of rate control updates
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>
-rw-r--r--Documentation/DocBook/80211.tmpl2
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--include/net/mac80211.h37
-rw-r--r--net/mac80211/driver-ops.h15
-rw-r--r--net/mac80211/driver-trace.h28
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/mac80211/rate.h2
7 files changed, 72 insertions, 16 deletions
diff --git a/Documentation/DocBook/80211.tmpl b/Documentation/DocBook/80211.tmpl
index c5ac6929c41c..f3e214f9e256 100644
--- a/Documentation/DocBook/80211.tmpl
+++ b/Documentation/DocBook/80211.tmpl
@@ -516,7 +516,7 @@
516!Finclude/net/mac80211.h ieee80211_start_tx_ba_cb_irqsafe 516!Finclude/net/mac80211.h ieee80211_start_tx_ba_cb_irqsafe
517!Finclude/net/mac80211.h ieee80211_stop_tx_ba_session 517!Finclude/net/mac80211.h ieee80211_stop_tx_ba_session
518!Finclude/net/mac80211.h ieee80211_stop_tx_ba_cb_irqsafe 518!Finclude/net/mac80211.h ieee80211_stop_tx_ba_cb_irqsafe
519!Finclude/net/mac80211.h rate_control_changed 519!Finclude/net/mac80211.h ieee80211_rate_control_changed
520!Finclude/net/mac80211.h ieee80211_tx_rate_control 520!Finclude/net/mac80211.h ieee80211_tx_rate_control
521!Finclude/net/mac80211.h rate_control_send_low 521!Finclude/net/mac80211.h rate_control_send_low
522 </chapter> 522 </chapter>
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 4e39f27af077..5fff711fba1d 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1447,7 +1447,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1447 1447
1448 /* FIXME: Handle AP mode later when we support CWM */ 1448 /* FIXME: Handle AP mode later when we support CWM */
1449 1449
1450 if (changed & IEEE80211_RC_HT_CHANGED) { 1450 if (changed & IEEE80211_RC_BW_CHANGED) {
1451 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION) 1451 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
1452 return; 1452 return;
1453 1453
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 21c653415d84..dc0d3e715759 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1780,6 +1780,18 @@ enum ieee80211_frame_release_type {
1780}; 1780};
1781 1781
1782/** 1782/**
1783 * enum ieee80211_rate_control_changed - flags to indicate what changed
1784 *
1785 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
1786 * to this station changed.
1787 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
1788 */
1789enum ieee80211_rate_control_changed {
1790 IEEE80211_RC_BW_CHANGED = BIT(0),
1791 IEEE80211_RC_SMPS_CHANGED = BIT(1),
1792};
1793
1794/**
1783 * struct ieee80211_ops - callbacks from mac80211 to the driver 1795 * struct ieee80211_ops - callbacks from mac80211 to the driver
1784 * 1796 *
1785 * This structure contains various callbacks that the driver may 1797 * This structure contains various callbacks that the driver may
@@ -1980,6 +1992,14 @@ enum ieee80211_frame_release_type {
1980 * up the list of states. 1992 * up the list of states.
1981 * The callback can sleep. 1993 * The callback can sleep.
1982 * 1994 *
1995 * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
1996 * used to transmit to the station. The changes are advertised with bits
1997 * from &enum ieee80211_rate_control_changed and the values are reflected
1998 * in the station data. This callback should only be used when the driver
1999 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
2000 * otherwise the rate control algorithm is notified directly.
2001 * Must be atomic.
2002 *
1983 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 2003 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1984 * bursting) for a hardware TX queue. 2004 * bursting) for a hardware TX queue.
1985 * Returns a negative error code on failure. 2005 * Returns a negative error code on failure.
@@ -2196,6 +2216,10 @@ struct ieee80211_ops {
2196 struct ieee80211_sta *sta, 2216 struct ieee80211_sta *sta,
2197 enum ieee80211_sta_state old_state, 2217 enum ieee80211_sta_state old_state,
2198 enum ieee80211_sta_state new_state); 2218 enum ieee80211_sta_state new_state);
2219 void (*sta_rc_update)(struct ieee80211_hw *hw,
2220 struct ieee80211_vif *vif,
2221 struct ieee80211_sta *sta,
2222 u32 changed);
2199 int (*conf_tx)(struct ieee80211_hw *hw, 2223 int (*conf_tx)(struct ieee80211_hw *hw,
2200 struct ieee80211_vif *vif, u16 queue, 2224 struct ieee80211_vif *vif, u16 queue,
2201 const struct ieee80211_tx_queue_params *params); 2225 const struct ieee80211_tx_queue_params *params);
@@ -3512,19 +3536,6 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
3512/* Rate control API */ 3536/* Rate control API */
3513 3537
3514/** 3538/**
3515 * enum rate_control_changed - flags to indicate which parameter changed
3516 *
3517 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
3518 * changed, rate control algorithm can update its internal state if needed.
3519 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
3520 * control algorithm needs to adjust accordingly.
3521 */
3522enum rate_control_changed {
3523 IEEE80211_RC_HT_CHANGED = BIT(0),
3524 IEEE80211_RC_SMPS_CHANGED = BIT(1),
3525};
3526
3527/**
3528 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 3539 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
3529 * 3540 *
3530 * @hw: The hardware the algorithm is invoked for. 3541 * @hw: The hardware the algorithm is invoked for.
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index e8dbda1b5b8a..0eb2bc003058 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -476,6 +476,21 @@ int drv_sta_state(struct ieee80211_local *local,
476 return ret; 476 return ret;
477} 477}
478 478
479static inline void drv_sta_rc_update(struct ieee80211_local *local,
480 struct ieee80211_sub_if_data *sdata,
481 struct ieee80211_sta *sta, u32 changed)
482{
483 sdata = get_bss_sdata(sdata);
484 check_sdata_in_driver(sdata);
485
486 trace_drv_sta_rc_update(local, sdata, sta, changed);
487 if (local->ops->sta_rc_update)
488 local->ops->sta_rc_update(&local->hw, &sdata->vif,
489 sta, changed);
490
491 trace_drv_return_void(local);
492}
493
479static inline int drv_conf_tx(struct ieee80211_local *local, 494static inline int drv_conf_tx(struct ieee80211_local *local,
480 struct ieee80211_sub_if_data *sdata, u16 queue, 495 struct ieee80211_sub_if_data *sdata, u16 queue,
481 const struct ieee80211_tx_queue_params *params) 496 const struct ieee80211_tx_queue_params *params)
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 21d6f5290a1c..7ea544d86436 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -624,6 +624,34 @@ TRACE_EVENT(drv_sta_state,
624 ) 624 )
625); 625);
626 626
627TRACE_EVENT(drv_sta_rc_update,
628 TP_PROTO(struct ieee80211_local *local,
629 struct ieee80211_sub_if_data *sdata,
630 struct ieee80211_sta *sta,
631 u32 changed),
632
633 TP_ARGS(local, sdata, sta, changed),
634
635 TP_STRUCT__entry(
636 LOCAL_ENTRY
637 VIF_ENTRY
638 STA_ENTRY
639 __field(u32, changed)
640 ),
641
642 TP_fast_assign(
643 LOCAL_ASSIGN;
644 VIF_ASSIGN;
645 STA_ASSIGN;
646 __entry->changed = changed;
647 ),
648
649 TP_printk(
650 LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " changed: 0x%x",
651 LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->changed
652 )
653);
654
627TRACE_EVENT(drv_sta_add, 655TRACE_EVENT(drv_sta_add,
628 TP_PROTO(struct ieee80211_local *local, 656 TP_PROTO(struct ieee80211_local *local,
629 struct ieee80211_sub_if_data *sdata, 657 struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 594af5f4079c..4974f998c7dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -219,7 +219,7 @@ static u32 ieee80211_config_ht_tx(struct ieee80211_sub_if_data *sdata,
219 sta->sta.ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; 219 sta->sta.ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
220 220
221 rate_control_rate_update(local, sband, sta, 221 rate_control_rate_update(local, sband, sta,
222 IEEE80211_RC_HT_CHANGED); 222 IEEE80211_RC_BW_CHANGED);
223 } 223 }
224 mutex_unlock(&local->sta_mtx); 224 mutex_unlock(&local->sta_mtx);
225 225
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 27b66be8ac8f..6e4fd32c6617 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -17,6 +17,7 @@
17#include <net/mac80211.h> 17#include <net/mac80211.h>
18#include "ieee80211_i.h" 18#include "ieee80211_i.h"
19#include "sta_info.h" 19#include "sta_info.h"
20#include "driver-ops.h"
20 21
21struct rate_control_ref { 22struct rate_control_ref {
22 struct ieee80211_local *local; 23 struct ieee80211_local *local;
@@ -72,6 +73,7 @@ static inline void rate_control_rate_update(struct ieee80211_local *local,
72 if (ref && ref->ops->rate_update) 73 if (ref && ref->ops->rate_update)
73 ref->ops->rate_update(ref->priv, sband, ista, 74 ref->ops->rate_update(ref->priv, sband, ista,
74 priv_sta, changed); 75 priv_sta, changed);
76 drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
75} 77}
76 78
77static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, 79static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,