Lines Matching refs:dim
6 #include <linux/dim.h>
104 static int net_dim_step(struct dim *dim)
106 if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2))
109 switch (dim->tune_state) {
114 if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1))
116 dim->profile_ix++;
117 dim->steps_right++;
120 if (dim->profile_ix == 0)
122 dim->profile_ix--;
123 dim->steps_left++;
127 dim->tired++;
131 static void net_dim_exit_parking(struct dim *dim)
133 dim->tune_state = dim->profile_ix ? DIM_GOING_LEFT : DIM_GOING_RIGHT;
134 net_dim_step(dim);
165 static bool net_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
167 int prev_state = dim->tune_state;
168 int prev_ix = dim->profile_ix;
172 switch (dim->tune_state) {
175 &dim->prev_stats);
177 net_dim_exit_parking(dim);
181 dim->tired--;
182 if (!dim->tired)
183 net_dim_exit_parking(dim);
189 &dim->prev_stats);
191 dim_turn(dim);
193 if (dim_on_top(dim)) {
194 dim_park_on_top(dim);
198 step_res = net_dim_step(dim);
201 dim_park_on_top(dim);
204 dim_park_tired(dim);
212 dim->tune_state != DIM_PARKING_ON_TOP)
213 dim->prev_stats = *curr_stats;
215 return dim->profile_ix != prev_ix;
218 void net_dim(struct dim *dim, struct dim_sample end_sample)
223 switch (dim->state) {
227 dim->start_sample.event_ctr);
230 if (!dim_calc_stats(&dim->start_sample, &end_sample, &curr_stats))
232 if (net_dim_decision(&curr_stats, dim)) {
233 dim->state = DIM_APPLY_NEW_PROFILE;
234 schedule_work(&dim->work);
240 end_sample.byte_ctr, &dim->start_sample);
241 dim->state = DIM_MEASURE_IN_PROGRESS;