aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/clib.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-11-02 18:00:32 -0800
committerDave Barach <openvpp@barachs.net>2020-12-01 18:49:38 +0000
commit7808df2e2fd0fd61a27e5a5322dc6dafe40924e5 (patch)
tree9603cc44bb4429c6bf4005df78ce050e10e9e36b /src/vppinfra/clib.h
parentde22111b5280301cdd5e7862e593e24715bc6292 (diff)
session: allow small pacer bursts
Instead of enforcing a "strict" release of data, which relies on frequent rescheduling of sessions, allow some pacer coalescing, i.e., short bursts, that can minimize load on scheduler/session layer and potentially leverage tso. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I67e38e5b8dc335bd214113b70c68c27ae92bd6da
Diffstat (limited to 'src/vppinfra/clib.h')
-rw-r--r--src/vppinfra/clib.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vppinfra/clib.h b/src/vppinfra/clib.h
index 9474350c6da..22377c61440 100644
--- a/src/vppinfra/clib.h
+++ b/src/vppinfra/clib.h
@@ -332,6 +332,14 @@ extract_bits (uword x, int start, int count)
_x < _y ? _x : _y; \
})
+#define clib_clamp(x,lo,hi) \
+({ \
+ __typeof__ (x) _x = (x); \
+ __typeof__ (lo) _lo = (lo); \
+ __typeof__ (hi) _hi = (hi); \
+ _x < _lo ? _lo : (_x > _hi ? _hi : _x); \
+})
+
#define clib_abs(x) \
({ \
__typeof__ (x) _x = (x); \