some drivers need to be notified in case of rates update. This callback tells
the driver that something has been changed in the supported rates set of the
station passed as argument and that it needs to update its internal tables

Reported-by: Guido Iribarren <[email protected]>
Tested-by: Guido Iribarren <[email protected]>
Signed-off-by: Antonio Quartulli <[email protected]>
---

** This is the first time that I play with trace.h, so it could be the case that
I made something completely wrong! Sorry :)




 include/net/mac80211.h    |    4 ++++
 net/mac80211/driver-ops.h |   14 ++++++++++++++
 net/mac80211/ibss.c       |    4 +++-
 net/mac80211/trace.h      |   27 +++++++++++++++++++++++++++
 4 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index bb86aa6..c5dc725 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2284,6 +2284,10 @@ struct ieee80211_ops {
                                 struct ieee80211_vif *vif,
                                 struct ieee80211_bss_conf *info,
                                 u32 changed);
+       void (*sta_update_rates)(struct ieee80211_hw *hw,
+                                struct ieee80211_sta *sta,
+                                struct ieee80211_vif *vif,
+                                struct ieee80211_bss_conf *info);
 
        u64 (*prepare_multicast)(struct ieee80211_hw *hw,
                                 struct netdev_hw_addr_list *mc_list);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index df92031..2cec563 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -213,6 +213,20 @@ static inline void drv_bss_info_changed(struct 
ieee80211_local *local,
        trace_drv_return_void(local);
 }
 
+static inline void drv_sta_update_rates(struct ieee80211_local *local,
+                                       struct ieee80211_sta *sta,
+                                       struct ieee80211_sub_if_data *sdata)
+{
+       might_sleep();
+
+       check_sdata_in_driver(sdata);
+       trace_drv_sta_update_rates(local, sta, sdata);
+       if (local->ops->sta_update_rates)
+               local->ops->sta_update_rates(&local->hw, sta, &sdata->vif,
+                                            &sdata->vif.bss_conf);
+       trace_drv_return_void(local);
+}
+
 static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
                                        struct netdev_hw_addr_list *mc_list)
 {
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 37e71a3..5e16dbc 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -467,8 +467,10 @@ static void ieee80211_rx_bss_info(struct 
ieee80211_sub_if_data *sdata,
                        }
                }
 
-               if (sta && rates_updated)
+               if (sta && rates_updated) {
+                       drv_sta_update_rates(local, &sta->sta, sdata);
                        rate_control_rate_init(sta);
+               }
 
                rcu_read_unlock();
        }
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index c6d33b5..c9a60ee 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -339,6 +339,33 @@ TRACE_EVENT(drv_bss_info_changed,
        )
 );
 
+TRACE_EVENT(drv_sta_update_rates,
+       TP_PROTO(struct ieee80211_local *local,
+                struct ieee80211_sta *sta,
+                struct ieee80211_sub_if_data *sdata),
+
+       TP_ARGS(local, sta, sdata),
+
+       TP_STRUCT__entry(
+               LOCAL_ENTRY
+               STA_ENTRY
+               VIF_ENTRY
+               __array(u32, supp_rates, IEEE80211_NUM_BANDS)
+       ),
+
+       TP_fast_assign(
+               LOCAL_ASSIGN;
+               STA_ASSIGN;
+               VIF_ASSIGN;
+               memcpy(__entry->supp_rates, sta->supp_rates,
+                      IEEE80211_NUM_BANDS);
+       ),
+
+       TP_printk(
+               LOCAL_PR_FMT STA_PR_FMT,
+               LOCAL_PR_ARG, STA_PR_ARG
+       )
+);
 TRACE_EVENT(drv_prepare_multicast,
        TP_PROTO(struct ieee80211_local *local, int mc_count),
 
-- 
1.7.9.4

_______________________________________________
ath9k-devel mailing list
[email protected]
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to