306-mac80211-Deinline-rate_control_rate_init-rate_contro.patch 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. From: Denys Vlasenko <dvlasenk@redhat.com>
  2. Date: Wed, 15 Jul 2015 14:56:06 +0200
  3. Subject: [PATCH] mac80211: Deinline rate_control_rate_init,
  4. rate_control_rate_update
  5. With this .config: http://busybox.net/~vda/kernel_config,
  6. after deinlining these functions have sizes and callsite counts
  7. as follows:
  8. rate_control_rate_init: 554 bytes, 8 calls
  9. rate_control_rate_update: 1596 bytes, 5 calls
  10. Total size reduction: about 11 kbytes.
  11. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
  12. CC: John Linville <linville@tuxdriver.com>
  13. CC: Michal Kazior <michal.kazior@tieto.com>
  14. CC: Johannes Berg <johannes.berg@intel.com>
  15. Cc: linux-wireless@vger.kernel.org
  16. Cc: netdev@vger.kernel.org
  17. CC: linux-kernel@vger.kernel.org
  18. ---
  19. --- a/net/mac80211/rate.c
  20. +++ b/net/mac80211/rate.c
  21. @@ -29,6 +29,65 @@ module_param(ieee80211_default_rc_algo,
  22. MODULE_PARM_DESC(ieee80211_default_rc_algo,
  23. "Default rate control algorithm for mac80211 to use");
  24. +void rate_control_rate_init(struct sta_info *sta)
  25. +{
  26. + struct ieee80211_local *local = sta->sdata->local;
  27. + struct rate_control_ref *ref = sta->rate_ctrl;
  28. + struct ieee80211_sta *ista = &sta->sta;
  29. + void *priv_sta = sta->rate_ctrl_priv;
  30. + struct ieee80211_supported_band *sband;
  31. + struct ieee80211_chanctx_conf *chanctx_conf;
  32. +
  33. + ieee80211_sta_set_rx_nss(sta);
  34. +
  35. + if (!ref)
  36. + return;
  37. +
  38. + rcu_read_lock();
  39. +
  40. + chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  41. + if (WARN_ON(!chanctx_conf)) {
  42. + rcu_read_unlock();
  43. + return;
  44. + }
  45. +
  46. + sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  47. +
  48. + spin_lock_bh(&sta->rate_ctrl_lock);
  49. + ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  50. + priv_sta);
  51. + spin_unlock_bh(&sta->rate_ctrl_lock);
  52. + rcu_read_unlock();
  53. + set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  54. +}
  55. +
  56. +void rate_control_rate_update(struct ieee80211_local *local,
  57. + struct ieee80211_supported_band *sband,
  58. + struct sta_info *sta, u32 changed)
  59. +{
  60. + struct rate_control_ref *ref = local->rate_ctrl;
  61. + struct ieee80211_sta *ista = &sta->sta;
  62. + void *priv_sta = sta->rate_ctrl_priv;
  63. + struct ieee80211_chanctx_conf *chanctx_conf;
  64. +
  65. + if (ref && ref->ops->rate_update) {
  66. + rcu_read_lock();
  67. +
  68. + chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  69. + if (WARN_ON(!chanctx_conf)) {
  70. + rcu_read_unlock();
  71. + return;
  72. + }
  73. +
  74. + spin_lock_bh(&sta->rate_ctrl_lock);
  75. + ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  76. + ista, priv_sta, changed);
  77. + spin_unlock_bh(&sta->rate_ctrl_lock);
  78. + rcu_read_unlock();
  79. + }
  80. + drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  81. +}
  82. +
  83. int ieee80211_rate_control_register(const struct rate_control_ops *ops)
  84. {
  85. struct rate_control_alg *alg;
  86. --- a/net/mac80211/rate.h
  87. +++ b/net/mac80211/rate.h
  88. @@ -71,64 +71,10 @@ rate_control_tx_status_noskb(struct ieee
  89. spin_unlock_bh(&sta->rate_ctrl_lock);
  90. }
  91. -static inline void rate_control_rate_init(struct sta_info *sta)
  92. -{
  93. - struct ieee80211_local *local = sta->sdata->local;
  94. - struct rate_control_ref *ref = sta->rate_ctrl;
  95. - struct ieee80211_sta *ista = &sta->sta;
  96. - void *priv_sta = sta->rate_ctrl_priv;
  97. - struct ieee80211_supported_band *sband;
  98. - struct ieee80211_chanctx_conf *chanctx_conf;
  99. -
  100. - ieee80211_sta_set_rx_nss(sta);
  101. -
  102. - if (!ref)
  103. - return;
  104. -
  105. - rcu_read_lock();
  106. -
  107. - chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  108. - if (WARN_ON(!chanctx_conf)) {
  109. - rcu_read_unlock();
  110. - return;
  111. - }
  112. -
  113. - sband = local->hw.wiphy->bands[chanctx_conf->def.chan->band];
  114. -
  115. - spin_lock_bh(&sta->rate_ctrl_lock);
  116. - ref->ops->rate_init(ref->priv, sband, &chanctx_conf->def, ista,
  117. - priv_sta);
  118. - spin_unlock_bh(&sta->rate_ctrl_lock);
  119. - rcu_read_unlock();
  120. - set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
  121. -}
  122. -
  123. -static inline void rate_control_rate_update(struct ieee80211_local *local,
  124. +void rate_control_rate_init(struct sta_info *sta);
  125. +void rate_control_rate_update(struct ieee80211_local *local,
  126. struct ieee80211_supported_band *sband,
  127. - struct sta_info *sta, u32 changed)
  128. -{
  129. - struct rate_control_ref *ref = local->rate_ctrl;
  130. - struct ieee80211_sta *ista = &sta->sta;
  131. - void *priv_sta = sta->rate_ctrl_priv;
  132. - struct ieee80211_chanctx_conf *chanctx_conf;
  133. -
  134. - if (ref && ref->ops->rate_update) {
  135. - rcu_read_lock();
  136. -
  137. - chanctx_conf = rcu_dereference(sta->sdata->vif.chanctx_conf);
  138. - if (WARN_ON(!chanctx_conf)) {
  139. - rcu_read_unlock();
  140. - return;
  141. - }
  142. -
  143. - spin_lock_bh(&sta->rate_ctrl_lock);
  144. - ref->ops->rate_update(ref->priv, sband, &chanctx_conf->def,
  145. - ista, priv_sta, changed);
  146. - spin_unlock_bh(&sta->rate_ctrl_lock);
  147. - rcu_read_unlock();
  148. - }
  149. - drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
  150. -}
  151. + struct sta_info *sta, u32 changed);
  152. static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
  153. struct sta_info *sta, gfp_t gfp)