@@ -1440,6 +1440,87 @@ rte_swx_ctl_meter_stats_read(struct rte_swx_pipeline *p,
uint32_t metarray_index,
struct rte_swx_ctl_meter_stats *stats);
+/**
+ * Meter reset with table key lookup
+ *
+ * Reset a meter within a given meter array to use the default profile that
+ * causes all the input packets to be colored as green. It is the responsibility
+ * of the control plane to make sure this meter is not used by the data plane
+ * pipeline before calling this function.
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] metarray_name
+ * Meter array name.
+ * @param[in] table_name
+ * Regular or learner table name.
+ * @param[in] table_key
+ * Table key.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_meter_reset_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key);
+
+/**
+ * Meter set with table key lookup
+ *
+ * Set a meter within a given meter array to use a specific profile. It is the
+ * responsibility of the control plane to make sure this meter is not used by
+ * the data plane pipeline before calling this function.
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] metarray_name
+ * Meter array name.
+ * @param[in] table_name
+ * Regular or learner table name.
+ * @param[in] table_key
+ * Table key.
+ * @param[in] profile_name
+ * Existing meter profile name.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_meter_set_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key,
+ const char *profile_name);
+
+/**
+ * Meter statistics counters read with table key lookup
+ *
+ * @param[in] p
+ * Pipeline handle.
+ * @param[in] metarray_name
+ * Meter array name.
+ * @param[in] table_name
+ * Regular or learner table name.
+ * @param[in] table_key
+ * Table key.
+ * @param[out] stats
+ * Meter statistics counters.
+ * @return
+ * 0 on success or the following error codes otherwise:
+ * -EINVAL: Invalid argument.
+ */
+__rte_experimental
+int
+rte_swx_ctl_meter_stats_read_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key,
+ struct rte_swx_ctl_meter_stats *stats);
+
/**
* Pipeline control free
*
@@ -11315,6 +11315,56 @@ rte_swx_ctl_pipeline_regarray_write_with_key(struct rte_swx_pipeline *p,
return rte_swx_ctl_pipeline_regarray_write(p, regarray_name, entry_id, value);
}
+int
+rte_swx_ctl_meter_reset_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key)
+{
+ size_t entry_id = 0;
+ int status;
+
+ status = rte_swx_ctl_pipeline_table_entry_id_get(p, table_name, table_key, &entry_id);
+ if (status)
+ return status;
+
+ return rte_swx_ctl_meter_reset(p, metarray_name, entry_id);
+}
+
+int
+rte_swx_ctl_meter_set_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key,
+ const char *profile_name)
+{
+ size_t entry_id = 0;
+ int status;
+
+ status = rte_swx_ctl_pipeline_table_entry_id_get(p, table_name, table_key, &entry_id);
+ if (status)
+ return status;
+
+ return rte_swx_ctl_meter_set(p, metarray_name, entry_id, profile_name);
+}
+
+int
+rte_swx_ctl_meter_stats_read_with_key(struct rte_swx_pipeline *p,
+ const char *metarray_name,
+ const char *table_name,
+ uint8_t *table_key,
+ struct rte_swx_ctl_meter_stats *stats)
+{
+ size_t entry_id = 0;
+ int status;
+
+ status = rte_swx_ctl_pipeline_table_entry_id_get(p, table_name, table_key, &entry_id);
+ if (status)
+ return status;
+
+ return rte_swx_ctl_meter_stats_read(p, metarray_name, entry_id, stats);
+}
+
/*
* Pipeline compilation.
*/
@@ -146,6 +146,9 @@ EXPERIMENTAL {
rte_swx_pipeline_hash_func_register;
#added in 22.11
+ rte_swx_ctl_meter_reset_with_key;
+ rte_swx_ctl_meter_set_with_key;
+ rte_swx_ctl_meter_stats_read_with_key;
rte_swx_ctl_pipeline_find;
rte_swx_ctl_pipeline_regarray_read_with_key;
rte_swx_ctl_pipeline_regarray_write_with_key;