Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: deinline rate_control_rate_init, rate_control_rate_update

With this .config: http://busybox.net/~vda/kernel_config,
after deinlining these functions have sizes and callsite counts
as follows:

rate_control_rate_init: 554 bytes, 8 calls
rate_control_rate_update: 1596 bytes, 5 calls

Total size reduction: about 11 kbytes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: John Linville <linville@tuxdriver.com>
CC: Michal Kazior <michal.kazior@tieto.com>
CC: Johannes Berg <johannes.berg@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Denys Vlasenko and committed by
Johannes Berg
eb6d9293 727da60b

+62 -57
+59
net/mac80211/rate.c
··· 29 29 MODULE_PARM_DESC(ieee80211_default_rc_algo, 30 30 "Default rate control algorithm for mac80211 to use"); 31 31 32 + void rate_control_rate_init(struct sta_info *sta) 33 + { 34 + struct ieee80211_local *local = sta->sdata->local; 35 + struct rate_control_ref *ref = sta->rate_ctrl; 36 + struct ieee80211_sta *ista = &sta->sta; 37 + void *priv_sta = sta->rate_ctrl_priv; 38 + struct ieee80211_supported_band *sband; 39 + struct ieee80211_chanctx_conf *chanctx_conf; 40 + 41 + ieee80211_sta_set_rx_nss(sta); 42 + 43 + if (!ref) 44 + return; 45 + 46 + rcu_read_lock(); 47 + 48 + chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf); 49 + if (WARN_ON(!chanctx_conf)) { 50 + rcu_read_unlock(); 51 + return; 52 + } 53 + 54 + sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band]; 55 + 56 + spin_lock_bh(&sta->rate_ctrl_lock); 57 + ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista, 58 + priv_sta); 59 + spin_unlock_bh(&sta->rate_ctrl_lock); 60 + rcu_read_unlock(); 61 + set_sta_flag(sta, WLAN_STA_RATE_CONTROL); 62 + } 63 + 64 + void rate_control_rate_update(struct ieee80211_local *local, 65 + struct ieee80211_supported_band *sband, 66 + struct sta_info *sta, u32 changed) 67 + { 68 + struct rate_control_ref *ref = local->rate_ctrl; 69 + struct ieee80211_sta *ista = &sta->sta; 70 + void *priv_sta = sta->rate_ctrl_priv; 71 + struct ieee80211_chanctx_conf *chanctx_conf; 72 + 73 + if (ref && ref->ops->rate_update) { 74 + rcu_read_lock(); 75 + 76 + chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf); 77 + if (WARN_ON(!chanctx_conf)) { 78 + rcu_read_unlock(); 79 + return; 80 + } 81 + 82 + spin_lock_bh(&sta->rate_ctrl_lock); 83 + ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def, 84 + ista, priv_sta, changed); 85 + spin_unlock_bh(&sta->rate_ctrl_lock); 86 + rcu_read_unlock(); 87 + } 88 + drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); 89 + } 90 + 32 91 int ieee80211_rate_control_register(const struct rate_control_ops *ops) 33 92 { 34 93 struct rate_control_alg *alg;
+3 -57
net/mac80211/rate.h
··· 71 71 spin_unlock_bh(&sta->rate_ctrl_lock); 72 72 } 73 73 74 - static inline void rate_control_rate_init(struct sta_info *sta) 75 - { 76 - struct ieee80211_local *local = sta->sdata->local; 77 - struct rate_control_ref *ref = sta->rate_ctrl; 78 - struct ieee80211_sta *ista = &sta->sta; 79 - void *priv_sta = sta->rate_ctrl_priv; 80 - struct ieee80211_supported_band *sband; 81 - struct ieee80211_chanctx_conf *chanctx_conf; 82 - 83 - ieee80211_sta_set_rx_nss(sta); 84 - 85 - if (!ref) 86 - return; 87 - 88 - rcu_read_lock(); 89 - 90 - chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf); 91 - if (WARN_ON(!chanctx_conf)) { 92 - rcu_read_unlock(); 93 - return; 94 - } 95 - 96 - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band]; 97 - 98 - spin_lock_bh(&sta->rate_ctrl_lock); 99 - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista, 100 - priv_sta); 101 - spin_unlock_bh(&sta->rate_ctrl_lock); 102 - rcu_read_unlock(); 103 - set_sta_flag(sta, WLAN_STA_RATE_CONTROL); 104 - } 105 - 106 - static inline void rate_control_rate_update(struct ieee80211_local *local, 74 + void rate_control_rate_init(struct sta_info *sta); 75 + void rate_control_rate_update(struct ieee80211_local *local, 107 76 struct ieee80211_supported_band *sband, 108 - struct sta_info *sta, u32 changed) 109 - { 110 - struct rate_control_ref *ref = local->rate_ctrl; 111 - struct ieee80211_sta *ista = &sta->sta; 112 - void *priv_sta = sta->rate_ctrl_priv; 113 - struct ieee80211_chanctx_conf *chanctx_conf; 114 - 115 - if (ref && ref->ops->rate_update) { 116 - rcu_read_lock(); 117 - 118 - chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf); 119 - if (WARN_ON(!chanctx_conf)) { 120 - rcu_read_unlock(); 121 - return; 122 - } 123 - 124 - spin_lock_bh(&sta->rate_ctrl_lock); 125 - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def, 126 - ista, priv_sta, changed); 127 - spin_unlock_bh(&sta->rate_ctrl_lock); 128 - rcu_read_unlock(); 129 - } 130 - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); 131 - } 77 + struct sta_info *sta, u32 changed); 132 78 133 79 static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, 134 80 struct sta_info *sta, gfp_t gfp)