summaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/policer_api.c
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-10 13:53:42 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-15 12:15:32 +0000
commit48e26367cfe731d31472e18c1e0f6fe94bc4e9c3 (patch)
tree02216ea7b487311f7c947e7d3e15cebb5e3144f1 /src/vnet/policer/policer_api.c
parentfd0b399ff6dc246ce989cb592cf27d0015497711 (diff)
policer: add api to bind policer to worker
Add a new api to allow a policer to be bound to a specific worker thread for thread handoff. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I2623a6827843c3d93c0d7b4ad7c2e13611ec1696
Diffstat (limited to 'src/vnet/policer/policer_api.c')
-rw-r--r--src/vnet/policer/policer_api.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c
index fb66667504c..17ed73790cf 100644
--- a/src/vnet/policer/policer_api.c
+++ b/src/vnet/policer/policer_api.c
@@ -42,9 +42,10 @@
#include <vlibapi/api_helper_macros.h>
-#define foreach_vpe_api_msg \
-_(POLICER_ADD_DEL, policer_add_del) \
-_(POLICER_DUMP, policer_dump)
+#define foreach_vpe_api_msg \
+ _ (POLICER_ADD_DEL, policer_add_del) \
+ _ (POLICER_BIND, policer_bind) \
+ _ (POLICER_DUMP, policer_dump)
static void
vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
@@ -96,6 +97,26 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
}
static void
+vl_api_policer_bind_t_handler (vl_api_policer_bind_t *mp)
+{
+ vl_api_policer_bind_reply_t *rmp;
+ u8 *name;
+ u32 worker_index;
+ u8 bind_enable;
+ int rv;
+
+ name = format (0, "%s", mp->name);
+ vec_terminate_c_string (name);
+
+ worker_index = ntohl (mp->worker_index);
+ bind_enable = mp->bind_enable;
+
+ rv = policer_bind_worker (name, worker_index, bind_enable);
+ vec_free (name);
+ REPLY_MACRO (VL_API_POLICER_BIND_REPLY);
+}
+
+static void
send_policer_details (u8 *name, qos_pol_cfg_params_st *config,
policer_read_response_type_st *templ,
vl_api_registration_t *reg, u32 context)