From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Subject: [PATCH 5/7] pipeline: support direct meters on the control path
Date: Fri, 26 Aug 2022 10:36:03 +0000 [thread overview]
Message-ID: <20220826103605.1579589-6-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20220826103605.1579589-1-cristian.dumitrescu@intel.com>
Add pipeline control path API to manage direct meters. These meters
are identified by a table key, whose entry ID is used as the index
into the meter array.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
lib/pipeline/rte_swx_ctl.h | 81 +++++++++++++++++++++++++++++++++
lib/pipeline/rte_swx_pipeline.c | 50 ++++++++++++++++++++
lib/pipeline/version.map | 3 ++
3 files changed, 134 insertions(+)
diff --git a/lib/pipeline/rte_swx_ctl.h b/lib/pipeline/rte_swx_ctl.h
index 1b47820441..2eb51b2c76 100644
--- a/lib/pipeline/rte_swx_ctl.h
+++ b/lib/pipeline/rte_swx_ctl.h
@@ -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
*
diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index e726bf1575..4b1b311093 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -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.
*/
diff --git a/lib/pipeline/version.map b/lib/pipeline/version.map
index 8ed92042d6..f53a037edf 100644
--- a/lib/pipeline/version.map
+++ b/lib/pipeline/version.map
@@ -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;
--
2.34.1
next prev parent reply other threads:[~2022-08-26 10:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 10:35 [PATCH 0/7] pipeline: support direct registers and meters Cristian Dumitrescu
2022-08-26 10:35 ` [PATCH 1/7] table: add entry ID for regular tables Cristian Dumitrescu
2022-08-26 10:36 ` [PATCH 2/7] table: add entry ID for learner tables Cristian Dumitrescu
2022-08-26 10:36 ` [PATCH 3/7] pipeline: add table entry ID read instruction Cristian Dumitrescu
2022-08-26 10:36 ` [PATCH 4/7] pipeline: support direct registers on the control path Cristian Dumitrescu
2022-08-26 10:36 ` Cristian Dumitrescu [this message]
2022-08-26 10:36 ` [PATCH 6/7] examples/pipeline: add CLI commands for direct registers Cristian Dumitrescu
2022-08-26 10:36 ` [PATCH 7/7] examples/pipeline: add CLI commands for direct meters Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 0/7] pipeline: support direct registers and meters Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 1/7] table: add entry ID for regular tables Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 2/7] table: add entry ID for learner tables Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 3/7] pipeline: add table entry ID read instruction Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 4/7] pipeline: support direct registers on the control path Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 5/7] pipeline: support direct meters " Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 6/7] examples/pipeline: add CLI commands for direct registers Cristian Dumitrescu
2022-08-26 11:21 ` [PATCH V2 7/7] examples/pipeline: add CLI commands for direct meters Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 0/7] pipeline: support direct registers and meters Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 1/7] table: add entry ID for regular tables Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 2/7] table: add entry ID for learner tables Cristian Dumitrescu
2022-09-24 8:25 ` Thomas Monjalon
2022-09-26 9:19 ` Dumitrescu, Cristian
2022-09-26 13:45 ` Thomas Monjalon
2022-08-30 18:58 ` [PATCH V3 3/7] pipeline: add table entry ID read instruction Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 4/7] pipeline: support direct registers on the control path Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 5/7] pipeline: support direct meters " Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 6/7] examples/pipeline: add CLI commands for direct registers Cristian Dumitrescu
2022-08-30 18:58 ` [PATCH V3 7/7] examples/pipeline: add CLI commands for direct meters Cristian Dumitrescu
2022-09-24 9:34 ` [PATCH V3 0/7] pipeline: support direct registers and meters Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220826103605.1579589-6-cristian.dumitrescu@intel.com \
--to=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).