Lines Matching full:dim

6 #include <linux/dim.h>
10 * Net DIM profiles:
168 void net_dim_setting(struct net_device *dev, struct dim *dim, bool is_tx) in net_dim_setting() argument
176 INIT_WORK(&dim->work, irq_moder->tx_dim_work); in net_dim_setting()
177 dim->mode = READ_ONCE(irq_moder->dim_tx_mode); in net_dim_setting()
181 INIT_WORK(&dim->work, irq_moder->rx_dim_work); in net_dim_setting()
182 dim->mode = READ_ONCE(irq_moder->dim_rx_mode); in net_dim_setting()
186 void net_dim_work_cancel(struct dim *dim) in net_dim_work_cancel() argument
188 cancel_work_sync(&dim->work); in net_dim_work_cancel()
193 struct dim *dim) in net_dim_get_rx_irq_moder() argument
199 res = profile[dim->profile_ix]; in net_dim_get_rx_irq_moder()
202 res.cq_period_mode = dim->mode; in net_dim_get_rx_irq_moder()
209 struct dim *dim) in net_dim_get_tx_irq_moder() argument
215 res = profile[dim->profile_ix]; in net_dim_get_tx_irq_moder()
218 res.cq_period_mode = dim->mode; in net_dim_get_tx_irq_moder()
236 static int net_dim_step(struct dim *dim) in net_dim_step() argument
238 if (dim->tired == (NET_DIM_PARAMS_NUM_PROFILES * 2)) in net_dim_step()
241 switch (dim->tune_state) { in net_dim_step()
246 if (dim->profile_ix == (NET_DIM_PARAMS_NUM_PROFILES - 1)) in net_dim_step()
248 dim->profile_ix++; in net_dim_step()
249 dim->steps_right++; in net_dim_step()
252 if (dim->profile_ix == 0) in net_dim_step()
254 dim->profile_ix--; in net_dim_step()
255 dim->steps_left++; in net_dim_step()
259 dim->tired++; in net_dim_step()
263 static void net_dim_exit_parking(struct dim *dim) in net_dim_exit_parking() argument
265 dim->tune_state = dim->profile_ix ? DIM_GOING_LEFT : DIM_GOING_RIGHT; in net_dim_exit_parking()
266 net_dim_step(dim); in net_dim_exit_parking()
297 static bool net_dim_decision(struct dim_stats *curr_stats, struct dim *dim) in net_dim_decision() argument
299 int prev_state = dim->tune_state; in net_dim_decision()
300 int prev_ix = dim->profile_ix; in net_dim_decision()
304 switch (dim->tune_state) { in net_dim_decision()
307 &dim->prev_stats); in net_dim_decision()
309 net_dim_exit_parking(dim); in net_dim_decision()
313 dim->tired--; in net_dim_decision()
314 if (!dim->tired) in net_dim_decision()
315 net_dim_exit_parking(dim); in net_dim_decision()
321 &dim->prev_stats); in net_dim_decision()
323 dim_turn(dim); in net_dim_decision()
325 if (dim_on_top(dim)) { in net_dim_decision()
326 dim_park_on_top(dim); in net_dim_decision()
330 step_res = net_dim_step(dim); in net_dim_decision()
333 dim_park_on_top(dim); in net_dim_decision()
336 dim_park_tired(dim); in net_dim_decision()
344 dim->tune_state != DIM_PARKING_ON_TOP) in net_dim_decision()
345 dim->prev_stats = *curr_stats; in net_dim_decision()
347 return dim->profile_ix != prev_ix; in net_dim_decision()
350 void net_dim(struct dim *dim, struct dim_sample end_sample) in net_dim() argument
355 switch (dim->state) { in net_dim()
359 dim->start_sample.event_ctr); in net_dim()
362 if (!dim_calc_stats(&dim->start_sample, &end_sample, &curr_stats)) in net_dim()
364 if (net_dim_decision(&curr_stats, dim)) { in net_dim()
365 dim->state = DIM_APPLY_NEW_PROFILE; in net_dim()
366 schedule_work(&dim->work); in net_dim()
372 end_sample.byte_ctr, &dim->start_sample); in net_dim()
373 dim->state = DIM_MEASURE_IN_PROGRESS; in net_dim()