mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
linux/dim: Add completions count to dim_sample
Added a measurement of completions per/msec to allow for completion based dim algorithms. In order to use dynamic interrupt moderation with RDMA we need to have a different measurment than packets per second. This change is meant to prepare for adding a new DIM method. All drivers that use net_dim and thus do not need a completion count will have the completions set to 0. Signed-off-by: Yamin Friedman <yaminf@mellanox.com> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
committed by
Saeed Mahameed
parent
4f75da3666
commit
398c2b05bb
@@ -62,6 +62,8 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
|
||||
u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
|
||||
u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
|
||||
start->byte_ctr);
|
||||
u32 ncomps = BIT_GAP(BITS_PER_TYPE(u32), end->comp_ctr,
|
||||
start->comp_ctr);
|
||||
|
||||
if (!delta_us)
|
||||
return;
|
||||
@@ -70,5 +72,12 @@ void dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
|
||||
curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
|
||||
curr_stats->epms = DIV_ROUND_UP(DIM_NEVENTS * USEC_PER_MSEC,
|
||||
delta_us);
|
||||
curr_stats->cpms = DIV_ROUND_UP(ncomps * USEC_PER_MSEC, delta_us);
|
||||
if (curr_stats->epms != 0)
|
||||
curr_stats->cpe_ratio =
|
||||
(curr_stats->cpms * 100) / curr_stats->epms;
|
||||
else
|
||||
curr_stats->cpe_ratio = 0;
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(dim_calc_stats);
|
||||
|
Reference in New Issue
Block a user