summaryrefslogtreecommitdiffstats
path: root/src/vnet/qos/qos_api.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-07-31 02:48:02 -0700
committerNeale Ranns <nranns@cisco.com>2019-07-31 16:17:36 +0000
commit83832e7ced8be8b7de394415feaba70c32e3c38d (patch)
treeb9269e9f5cff694fa39cc26b5c25cb81828e1435 /src/vnet/qos/qos_api.c
parentb504777e7f1c9728e65b874284b4dfd39359c8a8 (diff)
qos: Store function
Type: feature store: write a QoS value into the buffer meta-data record: Extract a QoS value from a packet header and store it. mark: Make a change to the content of a packet header by writing a stored QoS value Change-Id: I07d1e87dd1ca90d40ac1ae1774fee1b272cab83f Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/qos/qos_api.c')
-rw-r--r--src/vnet/qos/qos_api.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/vnet/qos/qos_api.c b/src/vnet/qos/qos_api.c
index 966ffcce395..cb92c851854 100644
--- a/src/vnet/qos/qos_api.c
+++ b/src/vnet/qos/qos_api.c
@@ -20,6 +20,7 @@
#include <vnet/api_errno.h>
#include <vnet/qos/qos_record.h>
+#include <vnet/qos/qos_store.h>
#include <vnet/qos/qos_mark.h>
#include <vnet/qos/qos_egress_map.h>
@@ -45,6 +46,8 @@
#define foreach_qos_api_msg \
_(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable) \
_(QOS_RECORD_DUMP, qos_record_dump) \
+ _(QOS_STORE_ENABLE_DISABLE, qos_store_enable_disable) \
+ _(QOS_STORE_DUMP, qos_store_dump) \
_(QOS_EGRESS_MAP_DELETE, qos_egress_map_delete) \
_(QOS_EGRESS_MAP_UPDATE, qos_egress_map_update) \
_(QOS_EGRESS_MAP_DUMP, qos_egress_map_dump) \
@@ -145,6 +148,74 @@ vl_api_qos_record_dump_t_handler (vl_api_qos_record_dump_t * mp)
}
void
+vl_api_qos_store_enable_disable_t_handler (vl_api_qos_store_enable_disable_t
+ * mp)
+{
+ vl_api_qos_store_enable_disable_reply_t *rmp;
+ qos_source_t qs;
+ int rv = 0;
+
+ VALIDATE_SW_IF_INDEX (&(mp->store));
+
+ rv = qos_source_decode (mp->store.input_source, &qs);
+
+ if (0 == rv)
+ {
+ if (mp->enable)
+ rv = qos_store_enable (ntohl (mp->store.sw_if_index), qs,
+ mp->store.value);
+ else
+ rv = qos_store_disable (ntohl (mp->store.sw_if_index), qs);
+ }
+
+ BAD_SW_IF_INDEX_LABEL;
+ REPLY_MACRO (VL_API_QOS_STORE_ENABLE_DISABLE_REPLY);
+}
+
+typedef struct qos_store_send_walk_ctx_t_
+{
+ vl_api_registration_t *reg;
+ u32 context;
+} qos_store_send_walk_ctx_t;
+
+static walk_rc_t
+send_qos_store_details (u32 sw_if_index,
+ qos_source_t input_source, qos_bits_t value, void *c)
+{
+ qos_store_send_walk_ctx_t *ctx;
+ vl_api_qos_store_details_t *mp;
+
+ ctx = c;
+ mp = vl_msg_api_alloc_zero (sizeof (*mp));
+
+ mp->_vl_msg_id = ntohs (VL_API_QOS_STORE_DETAILS);
+ mp->context = ctx->context;
+ mp->store.sw_if_index = htonl (sw_if_index);
+ mp->store.input_source = qos_source_encode (input_source);
+ mp->store.value = value;
+
+ vl_api_send_msg (ctx->reg, (u8 *) mp);
+
+ return (WALK_CONTINUE);
+}
+
+static void
+vl_api_qos_store_dump_t_handler (vl_api_qos_store_dump_t * mp)
+{
+ vl_api_registration_t *reg;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ qos_store_send_walk_ctx_t ctx = {
+ .reg = reg,
+ .context = mp->context,
+ };
+ qos_store_walk (send_qos_store_details, &ctx);
+}
+
+void
vl_api_qos_egress_map_update_t_handler (vl_api_qos_egress_map_update_t * mp)
{
vl_api_qos_egress_map_update_reply_t *rmp;