summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Klaiber <julian@klaiber.me>2023-08-14 11:39:13 +0000
committerDave Wallace <dwallacelf@gmail.com>2023-08-21 13:03:07 +0000
commite3ce81e56a425eecfc254314f4db1d1774eeba0f (patch)
treedcb65a2e2e2f001a9041e1ada65585f8418ff07b
parenta3808ee5b276d0ad17f01eefc891d24cb49d703d (diff)
sr: SRv6 Path Tracing midpoint processing performance improvement
Moved the kernel call for the timestamp outside of the inner loop to improve the batch proccessing, and minimizing the kernel calls. Type: improvement Change-Id: I0245c223fc8a178724bb8c5df2b98083be046c26 Signed-off-by: Julian Klaiber <julian@klaiber.me>
-rw-r--r--src/vnet/srv6/sr_pt_node.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/vnet/srv6/sr_pt_node.c b/src/vnet/srv6/sr_pt_node.c
index 338ec49102c..fa8b1f69b57 100644
--- a/src/vnet/srv6/sr_pt_node.c
+++ b/src/vnet/srv6/sr_pt_node.c
@@ -108,6 +108,10 @@ VLIB_NODE_FN (sr_pt_node)
u32 n_left_to_next;
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+ // Getting the timestamp (one for each batch of packets)
+ timestamp_64_t t64 = {};
+ unix_time_now_nsec_fraction (&t64.sec, &t64.nsec);
+
// Single loop for potentially the last three packets
while (n_left_from > 0 && n_left_to_next > 0)
{
@@ -123,7 +127,6 @@ VLIB_NODE_FN (sr_pt_node)
to_next += 1;
n_left_from -= 1;
n_left_to_next -= 1;
- timestamp_64_t t64 = {};
b0 = vlib_get_buffer (vm, bi0);
iface = vnet_buffer (b0)->sw_if_index[VLIB_TX];
@@ -132,7 +135,6 @@ VLIB_NODE_FN (sr_pt_node)
{
en0 = vlib_buffer_get_current (b0);
ip0 = (void *) (en0 + 1);
- unix_time_now_nsec_fraction (&t64.sec, &t64.nsec);
pt_midpoint_processing (vm, node, b0, ip0, ls, t64);
pt_behavior = PT_BEHAVIOR_MID;
}