Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef RC80211_PID_H
00011 #define RC80211_PID_H
00012
00013
00014 #define RC_PID_INTERVAL 125
00015
00016
00017 #define RC_PID_SMOOTHING_SHIFT 3
00018 #define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT)
00019
00020
00021 #define RC_PID_SHARPENING_FACTOR 0
00022 #define RC_PID_SHARPENING_DURATION 0
00023
00024
00025 #define RC_PID_ARITH_SHIFT 8
00026
00027
00028 #define RC_PID_COEFF_P 15
00029
00030 #define RC_PID_COEFF_I 9
00031
00032 #define RC_PID_COEFF_D 15
00033
00034
00035
00036
00037
00038
00039 #define RC_PID_TARGET_PF 14
00040
00041
00042 #define RC_PID_NORM_OFFSET 3
00043
00044
00045 #define RC_PID_FAST_START 0
00046
00047
00048 #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \
00049 ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y))
00050
00051 enum rc_pid_event_type {
00052 RC_PID_EVENT_TYPE_TX_STATUS,
00053 RC_PID_EVENT_TYPE_RATE_CHANGE,
00054 RC_PID_EVENT_TYPE_TX_RATE,
00055 RC_PID_EVENT_TYPE_PF_SAMPLE,
00056 };
00057
00058 union rc_pid_event_data {
00059
00060 struct {
00061 u32 flags;
00062 struct ieee80211_tx_info tx_status;
00063 };
00064
00065
00066 struct {
00067 int index;
00068 int rate;
00069 };
00070
00071 struct {
00072 s32 pf_sample;
00073 s32 prop_err;
00074 s32 int_err;
00075 s32 der_err;
00076 };
00077 };
00078
00079 struct rc_pid_event {
00080
00081 unsigned long timestamp;
00082
00083
00084 unsigned int id;
00085
00086
00087 enum rc_pid_event_type type;
00088
00089
00090 union rc_pid_event_data data;
00091 };
00092
00093
00094 #define RC_PID_EVENT_RING_SIZE 32
00095
00096 struct rc_pid_event_buffer {
00097
00098 unsigned int ev_count;
00099
00100
00101 struct rc_pid_event ring[RC_PID_EVENT_RING_SIZE];
00102
00103
00104 unsigned int next_entry;
00105
00106
00107 spinlock_t lock;
00108
00109
00110 wait_queue_head_t waitqueue;
00111 };
00112
00113 struct rc_pid_events_file_info {
00114
00115 struct rc_pid_event_buffer *events;
00116
00117
00118 unsigned int next_entry;
00119 };
00120
00142 struct rc_pid_debugfs_entries {
00143 struct dentry *target;
00144 struct dentry *sampling_period;
00145 struct dentry *coeff_p;
00146 struct dentry *coeff_i;
00147 struct dentry *coeff_d;
00148 struct dentry *smoothing_shift;
00149 struct dentry *sharpen_factor;
00150 struct dentry *sharpen_duration;
00151 struct dentry *norm_offset;
00152 };
00153
00154 void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf,
00155 struct ieee80211_tx_info *stat);
00156
00157 void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf,
00158 int index, int rate);
00159
00160 void rate_control_pid_event_tx_rate(struct rc_pid_event_buffer *buf,
00161 int index, int rate);
00162
00163 void rate_control_pid_event_pf_sample(struct rc_pid_event_buffer *buf,
00164 s32 pf_sample, s32 prop_err,
00165 s32 int_err, s32 der_err);
00166
00167 void rate_control_pid_add_sta_debugfs(void *priv, void *priv_sta,
00168 struct dentry *dir);
00169
00170 void rate_control_pid_remove_sta_debugfs(void *priv, void *priv_sta);
00171
00172 struct rc_pid_sta_info {
00173 unsigned long last_change;
00174 unsigned long last_sample;
00175
00176 u32 tx_num_failed;
00177 u32 tx_num_xmit;
00178
00179 int txrate_idx;
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 s32 err_avg_sc;
00209
00210
00211 u32 last_pf;
00212
00213
00214 u8 sharp_cnt;
00215
00216 #ifdef CONFIG_MAC80211_DEBUGFS
00217
00218 struct rc_pid_event_buffer events;
00219
00220
00221 struct dentry *events_entry;
00222 #endif
00223 };
00224
00225
00226
00227
00228 struct rc_pid_rateinfo {
00229
00230
00231 int index;
00232
00233
00234 int rev_index;
00235
00236
00237 bool valid;
00238
00239
00240 int diff;
00241 };
00242
00243 struct rc_pid_info {
00244
00245
00246 unsigned int target;
00247
00248
00249 unsigned int sampling_period;
00250
00251
00252 int coeff_p;
00253 int coeff_i;
00254 int coeff_d;
00255
00256
00257 unsigned int smoothing_shift;
00258
00259
00260 unsigned int sharpen_factor;
00261 unsigned int sharpen_duration;
00262
00263
00264 unsigned int norm_offset;
00265
00266
00267 struct rc_pid_rateinfo *rinfo;
00268
00269
00270 int oldrate;
00271
00272 #ifdef CONFIG_MAC80211_DEBUGFS
00273
00274 struct rc_pid_debugfs_entries dentries;
00275 #endif
00276 };
00277
00278 #endif