@@ -37,6 +37,9 @@ void token_bucket_init(struct token_bucket *,
void token_bucket_set(struct token_bucket *,
unsigned int rate, unsigned int burst);
bool token_bucket_withdraw(struct token_bucket *, unsigned int n);
-void token_bucket_wait(struct token_bucket *, unsigned int n);
+void token_bucket_wait_at(struct token_bucket *, unsigned int n,
+ const char *where);
+#define token_bucket_wait(bucket, n) \
+ token_bucket_wait_at(bucket, n, OVS_SOURCE_LOCATOR)
#endif /* token-bucket.h */
@@ -85,12 +85,13 @@ token_bucket_withdraw(struct token_bucket *tb, unsigned int n)
/* Causes the poll loop to wake up when at least 'n' tokens will be available
* for withdrawal from 'tb'. */
void
-token_bucket_wait(struct token_bucket *tb, unsigned int n)
+token_bucket_wait_at(struct token_bucket *tb, unsigned int n,
+ const char *where)
{
if (tb->tokens >= n) {
- poll_immediate_wake();
+ poll_immediate_wake_at(where);
} else {
unsigned int need = n - tb->tokens;
- poll_timer_wait_until(tb->last_fill + need / tb->rate + 1);
+ poll_timer_wait_until_at(tb->last_fill + need / tb->rate + 1, where);
}
}
Having the caller of token_bucket_wait() indicated in the log messages makes debugging easier. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> --- include/openvswitch/token-bucket.h | 5 ++++- lib/token-bucket.c | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-)