From e207624c6d92e9c2979e1e310cab660f0320ca48 Mon Sep 17 00:00:00 2001 From: Paolo Abeni Date: Thu, 14 Dec 2017 13:04:12 +0100 Subject: trafgen: fix dinc()/ddec() modifiers currently, after dinc(), the valued stored inside the packet is not in the (min, max) range but in the (0, max - min + 1) range, 'counter->val' should be used instead of 'val'. Additionally the values computed for ddec() are corrupted, in: val = (val - counter->inc) % (counter->min - counter->max + 1); the divider is negative, we should use (counter->max - counter->min + 1) as in the INC case. Finally we can avoid the switch statement at update time, inverting the value of 'counter->inc' for decrement and using a data type wide enough for the 'inc' field. v1 -> v2: - changed 'counter->inc' type to int Signed-off-by: Paolo Abeni Signed-off-by: Tobias Klauser --- trafgen_conf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'trafgen_conf.h') diff --git a/trafgen_conf.h b/trafgen_conf.h index a0bbe43..fcbbb17 100644 --- a/trafgen_conf.h +++ b/trafgen_conf.h @@ -22,8 +22,8 @@ enum csum { }; struct counter { - int type; - uint8_t min, max, inc, val; + int type, inc; + uint8_t min, max, val; off_t off; }; -- cgit v1.2.3-54-g00ecf ack'>packet-loop-back net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/kobject.txt')