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 E31A3A0556; Fri, 26 Aug 2022 15:19:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17AF442B90; Fri, 26 Aug 2022 15:18:15 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id BBFD040156 for ; Fri, 26 Aug 2022 15:18: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=1661519881; x=1693055881; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DRd8UcwHbOafRWt3Y8Tq/jluSc7qNRU7WPHtU2gkQng=; b=AXhjH4+rsOJpCivu7ziIIn2GOTC5z54zbF8DIWU9u/nZCjOyxQEPsKZZ onJb59KuzEkxJ3i756yw/IqWe9AFvKi8FAPyCyO/MhiBUFBhj9mGsNg/j 4R7mymZ8JGZR+tzywE8PPMVqbV5PRlJr8uj2ro4SUNCqSep2Y6YehSHJI VXdqf/jhh8Pgutb+d+xxNjPI8wOJwFNlOgbdEF/y1SjKRoJm4uPk5NII2 jtYhyM19DfIZ2ULSWD7x7Uk6cdu6mECg3tLgKQKetxOEXNMpDznfTpfBO M5OuGzEDzDPawozf9ItZqBleGGKg1PIp8XVUaS3Ek1SXjmCkQyGhXmYUE Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="320598586" X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="320598586" 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:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,265,1654585200"; d="scan'208";a="610561637" 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:47 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Yogesh Jangra Subject: [PATCH V2 10/21] net/softnic: add pipeline code generation CLI command Date: Fri, 26 Aug 2022 13:17:26 +0000 Message-Id: <20220826131737.1741743-11-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 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 9de17fba8f..f2c2721d55 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -180,7 +180,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, @@ -308,6 +356,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