net/softnic: add pipeline commit and abort commands
Add CLI commands for pipeline table update commit and abort. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
This commit is contained in:
parent
3f14baa083
commit
b4647f3a18
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user