summaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/police_inlines.h
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-18 11:00:38 +0000
committerBrian Russell <brian@graphiant.com>2021-02-19 11:00:33 +0000
commit1aa991280c00f4c160f035e5d5c62273b7fd8b63 (patch)
treed72c1de41d8290f94e826f61c1470e279c2fc2c6 /src/vnet/policer/police_inlines.h
parentfce88656cc1b0da8731a71c4a6efa759e0df3fa8 (diff)
policer: add thread handoff for device input
Add worker thread handoff for policers on the device input feature arc on an interface. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: Ib795457a09a5b3be3c4e6422c91e33100192b8e2
Diffstat (limited to 'src/vnet/policer/police_inlines.h')
-rw-r--r--src/vnet/policer/police_inlines.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/vnet/policer/police_inlines.h b/src/vnet/policer/police_inlines.h
index 9f56e1134d6..59afb562509 100644
--- a/src/vnet/policer/police_inlines.h
+++ b/src/vnet/policer/police_inlines.h
@@ -124,10 +124,14 @@ policer_handoff (vlib_main_t *vm, vlib_node_runtime_t *node,
vnet_policer_main_t *pm;
policer_t *policer;
u32 this_thread, policer_thread;
+ bool single_policer_node = (policer_index != ~0);
pm = &vnet_policer_main;
- policer = &pm->policers[policer_index];
- policer_thread = policer->thread_index;
+ if (single_policer_node)
+ {
+ policer = &pm->policers[policer_index];
+ policer_thread = policer->thread_index;
+ }
this_thread = vm->thread_index;
from = vlib_frame_vector_args (frame);
@@ -139,7 +143,16 @@ policer_handoff (vlib_main_t *vm, vlib_node_runtime_t *node,
while (n_left_from > 0)
{
- ti[0] = policer_thread;
+ if (!single_policer_node)
+ {
+ policer_index = vnet_buffer (b[0])->policer.index;
+ policer = &pm->policers[policer_index];
+ ti[0] = policer->thread_index;
+ }
+ else
+ {
+ ti[0] = policer_thread;
+ }
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
b[0]->flags & VLIB_BUFFER_IS_TRACED))
@@ -147,7 +160,7 @@ policer_handoff (vlib_main_t *vm, vlib_node_runtime_t *node,
policer_handoff_trace_t *t =
vlib_add_trace (vm, node, b[0], sizeof (*t));
t->current_worker_index = this_thread;
- t->next_worker_index = policer_thread;
+ t->next_worker_index = ti[0];
t->policer_index = policer_index;
}