mac80211: clean up rate control API
Subsystems (2)
Johannes Berg
maintainerPATCH 1/1 mac80211: clean up rate control API
Long awaited, hard work. This patch totally cleans up the rate control API to remove the requirement to include internal headers outside of net/mac80211/.
There's one internal use in the PID algorithm left for mesh networking, we'll have to figure out a way to clean that one up and decide how to do the peer link evaluation, possibly independent of the rate control algorithm or via new API.
Additionally, ath9k is left using the cross-inclusion hack for now, we will add new API where necessary to make this work properly, but right now I'm not expert enough to do it. It's still off better than before.
---
Quite some code removal too.
I have tested on b43 and ath9k (but without aggregation), but not on iwlwifi, as iwlwifi fails to work on my machine alltogether with a BUG_ON in an interrupt.
I have also been using this daily since I first posted an initial version a week ago and feel it is, although quite a change, as safe as I can personally make it without getting feedback from others.
drivers/net/wireless/ath9k/rc.c | 98 ++++++--------- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 182 ++++++---------------------- drivers/net/wireless/iwlwifi/iwl-3945-rs.h | 9 - drivers/net/wireless/iwlwifi/iwl-3945.h | 4 drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 146 +++++++++------------- drivers/net/wireless/iwlwifi/iwl3945-base.c | 11 - include/net/mac80211.h | 68 ++++++++++ net/mac80211/cfg.c | 2 net/mac80211/ieee80211_i.h | 2 net/mac80211/main.c | 4 net/mac80211/mlme.c | 4 net/mac80211/rate.c | 71 ++++++++-- net/mac80211/rate.h | 102 ++++----------- net/mac80211/rc80211_pid.h | 2 net/mac80211/rc80211_pid_algo.c | 158 +++++++++--------------- net/mac80211/sta_info.c | 17 -- net/mac80211/sta_info.h | 2 net/mac80211/tx.c | 5 18 files changed, 373 insertions(+), 514 deletions(-)
net/mac80211/cfg.c +1 -1
@@ -695,7 +695,7 @@ static int ieee80211_add_station(structsta_apply_parameters (local, sta, params); -rate_control_rate_init (sta, local); +rate_control_rate_init (sta);rcu_read_lock ();
net/mac80211/main.c +3 -1
@@ -542,6 +542,7 @@ void ieee80211_tx_status(struct ieee8021struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);u16 frag, type;__le16 fc; +struct ieee80211_supported_band *sband;struct ieee80211_tx_status_rtap_hdr *rthdr;struct ieee80211_sub_if_data *sdata;struct net_device *prev_dev =NULL ;
@@ -588,7 +589,8 @@ void ieee80211_tx_status(struct ieee8021 sta->tx_retry_count += info->status.retry_count; } -rate_control_tx_status (local->mdev, skb); + sband = local->hw.wiphy->bands[info->band]; +rate_control_tx_status (local, sband, sta, skb); }rcu_read_unlock ();
net/mac80211/mlme.c +2 -2
@@ -1354,7 +1354,7 @@ static void ieee80211_rx_mgmt_assoc_respieee80211_handle_ht (local,1 , &sta->sta.ht_info, &bss_info); } -rate_control_rate_init (sta, local); +rate_control_rate_init (sta);if (elems.wmm_param) {set_sta_flags (sta,WLAN_STA_WME );
@@ -2373,7 +2373,7 @@ struct sta_info *ieee80211_ibss_add_sta( sta->sta.supp_rates[band] = supp_rates |ieee80211_mandatory_rates (local, band); -rate_control_rate_init (sta, local); +rate_control_rate_init (sta);if (sta_info_insert (sta))return NULL ;
net/mac80211/rate.c +57 -14
124 lines not on this page · raw message
net/mac80211/rate.h +26 -76
149 lines not on this page · raw message
net/mac80211/sta_info.c +5 -12
@@ -93,8 +93,7 @@ static int sta_info_hash_del(struct ieee }/* protected by RCU */ -static struct sta_info *__sta_info_find (struct ieee80211_local *local, -const u8 *addr) +struct sta_info *sta_info_get (struct ieee80211_local *local,const u8 *addr) {struct sta_info *sta;
@@ -107,12 +106,6 @@ static struct sta_info *__sta_info_find(return sta; } -struct sta_info *sta_info_get (struct ieee80211_local *local,u8 *addr) -{ -return __sta_info_find (local, addr); -} -EXPORT_SYMBOL (sta_info_get); -struct sta_info *sta_info_get_by_idx (struct ieee80211_local *local,int idx,struct net_device *dev) {
@@ -146,7 +139,7 @@ static void __sta_info_free(struct ieee8 {DECLARE_MAC_BUF (mbuf); -rate_control_free_sta (sta->rate_ctrl, sta->rate_ctrl_priv); +rate_control_free_sta (sta);rate_control_put (sta->rate_ctrl);#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
@@ -244,7 +237,7 @@ struct sta_info *sta_info_alloc(struct i sta->rate_ctrl =rate_control_get (local->rate_ctrl); sta->rate_ctrl_priv =rate_control_alloc_sta (sta->rate_ctrl, - gfp); + &sta->sta, gfp);if (!sta->rate_ctrl_priv) {rate_control_put (sta->rate_ctrl);kfree (sta);
@@ -308,7 +301,7 @@ int sta_info_insert(struct sta_info *staspin_lock_irqsave (&local->sta_lock, flags);/* check if STA exists already */ -if (__sta_info_find (local, sta->sta.addr)) { +if (sta_info_get (local, sta->sta.addr)) {spin_unlock_irqrestore (&local->sta_lock, flags); err = -EEXIST ; goto out_free;
@@ -834,7 +827,7 @@ void ieee80211_sta_expire(struct ieee802struct ieee80211_sta *ieee80211_find_sta (struct ieee80211_hw *hw,const u8 *addr) { -struct sta_info *sta =__sta_info_find (hw_to_local (hw), addr); +struct sta_info *sta =sta_info_get (hw_to_local (hw), addr);if (!sta)return NULL ;
net/mac80211/tx.c +3 -2
@@ -446,7 +446,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee8021 sband = tx->local->hw.wiphy->bands[tx->channel->band];if (likely (tx->rate_idx <0 )) { -rate_control_get_rate (tx->dev, sband, tx->skb, &rsel); +rate_control_get_rate (tx->sdata, sband, tx->sta, + tx->skb, &rsel);if (tx->sta) tx->sta->last_txrate_idx = rsel.rate_idx; tx->rate_idx = rsel.rate_idx;
@@ -1923,7 +1924,7 @@ struct sk_buff *ieee80211_beacon_get(str skb->do_not_encrypt =1 ; info->band = band; -rate_control_get_rate (local->mdev, sband, skb, &rsel); +rate_control_get_rate (sdata, sband,NULL , skb, &rsel);if (unlikely (rsel.rate_idx <0 )) {if (net_ratelimit ()) {
net/mac80211/rc80211_pid_algo.c +59 -99
292 lines not on this page · raw message
drivers/net/wireless/ath9k/rc.c +42 -56
243 lines not on this page · raw message
include/net/mac80211.h +68 -0
72 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-3945-rs.c +40 -142
336 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-agn-rs.c +59 -87
375 lines not on this page · raw message
drivers/net/wireless/iwlwifi/iwl-3945-rs.h +0 -9
@@ -176,15 +176,6 @@ static inline u8 iwl3945_get_prev_ieee_r }/** -* iwl3945_fill_rs_info - Fill an output text buffer with the rate representation -* -* NOTE: This is provided as a quick mechanism for a user to visualize -* the performance of the rate control algorithm and is not meant to be -* parsed software. -*/ -extern int iwl3945_fill_rs_info (struct ieee80211_hw *,char *buf,u8 sta_id); - -/** * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info * * The specific throughput table used is based on the type of network
drivers/net/wireless/iwlwifi/iwl3945-base.c +1 -10
@@ -7370,15 +7370,6 @@ static ssize_t show_temperature(struct d static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); -static ssize_t show_rs_window (struct device *d, -struct device_attribute *attr, -char *buf) -{ -struct iwl3945_priv *priv = d->driver_data; -return iwl3945_fill_rs_info (priv->hw, buf,IWL_AP_ID ); -} -static DEVICE_ATTR(rs_window, S_IRUGO, show_rs_window, NULL); -static ssize_t show_tx_power (struct device *d,struct device_attribute *attr,char *buf) {
@@ -7840,7 +7831,6 @@ static struct attribute *iwl3945_sysfs_e#endif &dev_attr_power_level.attr, &dev_attr_retry_rate.attr, - &dev_attr_rs_window.attr, &dev_attr_statistics.attr, &dev_attr_status.attr, &dev_attr_temperature.attr,
@@ -7908,6 +7898,7 @@ static int iwl3945_pci_probe(struct pci_SET_IEEE80211_DEV (hw, &pdev->dev); hw->rate_control_algorithm ="iwl-3945-rs" ; + hw->sta_data_size =sizeof (struct iwl3945_sta_priv );IWL_DEBUG_INFO ("*** LOAD DRIVER ***\n" ); priv = hw->priv;
net/mac80211/rc80211_pid.h +0 -2
@@ -124,7 +124,6 @@ struct rc_pid_events_file_info {* struct rc_pid_debugfs_entries - tunable parameters * * Algorithm parameters, tunable via debugfs. -* @dir: the debugfs directory for a specific phy * @target: target percentage for failed frames * @sampling_period: error sampling interval in milliseconds * @coeff_p: absolute value of the proportional coefficient
@@ -143,7 +142,6 @@ struct rc_pid_events_file_info {* ordering of rates) */ struct rc_pid_debugfs_entries { -struct dentry *dir;struct dentry *target;struct dentry *sampling_period;struct dentry *coeff_p;
net/mac80211/ieee80211_i.h +2 -0
@@ -724,6 +724,8 @@ struct ieee80211_local { #ifdef CONFIG_MAC80211_DEBUGFS struct local_debugfsdentries { + struct dentry *rcdir; + struct dentry *rcname; struct dentry *frequency; struct dentry *antenna_sel_tx; struct dentry *antenna_sel_rx;
drivers/net/wireless/iwlwifi/iwl-3945.h +4 -0
@@ -73,6 +73,10 @@ extern struct pci_device_id iwl3945_hw_cextern int iwl3945_param_hwcrypto;extern int iwl3945_param_queues_num; +struct iwl3945_sta_priv { +struct iwl3945_rs_sta *rs_sta; +}; +enum iwl3945_antenna {IWL_ANTENNA_DIVERSITY ,IWL_ANTENNA_MAIN ,
net/mac80211/sta_info.h +1 -1
@@ -416,7 +416,7 @@ static inline u32 get_sta_flags(struct s/* * Get a STA info, must have be under RCU read lock. */ -struct sta_info *sta_info_get (struct ieee80211_local *local,u8 *addr); +struct sta_info *sta_info_get (struct ieee80211_local *local,const u8 *addr);/* * Get STA info by index, BROKEN! */