From patchwork Thu Sep 6 16:26:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 44334 X-Patchwork-Delegate: cristian.dumitrescu@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD80D4F94; Thu, 6 Sep 2018 18:27:12 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id B76704CBD for ; Thu, 6 Sep 2018 18:27:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 09:27:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,338,1531810800"; d="scan'208";a="68064429" Received: from sivswdev02.ir.intel.com (HELO localhost.localdomain) ([10.237.217.46]) by fmsmga007.fm.intel.com with ESMTP; 06 Sep 2018 09:27:08 -0700 From: Reshma Pattan To: dev@dpdk.org Cc: Cristian Dumitrescu , Reshma Pattan Date: Thu, 6 Sep 2018 17:26:50 +0100 Message-Id: <1536251222-17275-4-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1536251222-17275-1-git-send-email-reshma.pattan@intel.com> References: <1536251222-17275-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH 03/15] net/softnic: add new cli for flow attribute map X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Added new cli by which user can specify to softnic which rte flow group and direction has to mapped to which pipeline and table. Signed-off-by: Cristian Dumitrescu Signed-off-by: Reshma Pattan --- drivers/net/softnic/rte_eth_softnic_cli.c | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 0c7448cc4..8f5f82555 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -4797,6 +4797,81 @@ cmd_softnic_thread_pipeline_disable(struct pmd_internals *softnic, } } +/** + * flowapi map + * group + * ingress | egress + * pipeline + * table + */ +static void +cmd_softnic_flowapi_map(struct pmd_internals *softnic, + char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size) +{ + char *pipeline_name; + uint32_t group_id, table_id; + int ingress, status; + + if (n_tokens != 9) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[1], "map") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "map"); + return; + } + + if (strcmp(tokens[2], "group") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "group"); + return; + } + + if (softnic_parser_read_uint32(&group_id, tokens[3]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "group_id"); + return; + } + + if (strcmp(tokens[4], "ingress") == 0) { + ingress = 1; + } else if (strcmp(tokens[4], "egress") == 0) { + ingress = 0; + } else { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "ingress | egress"); + return; + } + + if (strcmp(tokens[5], "pipeline") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline"); + return; + } + + pipeline_name = tokens[6]; + + if (strcmp(tokens[7], "table") != 0) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "table"); + return; + } + + if (softnic_parser_read_uint32(&table_id, tokens[8]) != 0) { + snprintf(out, out_size, MSG_ARG_INVALID, "table_id"); + return; + } + + status = flow_attr_map_set(softnic, + group_id, + ingress, + pipeline_name, + table_id); + if (status) { + snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); + return; + } +} + void softnic_cli_process(char *in, char *out, size_t out_size, void *arg) { @@ -5089,6 +5164,12 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) } } + if (strcmp(tokens[0], "flowapi") == 0) { + cmd_softnic_flowapi_map(softnic, tokens, n_tokens, out, + out_size); + return; + } + snprintf(out, out_size, MSG_CMD_UNKNOWN, tokens[0]); }