From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 4/4 v2] mac80211: notify driver of rate control updates
Date: Fri, 30 Mar 2012 08:43:32 +0200 [thread overview]
Message-ID: <1333089812.3908.1.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <20120328085901.436280820@sipsolutions.net> (sfid-20120328_110625_255736_B56EFA9F)
From: Johannes Berg <johannes.berg@intel.com>
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>
---
v2: fix might_sleep() pointed out by Eliad
Documentation/DocBook/80211.tmpl | 2 -
drivers/net/wireless/ath/ath9k/rc.c | 2 -
include/net/mac80211.h | 37 +++++++++++++++++++++++-------------
net/mac80211/driver-ops.h | 15 ++++++++++++++
net/mac80211/driver-trace.h | 28 +++++++++++++++++++++++++++
net/mac80211/mlme.c | 2 -
net/mac80211/rate.h | 2 +
7 files changed, 72 insertions(+), 16 deletions(-)
--- a/Documentation/DocBook/80211.tmpl 2012-03-29 10:03:59.000000000 +0200
+++ b/Documentation/DocBook/80211.tmpl 2012-03-30 08:40:31.000000000 +0200
@@ -533,7 +533,7 @@ MISSING
!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>
--- a/include/net/mac80211.h 2012-03-30 08:40:31.000000000 +0200
+++ b/include/net/mac80211.h 2012-03-30 08:42:16.000000000 +0200
@@ -1778,6 +1778,18 @@ enum ieee80211_frame_release_type {
};
/**
+ * 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
*
* This structure contains various callbacks that the driver may
@@ -1978,6 +1990,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.
@@ -2194,6 +2214,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);
@@ -3510,19 +3534,6 @@ void ieee80211_send_bar(struct ieee80211
/* 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
*
* @hw: The hardware the algorithm is invoked for.
--- a/drivers/net/wireless/ath/ath9k/rc.c 2012-03-30 08:40:31.000000000 +0200
+++ b/drivers/net/wireless/ath/ath9k/rc.c 2012-03-30 08:40:31.000000000 +0200
@@ -1447,7 +1447,7 @@ static void ath_rate_update(void *priv,
/* 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;
--- a/net/mac80211/mlme.c 2012-03-30 08:40:31.000000000 +0200
+++ b/net/mac80211/mlme.c 2012-03-30 08:42:16.000000000 +0200
@@ -219,7 +219,7 @@ static u32 ieee80211_config_ht_tx(struct
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);
--- a/net/mac80211/driver-trace.h 2012-03-29 10:00:40.000000000 +0200
+++ b/net/mac80211/driver-trace.h 2012-03-30 08:42:16.000000000 +0200
@@ -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,
--- a/net/mac80211/driver-ops.h 2012-03-29 10:00:40.000000000 +0200
+++ b/net/mac80211/driver-ops.h 2012-03-30 08:42:34.000000000 +0200
@@ -474,6 +474,21 @@ int drv_sta_state(struct ieee80211_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)
--- a/net/mac80211/rate.h 2012-03-30 08:40:31.000000000 +0200
+++ b/net/mac80211/rate.h 2012-03-30 08:40:31.000000000 +0200
@@ -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_upd
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,
prev parent reply other threads:[~2012-03-30 6:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 8:58 [PATCH 0/4] early HT channel setting Johannes Berg
2012-03-28 8:58 ` [PATCH 1/4] mac80211: set HT channel before association Johannes Berg
2012-03-28 8:58 ` [PATCH 2/4] mac80211: remove channel type argument from rate_update Johannes Berg
2012-03-30 4:37 ` Sujith Manoharan
2012-03-30 6:46 ` Johannes Berg
2012-03-30 7:12 ` Sujith Manoharan
2012-03-28 8:58 ` [PATCH 3/4] mac80211: remove queue stop on rate control update Johannes Berg
2012-03-28 8:58 ` [PATCH 4/4] mac80211: notify driver of rate control updates Johannes Berg
2012-03-29 19:13 ` Eliad Peller
2012-03-29 19:14 ` Johannes Berg
2012-03-30 6:43 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333089812.3908.1.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.