Skip to content

Commit eb6d929

Browse files
dvlasenkjmberg-intel
authored andcommitted
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>
1 parent 727da60 commit eb6d929

2 files changed

Lines changed: 62 additions & 57 deletions

File tree

‎net/mac80211/rate.c‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo, charp, 0644);
2929
MODULE_PARM_DESC(ieee80211_default_rc_algo,
3030
"Default rate control algorithm for mac80211 to use");
3131

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+
3291
int ieee80211_rate_control_register(const struct rate_control_ops *ops)
3392
{
3493
struct rate_control_alg *alg;

‎net/mac80211/rate.h‎

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee80211_local *local,
7171
spin_unlock_bh(&sta->rate_ctrl_lock);
7272
}
7373

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,
10776
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);
13278

13379
static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
13480
struct sta_info *sta, gfp_t gfp)

0 commit comments

Comments
 (0)