ath5k: channel change fix
[openwrt/staging/yousong.git] / package / kernel / mac80211 / patches / 320-mac80211-notify-drivers-on-sta-rate-table-changes.patch
1 From: Johannes Berg <johannes.berg@intel.com>
2 Date: Tue, 18 Nov 2014 23:26:40 +0100
3 Subject: [PATCH] mac80211: notify drivers on sta rate table changes
4
5 This allows drivers with a firmware or chip-based rate lookup table to
6 use the most recent default rate selection without having to get it from
7 per-packet data or explicit ieee80211_get_tx_rate calls
8
9 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 ---
11
12 --- a/include/net/mac80211.h
13 +++ b/include/net/mac80211.h
14 @@ -2631,6 +2631,9 @@ enum ieee80211_reconfig_type {
15 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
16 * otherwise the rate control algorithm is notified directly.
17 * Must be atomic.
18 + * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This
19 + * is only used if the configured rate control algorithm actually uses
20 + * the new rate table API, and is therefore optional. Must be atomic.
21 *
22 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
23 * bursting) for a hardware TX queue.
24 @@ -2972,6 +2975,9 @@ struct ieee80211_ops {
25 struct ieee80211_vif *vif,
26 struct ieee80211_sta *sta,
27 u32 changed);
28 + void (*sta_rate_tbl_update)(struct ieee80211_hw *hw,
29 + struct ieee80211_vif *vif,
30 + struct ieee80211_sta *sta);
31 int (*conf_tx)(struct ieee80211_hw *hw,
32 struct ieee80211_vif *vif, u16 ac,
33 const struct ieee80211_tx_queue_params *params);
34 --- a/net/mac80211/driver-ops.h
35 +++ b/net/mac80211/driver-ops.h
36 @@ -621,6 +621,21 @@ static inline void drv_sta_rc_update(str
37 trace_drv_return_void(local);
38 }
39
40 +static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
41 + struct ieee80211_sub_if_data *sdata,
42 + struct ieee80211_sta *sta)
43 +{
44 + sdata = get_bss_sdata(sdata);
45 + if (!check_sdata_in_driver(sdata))
46 + return;
47 +
48 + trace_drv_sta_rate_tbl_update(local, sdata, sta);
49 + if (local->ops->sta_rate_tbl_update)
50 + local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
51 +
52 + trace_drv_return_void(local);
53 +}
54 +
55 static inline int drv_conf_tx(struct ieee80211_local *local,
56 struct ieee80211_sub_if_data *sdata, u16 ac,
57 const struct ieee80211_tx_queue_params *params)
58 --- a/net/mac80211/rate.c
59 +++ b/net/mac80211/rate.c
60 @@ -696,6 +696,7 @@ int rate_control_set_rates(struct ieee80
61 struct ieee80211_sta *pubsta,
62 struct ieee80211_sta_rates *rates)
63 {
64 + struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
65 struct ieee80211_sta_rates *old;
66
67 /*
68 @@ -709,6 +710,8 @@ int rate_control_set_rates(struct ieee80
69 if (old)
70 kfree_rcu(old, rcu_head);
71
72 + drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta);
73 +
74 return 0;
75 }
76 EXPORT_SYMBOL(rate_control_set_rates);
77 --- a/net/mac80211/trace.h
78 +++ b/net/mac80211/trace.h
79 @@ -826,6 +826,13 @@ DEFINE_EVENT(sta_event, drv_sta_pre_rcu_
80 TP_ARGS(local, sdata, sta)
81 );
82
83 +DEFINE_EVENT(sta_event, drv_sta_rate_tbl_update,
84 + TP_PROTO(struct ieee80211_local *local,
85 + struct ieee80211_sub_if_data *sdata,
86 + struct ieee80211_sta *sta),
87 + TP_ARGS(local, sdata, sta)
88 +);
89 +
90 TRACE_EVENT(drv_conf_tx,
91 TP_PROTO(struct ieee80211_local *local,
92 struct ieee80211_sub_if_data *sdata,