From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B772BA0543; Fri, 26 Aug 2022 15:20:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B13DB42BBA; Fri, 26 Aug 2022 15:18:23 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 4610B4280E for ; Fri, 26 Aug 2022 15:18:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661519883; x=1693055883; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=68uxWk56Yb4/dzaplTkiVCVUlsjt+Lae8xn2Zh2LIS8=; b=eXYZYXMn+sie6j+tbUR1WwsX22DC95JtTQVbRMQwD81E3sPFte5sFne5 +lV4H9YJON2FlkBRQjXpVIpySV5cjWQQ/rseNHeR+8Utibj0U45PTAVbL dpP55mjlP79hXPmca5rFOuB1UxFQ+GPwNsYc4zKwHVPeMNWwXUZ3yu8NC y7R/7m+1BZtosJRYKf6HOmhVNVhLwfqlK7f0vmSztgcc+4IBAkvWgAkR8 psGJ7Mm0tpAsUu2Hf8o6NgOiOTyH4nn1UaOwa/h0NcNiP9aRFa9AR6EVL /TRCUVlLkaqKfgu8ej1HhydxqyMvlFFHWapUKrWoMvSwzkgZ1e5H4nRrG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="320598620" X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="320598620" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2022 06:17:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="610561719" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by orsmga002.jf.intel.com with ESMTP; 26 Aug 2022 06:17:56 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Yogesh Jangra Subject: [PATCH V2 20/21] net/softnic: add pipeline mirroring CLI command Date: Fri, 26 Aug 2022 13:17:36 +0000 Message-Id: <20220826131737.1741743-21-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220826131737.1741743-1-cristian.dumitrescu@intel.com> References: <20220804165839.1074817-1-cristian.dumitrescu@intel.com> <20220826131737.1741743-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add CLI command for pipeline mirroring configuration. Signed-off-by: Cristian Dumitrescu Signed-off-by: Yogesh Jangra --- drivers/net/softnic/rte_eth_softnic_cli.c | 96 +++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index da530614db..e1ff100c9a 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -2109,6 +2109,94 @@ cmd_softnic_pipeline_stats(struct pmd_internals *softnic, } } +/** + * pipeline mirror session port clone fast | slow + * truncate + */ +static void +cmd_softnic_pipeline_mirror_session(struct pmd_internals *softnic, + char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size) +{ + struct rte_swx_pipeline_mirroring_session_params params; + struct pipeline *p; + uint32_t session_id = 0; + int status; + + if (n_tokens != 11) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[0], "pipeline")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "pipeline"); + return; + } + + p = softnic_pipeline_find(softnic, tokens[1]); + if (!p) { + snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name"); + return; + } + + if (strcmp(tokens[2], "mirror")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "mirror"); + return; + } + + if (strcmp(tokens[3], "session")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "session"); + return; + } + + if (parser_read_uint32(&session_id, tokens[4])) { + snprintf(out, out_size, MSG_ARG_INVALID, "session_id"); + return; + } + + if (strcmp(tokens[5], "port")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "port"); + return; + } + + if (parser_read_uint32(¶ms.port_id, tokens[6])) { + snprintf(out, out_size, MSG_ARG_INVALID, "port_id"); + return; + } + + if (strcmp(tokens[7], "clone")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "clone"); + return; + } + + if (!strcmp(tokens[8], "fast")) { + params.fast_clone = 1; + } else if (!strcmp(tokens[8], "slow")) { + params.fast_clone = 0; + } else { + snprintf(out, out_size, MSG_ARG_INVALID, "clone"); + return; + } + + if (strcmp(tokens[9], "truncate")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "truncate"); + return; + } + + if (parser_read_uint32(¶ms.truncation_length, tokens[10])) { + snprintf(out, out_size, MSG_ARG_INVALID, "truncation_length"); + return; + } + + status = rte_swx_ctl_pipeline_mirroring_session_set(p->p, session_id, ¶ms); + if (status) { + snprintf(out, out_size, "Command failed!\n"); + return; + } +} + /** * thread pipeline enable [ period ] */ @@ -2387,6 +2475,14 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) cmd_softnic_pipeline_stats(softnic, tokens, n_tokens, out, out_size); return; } + + if (n_tokens >= 4 && + !strcmp(tokens[2], "mirror") && + !strcmp(tokens[3], "session")) { + cmd_softnic_pipeline_mirror_session(softnic, tokens, n_tokens, + out, out_size); + return; + } } if (strcmp(tokens[0], "thread") == 0) { -- 2.34.1