X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=net%2Fmac80211%2Frc80211_pid.h;h=04afc13ed82551c87c2e2aa292cc00012da7520d;hb=7524d7d6de5d5d3f081de8cf5479819fad339661;hp=5d0056c1513b2cfb4d00dae3636c7dc0c507c758;hpb=12446c67fea1e5bc74c58e43ef53eea308cdda61;p=linux-2.6 diff --git a/net/mac80211/rc80211_pid.h b/net/mac80211/rc80211_pid.h index 5d0056c151..04afc13ed8 100644 --- a/net/mac80211/rc80211_pid.h +++ b/net/mac80211/rc80211_pid.h @@ -1,5 +1,6 @@ /* * Copyright 2007, Mattias Nissler + * Copyright 2007, Stefano Brivio * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -9,42 +10,42 @@ #ifndef RC80211_PID_H #define RC80211_PID_H -/* Sampling period for measuring percentage of failed frames. */ -#define RC_PID_INTERVAL (HZ / 8) +/* Sampling period for measuring percentage of failed frames in ms. */ +#define RC_PID_INTERVAL 125 /* Exponential averaging smoothness (used for I part of PID controller) */ -#define RC_PID_SMOOTHING_SHIFT 3 -#define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT) +#define RC_PID_SMOOTHING_SHIFT 3 +#define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT) /* Sharpening factor (used for D part of PID controller) */ -#define RC_PID_SHARPENING_FACTOR 0 -#define RC_PID_SHARPENING_DURATION 0 +#define RC_PID_SHARPENING_FACTOR 0 +#define RC_PID_SHARPENING_DURATION 0 /* Fixed point arithmetic shifting amount. */ -#define RC_PID_ARITH_SHIFT 8 +#define RC_PID_ARITH_SHIFT 8 /* Fixed point arithmetic factor. */ -#define RC_PID_ARITH_FACTOR (1 << RC_PID_ARITH_SHIFT) +#define RC_PID_ARITH_FACTOR (1 << RC_PID_ARITH_SHIFT) /* Proportional PID component coefficient. */ -#define RC_PID_COEFF_P 15 +#define RC_PID_COEFF_P 15 /* Integral PID component coefficient. */ -#define RC_PID_COEFF_I 9 +#define RC_PID_COEFF_I 9 /* Derivative PID component coefficient. */ -#define RC_PID_COEFF_D 15 +#define RC_PID_COEFF_D 15 /* Target failed frames rate for the PID controller. NB: This effectively gives * maximum failed frames percentage we're willing to accept. If the wireless * link quality is good, the controller will fail to adjust failed frames * percentage to the target. This is intentional. */ -#define RC_PID_TARGET_PF (11 << RC_PID_ARITH_SHIFT) +#define RC_PID_TARGET_PF 14 /* Rate behaviour normalization quantity over time. */ -#define RC_PID_NORM_OFFSET 3 +#define RC_PID_NORM_OFFSET 3 /* Push high rates right after loading. */ -#define RC_PID_FAST_START 0 +#define RC_PID_FAST_START 0 /* Arithmetic right shift for positive and negative values for ISO C. */ #define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ @@ -119,6 +120,43 @@ struct rc_pid_events_file_info { unsigned int next_entry; }; +/** + * struct rc_pid_debugfs_entries - tunable parameters + * + * Algorithm parameters, tunable via debugfs. + * @dir: the debugfs directory for a specific phy + * @target: target percentage for failed frames + * @sampling_period: error sampling interval in milliseconds + * @coeff_p: absolute value of the proportional coefficient + * @coeff_i: absolute value of the integral coefficient + * @coeff_d: absolute value of the derivative coefficient + * @smoothing_shift: absolute value of the integral smoothing factor (i.e. + * amount of smoothing introduced by the exponential moving average) + * @sharpen_factor: absolute value of the derivative sharpening factor (i.e. + * amount of emphasis given to the derivative term after low activity + * events) + * @sharpen_duration: duration of the sharpening effect after the detected low + * activity event, relative to sampling_period + * @norm_offset: amount of normalization periodically performed on the learnt + * rate behaviour values (lower means we should trust more what we learnt + * about behaviour of rates, higher means we should trust more the natural + * ordering of rates) + * @fast_start: if Y, push high rates right after initialization + */ +struct rc_pid_debugfs_entries { + struct dentry *dir; + struct dentry *target; + struct dentry *sampling_period; + struct dentry *coeff_p; + struct dentry *coeff_i; + struct dentry *coeff_d; + struct dentry *smoothing_shift; + struct dentry *sharpen_factor; + struct dentry *sharpen_duration; + struct dentry *norm_offset; + struct dentry *fast_start; +}; + void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, struct ieee80211_tx_status *stat); @@ -222,8 +260,8 @@ struct rc_pid_info { /* Exponential averaging shift. */ unsigned int smoothing_shift; - /* Sharpening shift and duration. */ - unsigned int sharpen_shift; + /* Sharpening factor and duration. */ + unsigned int sharpen_factor; unsigned int sharpen_duration; /* Normalization offset. */ @@ -237,6 +275,11 @@ struct rc_pid_info { /* Index of the last used rate. */ int oldrate; + +#ifdef CONFIG_MAC80211_DEBUGFS + /* Debugfs entries created for the parameters above. */ + struct rc_pid_debugfs_entries dentries; +#endif }; #endif /* RC80211_PID_H */