[PATCH V3 16/21] net/softnic: add pipeline commit and abort CLI commands
Cristian Dumitrescu
cristian.dumitrescu at intel.com
Thu Sep 1 16:20:36 CEST 2022
Add CLI commands for pipeline table update commit and abort.
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra at intel.com>
---
drivers/net/softnic/rte_eth_softnic_cli.c | 70 +++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 4b7d001033..7c25a502ec 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1343,6 +1343,66 @@ cmd_softnic_pipeline_learner_default(struct pmd_internals *softnic,
fclose(file);
}
+/**
+ * pipeline <pipeline_name> commit
+ */
+static void
+cmd_softnic_pipeline_commit(struct pmd_internals *softnic,
+ char **tokens,
+ uint32_t n_tokens,
+ char *out,
+ size_t out_size)
+{
+ struct pipeline *p;
+ char *pipeline_name;
+ int status;
+
+ if (n_tokens != 3) {
+ snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+ return;
+ }
+
+ pipeline_name = tokens[1];
+ p = softnic_pipeline_find(softnic, pipeline_name);
+ if (!p) {
+ snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
+ return;
+ }
+
+ status = rte_swx_ctl_pipeline_commit(p->ctl, 1);
+ if (status)
+ snprintf(out, out_size, "Commit failed. "
+ "Use \"commit\" to retry or \"abort\" to discard the pending work.\n");
+}
+
+/**
+ * pipeline <pipeline_name> abort
+ */
+static void
+cmd_softnic_pipeline_abort(struct pmd_internals *softnic,
+ char **tokens,
+ uint32_t n_tokens,
+ char *out,
+ size_t out_size)
+{
+ struct pipeline *p;
+ char *pipeline_name;
+
+ if (n_tokens != 3) {
+ snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
+ return;
+ }
+
+ pipeline_name = tokens[1];
+ p = softnic_pipeline_find(softnic, pipeline_name);
+ if (!p) {
+ snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
+ return;
+ }
+
+ rte_swx_ctl_pipeline_abort(p->ctl);
+}
+
/**
* thread <thread_id> pipeline <pipeline_name> enable [ period <timer_period_ms> ]
*/
@@ -1563,6 +1623,16 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg)
out, out_size);
return;
}
+
+ if (n_tokens >= 3 && !strcmp(tokens[2], "commit")) {
+ cmd_softnic_pipeline_commit(softnic, tokens, n_tokens, out, out_size);
+ return;
+ }
+
+ if (n_tokens >= 3 && !strcmp(tokens[2], "abort")) {
+ cmd_softnic_pipeline_abort(softnic, tokens, n_tokens, out, out_size);
+ return;
+ }
}
if (strcmp(tokens[0], "thread") == 0) {
--
2.34.1
More information about the dev
mailing list