diff options
author | Yamin Friedman | 2018-11-22 09:51:17 +0200 |
---|---|---|
committer | Saeed Mahameed | 2019-06-25 13:46:40 -0700 |
commit | 398c2b05bbee21cc172dfff017c0351d4d14e04c (patch) | |
tree | 46dc79312713a53112b23868f22d1cda3c932e9a /include | |
parent | 4f75da3666c0c572967729a2401ac650be5581b6 (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dim.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/include/linux/dim.h b/include/linux/dim.h index f48ede3e0322..aa9bdd47a648 100644 --- a/include/linux/dim.h +++ b/include/linux/dim.h @@ -37,6 +37,7 @@ struct dim_cq_moder { u16 usec; u16 pkts; + u16 comps; u8 cq_period_mode; }; @@ -54,6 +55,7 @@ struct dim_sample { u32 pkt_ctr; u32 byte_ctr; u16 event_ctr; + u32 comp_ctr; }; /** @@ -65,9 +67,11 @@ struct dim_sample { * @epms: Events per msec */ struct dim_stats { - int ppms; - int bpms; - int epms; + int ppms; /* packets per msec */ + int bpms; /* bytes per msec */ + int epms; /* events per msec */ + int cpms; /* completions per msec */ + int cpe_ratio; /* ratio of completions to events */ }; /** @@ -89,6 +93,7 @@ struct dim { u8 state; struct dim_stats prev_stats; struct dim_sample start_sample; + struct dim_sample measuring_sample; struct work_struct work; u8 profile_ix; u8 mode; @@ -246,6 +251,23 @@ dim_update_sample(u16 event_ctr, u64 packets, u64 bytes, struct dim_sample *s) s->event_ctr = event_ctr; } +/** + * dim_update_sample_with_comps - set a sample's fields with given + * values including the completion parameter + * @event_ctr: number of events to set + * @packets: number of packets to set + * @bytes: number of bytes to set + * @comps: number of completions to set + * @s: DIM sample + */ +static inline void +dim_update_sample_with_comps(u16 event_ctr, u64 packets, u64 bytes, u64 comps, + struct dim_sample *s) +{ + dim_update_sample(event_ctr, packets, bytes, s); + s->comp_ctr = comps; +} + /* Net DIM */ /* |