Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef IEEE80211_RATE_H
00012 #define IEEE80211_RATE_H
00013
00014 #include <linux/netdevice.h>
00015 #include <linux/skbuff.h>
00016 #include <linux/types.h>
00017 #include <linux/kref.h>
00018 #include <net/mac80211.h>
00019 #include "ieee80211_i.h"
00020 #include "sta_info.h"
00021
00022 struct rate_control_ref {
00023 struct ieee80211_local *local;
00024 struct rate_control_ops *ops;
00025 void *priv;
00026 struct kref kref;
00027 };
00028
00029 void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
00030 struct sta_info *sta,
00031 struct ieee80211_tx_rate_control *txrc);
00032 struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
00033 void rate_control_put(struct rate_control_ref *ref);
00034
00035 static inline void rate_control_tx_status(struct ieee80211_local *local,
00036 struct ieee80211_supported_band *sband,
00037 struct sta_info *sta,
00038 struct sk_buff *skb)
00039 {
00040 struct rate_control_ref *ref = local->rate_ctrl;
00041 struct ieee80211_sta *ista = &sta->sta;
00042 void *priv_sta = sta->rate_ctrl_priv;
00043
00044 if (!ref)
00045 return;
00046
00047 ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
00048 }
00049
00050
00051 static inline void rate_control_rate_init(struct sta_info *sta)
00052 {
00053 struct ieee80211_local *local = sta->sdata->local;
00054 struct rate_control_ref *ref = sta->rate_ctrl;
00055 struct ieee80211_sta *ista = &sta->sta;
00056 void *priv_sta = sta->rate_ctrl_priv;
00057 struct ieee80211_supported_band *sband;
00058
00059 if (!ref)
00060 return;
00061
00062 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
00063
00064 ref->ops->rate_init(ref->priv, sband, ista, priv_sta);
00065 }
00066
00067 static inline void rate_control_rate_update(struct ieee80211_local *local,
00068 struct ieee80211_supported_band *sband,
00069 struct sta_info *sta, u32 changed,
00070 enum nl80211_channel_type oper_chan_type)
00071 {
00072 struct rate_control_ref *ref = local->rate_ctrl;
00073 struct ieee80211_sta *ista = &sta->sta;
00074 void *priv_sta = sta->rate_ctrl_priv;
00075
00076 if (ref && ref->ops->rate_update)
00077 ref->ops->rate_update(ref->priv, sband, ista,
00078 priv_sta, changed, oper_chan_type);
00079 }
00080
00081 static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
00082 struct ieee80211_sta *sta,
00083 gfp_t gfp)
00084 {
00085 return ref->ops->alloc_sta(ref->priv, sta, gfp);
00086 }
00087
00088 static inline void rate_control_free_sta(struct sta_info *sta)
00089 {
00090 struct rate_control_ref *ref = sta->rate_ctrl;
00091 struct ieee80211_sta *ista = &sta->sta;
00092 void *priv_sta = sta->rate_ctrl_priv;
00093
00094 ref->ops->free_sta(ref->priv, ista, priv_sta);
00095 }
00096
00097 static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
00098 {
00099 #ifdef CONFIG_MAC80211_DEBUGFS
00100 struct rate_control_ref *ref = sta->rate_ctrl;
00101 if (ref && sta->debugfs.dir && ref->ops->add_sta_debugfs)
00102 ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv,
00103 sta->debugfs.dir);
00104 #endif
00105 }
00106
00107 static inline void rate_control_remove_sta_debugfs(struct sta_info *sta)
00108 {
00109 #ifdef CONFIG_MAC80211_DEBUGFS
00110 struct rate_control_ref *ref = sta->rate_ctrl;
00111 if (ref && ref->ops->remove_sta_debugfs)
00112 ref->ops->remove_sta_debugfs(ref->priv, sta->rate_ctrl_priv);
00113 #endif
00114 }
00115
00116
00117
00118 int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
00119 const char *name);
00120 void rate_control_deinitialize(struct ieee80211_local *local);
00121
00122
00123
00124 #ifdef CONFIG_MAC80211_RC_PID
00125 extern int rc80211_pid_init(void);
00126 extern void rc80211_pid_exit(void);
00127 #else
00128 static inline int rc80211_pid_init(void)
00129 {
00130 return 0;
00131 }
00132 static inline void rc80211_pid_exit(void)
00133 {
00134 }
00135 #endif
00136
00137 #ifdef CONFIG_MAC80211_RC_MINSTREL
00138 extern int rc80211_minstrel_init(void);
00139 extern void rc80211_minstrel_exit(void);
00140 #else
00141 static inline int rc80211_minstrel_init(void)
00142 {
00143 return 0;
00144 }
00145 static inline void rc80211_minstrel_exit(void)
00146 {
00147 }
00148 #endif
00149
00150 #ifdef CONFIG_MAC80211_RC_MINSTREL_HT
00151 extern int rc80211_minstrel_ht_init(void);
00152 extern void rc80211_minstrel_ht_exit(void);
00153 #else
00154 static inline int rc80211_minstrel_ht_init(void)
00155 {
00156 return 0;
00157 }
00158 static inline void rc80211_minstrel_ht_exit(void)
00159 {
00160 }
00161 #endif
00162
00163
00164 #endif