aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2016-11-11 05:58:10 +0100
committerDave Barach <openvpp@barachs.net>2016-11-12 03:13:12 +0000
commite5af88c8205f4615e86f333bfd837d7a1cc97c7d (patch)
treed62a365aa87476b89337f5fda4a576080d27647a
parent7f3c36bb852017c2edbeb609a5e10446a7605157 (diff)
Fix a bug in the timing wheel
Properly propagate vector allocated in advance_cpu_time_base() for a special case, when the expired_user_data parameter passed to timing_wheel_advance() is NULL and the only expired event is in the overflow pool. Change-Id: I5cefab0e881958334791aaa6354ec08225af23c1 Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r--vppinfra/vppinfra/timing_wheel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vppinfra/vppinfra/timing_wheel.c b/vppinfra/vppinfra/timing_wheel.c
index 902140c9..4c8a2c58 100644
--- a/vppinfra/vppinfra/timing_wheel.c
+++ b/vppinfra/vppinfra/timing_wheel.c
@@ -468,7 +468,7 @@ expire_bin (timing_wheel_t * w,
}
/* Called rarely. 32 bit times should only overflow every 4 seconds or so on a fast machine. */
-static void
+static u32 *
advance_cpu_time_base (timing_wheel_t * w, u32 * expired_user_data)
{
timing_wheel_level_t *l;
@@ -519,6 +519,7 @@ advance_cpu_time_base (timing_wheel_t * w, u32 * expired_user_data)
}));
/* *INDENT-ON* */
}
+ return expired_user_data;
}
static u32 *
@@ -683,7 +684,7 @@ timing_wheel_advance (timing_wheel_t * w, u64 advance_cpu_time,
/* Don't advance until necessary. */
while (PREDICT_FALSE
(advance_time_index >= w->time_index_next_cpu_time_base_update))
- advance_cpu_time_base (w, expired_user_data);
+ expired_user_data = advance_cpu_time_base (w, expired_user_data);
if (next_expiring_element_cpu_time)
{