From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F053ECAAD3 for ; Thu, 1 Sep 2022 14:23:21 +0000 (UTC) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DEA942BB6; Thu, 1 Sep 2022 16:21:23 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id D243742B6D for ; Thu, 1 Sep 2022 16:21:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662042070; x=1693578070; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a1BjULy0hJa4uUVv3Fg1yHqVl7/RMYYBVG3woNUVbdM=; b=kAOZqLGsS+rjlhbzgl5tdaAMUM7kXFIPoy2BGeA5Weo2pjGZJdhv3J1i NjO6VoZW8TUt5m/vt9eXH7EzCLPuMgrtFtrgRr+GUq9in7fwqkjjVQ8fH 2by9yY5W8n7OGzK4GH21XtbXreXTIhMWh9jZmvZWTbpZ67VJDaWm3jsLa HYw2brXiYGyVTcwqaRTRCO0AC9aw48vRJiG+PXD6MrF5/WKEnoPLinzG8 5UjliIJ2xfnQCn6ERNZhfjkGszB6AThCrMXcaIZYZVsesvfDstW6B/AgW V7MK7y0vzXnTLyCDSz/me4maNQ8FlE/1nSL1kVKBu03RlOVbzlK/WvEfH g==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="357444075" X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="357444075" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 07:20:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="680870226" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by fmsmga004.fm.intel.com with ESMTP; 01 Sep 2022 07:20:57 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Yogesh Jangra Subject: [PATCH V3 16/21] net/softnic: add pipeline commit and abort CLI commands Date: Thu, 1 Sep 2022 14:20:36 +0000 Message-Id: <20220901142041.2628537-17-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901142041.2628537-1-cristian.dumitrescu@intel.com> References: <20220804165839.1074817-1-cristian.dumitrescu@intel.com> <20220901142041.2628537-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 commands for pipeline table update commit and abort. Signed-off-by: Cristian Dumitrescu Signed-off-by: Yogesh Jangra --- 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 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 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 pipeline enable [ period ] */ @@ -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