From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jasvinder Singh Subject: [PATCH 5/6] net/softnic: add CLI command for tmgr hierarchy commit Date: Wed, 25 Jul 2018 18:10:06 +0100 Message-ID: <20180725171007.94198-6-jasvinder.singh@intel.com> References: <20180725171007.94198-1-jasvinder.singh@intel.com> Cc: cristian.dumitrescu@intel.com To: dev@dpdk.org Return-path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 5BAA2326C for ; Wed, 25 Jul 2018 19:10:15 +0200 (CEST) In-Reply-To: <20180725171007.94198-1-jasvinder.singh@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Cristian Dumitrescu Add support for Traffic Manager (TMGR) hierarchy commit through firmware CLI script. Signed-off-by: Cristian Dumitrescu Signed-off-by: Jasvinder Singh --- drivers/net/softnic/rte_eth_softnic_cli.c | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index d5485b5..4bd792b 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -503,6 +503,46 @@ cmd_tmgr_node(struct pmd_internals *softnic, } /** + * tmgr hierarchy commit + */ +static void +cmd_tmgr_hierarchy_commit(struct pmd_internals *softnic, + char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size) +{ + struct rte_tm_error error; + uint16_t port_id; + int status; + + if (n_tokens != 3) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "hierarchy") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "hierarchy"); + return; + } + + if (strcmp(tokens[2], "commit") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "commit"); + return; + } + + status = rte_eth_dev_get_port_by_name(softnic->params.name, &port_id); + if (status != 0) + return; + + status = rte_tm_hierarchy_commit(port_id, 1, &error); + if (status) { + snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); + return; + } +} + +/** * tmgr */ static void @@ -4325,6 +4365,13 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) cmd_tmgr_node(softnic, tokens, n_tokens, out, out_size); return; } + + if (n_tokens >= 3 && + (strcmp(tokens[1], "hierarchy") == 0) && + (strcmp(tokens[2], "commit") == 0)) { + cmd_tmgr_hierarchy_commit(softnic, tokens, n_tokens, out, out_size); + return; + } } if (strcmp(tokens[0], "tap") == 0) { -- 2.9.3