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 B7EC3A00C4; Thu, 4 Aug 2022 19:00:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7DAFE42C2B; Thu, 4 Aug 2022 18:59:05 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id E06C342C22 for ; Thu, 4 Aug 2022 18:59:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659632342; x=1691168342; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=25zjbB88SiVm/qdBlMHvMVok0ML0sT6+kWur9YLEFJY=; b=POlRg5B7xh9J5UInnV6UBYJgFrTlAthwvAAEllx1ch+h1JwHfthgAEcE +cxDUwf1myGR6G9Ox4d+dG4jCNkZud6gaNsstPQkb4n5VKrmCv4bx5Zbi H0nbi0UsTuOzpaoQIuTkcdkwXCplP1df1d9ZGKsEZrApMO1jwlrX0IxTg JrM/eqNFYcTqxfKbhOOsydoVbchdyIjJh3r0INdbY6k6alMsIcpfk5t0y h0ZUxF2ywNVJCG7xgAc6Tnea7yPBNnR0X9CkPAW2E4gUh1VBI8DPygxpq dYNGiRWHmwQpTSnByNMkwmffSA75PWXWcyQCqNCRJ57fyWZthmLOIfwbs g==; X-IronPort-AV: E=McAfee;i="6400,9594,10429"; a="290000148" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290000148" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2022 09:59:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="636163168" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.157]) by orsmga001.jf.intel.com with ESMTP; 04 Aug 2022 09:59:00 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: jasvinder.singh@intel.com, yogesh.jangra@intel.com Subject: [PATCH 10/21] net/softnic: add pipeline code generation CLI command Date: Thu, 4 Aug 2022 16:58:28 +0000 Message-Id: <20220804165839.1074817-11-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220804165839.1074817-1-cristian.dumitrescu@intel.com> References: <20220804165839.1074817-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 code generation. Signed-off-by: Cristian Dumitrescu Signed-off-by: Yogesh Jangra --- drivers/net/softnic/rte_eth_softnic_cli.c | 57 ++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index c87a481355..f42db41996 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -182,7 +182,55 @@ cmd_swq(struct pmd_internals *softnic, } /** - * thread pipeline enable + * pipeline codegen + */ +static void +cmd_softnic_pipeline_codegen(struct pmd_internals *softnic __rte_unused, + char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size) +{ + FILE *spec_file = NULL; + FILE *code_file = NULL; + uint32_t err_line; + const char *err_msg; + int status; + + if (n_tokens != 4) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + spec_file = fopen(tokens[2], "r"); + if (!spec_file) { + snprintf(out, out_size, "Cannot open file %s.\n", tokens[2]); + return; + } + + code_file = fopen(tokens[3], "w"); + if (!code_file) { + snprintf(out, out_size, "Cannot open file %s.\n", tokens[3]); + return; + } + + status = rte_swx_pipeline_codegen(spec_file, + code_file, + &err_line, + &err_msg); + + fclose(spec_file); + fclose(code_file); + + if (status) { + snprintf(out, out_size, "Error %d at line %u: %s\n.", + status, err_line, err_msg); + return; + } +} + +/** + * thread pipeline enable [ period ] */ static void cmd_softnic_thread_pipeline_enable(struct pmd_internals *softnic, @@ -310,6 +358,13 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) return; } + if (!strcmp(tokens[0], "pipeline")) { + if ((n_tokens >= 2) && !strcmp(tokens[1], "codegen")) { + cmd_softnic_pipeline_codegen(softnic, tokens, n_tokens, out, out_size); + return; + } + } + if (strcmp(tokens[0], "thread") == 0) { if (n_tokens >= 5 && (strcmp(tokens[4], "enable") == 0)) { -- 2.34.1