From patchwork Wed Jan 11 20:56:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 121848 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16B05423AF; Wed, 11 Jan 2023 21:56:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5570042D4A; Wed, 11 Jan 2023 21:56:21 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 9EB5240A7D for ; Wed, 11 Jan 2023 21:56:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673470577; x=1705006577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+H3MltcnZ8fzvy/BpEhkr8JhVDasw344mTX0ievIsL8=; b=RrX5U1RqKDnEq7LA6nUCpjOmQUaXQS4qs8s1KBgcwQytw9dIZ3w4s66v IYlebxkHY0UNKILK6GF41OkVDtJ+cb9WrUxcz8i0np9AA2o4nbn5w7PXm WQDiVpR28ZhVFr9MDpc0lplH6c0VmDdFndf1Gm/U5dR4q/GWAIfwy9vgb sYdjLMr27M8XL/YUAVhlbKi54PNCcqKE+wMrQA4ZLwUEvZ0JIKsMxZtHl fBlRjQiV1+b35PL/UI2SpR/fKC+ARM1aNHpq+Z5HV3X+BJwIh9EYsY/L0 1qQ6yzW/sDICRqIztr7Km2mIewOM1+hPJ+5B/YIFHeKHeRuVFhQcCdYpw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="303229785" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="303229785" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 12:56:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="607518870" X-IronPort-AV: E=Sophos;i="5.96,317,1665471600"; d="scan'208";a="607518870" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.222.53]) by orsmga003.jf.intel.com with ESMTP; 11 Jan 2023 12:56:16 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Kamalakannan R Subject: [PATCH 06/11] examples/pipeline: add CLI command for crypto device Date: Wed, 11 Jan 2023 20:56:03 +0000 Message-Id: <20230111205608.87953-7-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230111205608.87953-1-cristian.dumitrescu@intel.com> References: <20230111205608.87953-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 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 the configuration of crypto devices. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R --- examples/pipeline/cli.c | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 37fc6f9551..47c1adf772 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -521,6 +521,58 @@ cmd_ring(char **tokens, } } +static const char cmd_cryptodev_help[] = +"cryptodev queues qsize \n"; + +static void +cmd_cryptodev(char **tokens, + uint32_t n_tokens, + char *out, + size_t out_size, + void *obj __rte_unused) +{ + struct cryptodev_params params; + char *cryptodev_name; + int status; + + if (n_tokens != 6) { + snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); + return; + } + + if (strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "cryptodev"); + return; + } + + cryptodev_name = tokens[1]; + + if (strcmp(tokens[2], "queues")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "queues"); + return; + } + + if (parser_read_uint32(¶ms.n_queue_pairs, tokens[3])) { + snprintf(out, out_size, MSG_ARG_INVALID, "n_queue_pairs"); + return; + } + + if (strcmp(tokens[4], "qsize")) { + snprintf(out, out_size, MSG_ARG_NOT_FOUND, "qsize"); + return; + } + + + if (parser_read_uint32(¶ms.queue_size, tokens[5])) { + snprintf(out, out_size, MSG_ARG_INVALID, "queue_size"); + return; + } + + status = cryptodev_config(cryptodev_name, ¶ms); + if (status) + snprintf(out, out_size, "Crypto device configuration failed (%d).\n", status); +} + static const char cmd_pipeline_codegen_help[] = "pipeline codegen \n"; @@ -2990,6 +3042,7 @@ cmd_help(char **tokens, "\tethdev\n" "\tethdev show\n" "\tring\n" + "\tcryptodev\n" "\tpipeline codegen\n" "\tpipeline libbuild\n" "\tpipeline build\n" @@ -3041,6 +3094,11 @@ cmd_help(char **tokens, return; } + if (!strcmp(tokens[0], "cryptodev")) { + snprintf(out, out_size, "\n%s\n", cmd_cryptodev_help); + return; + } + if ((strcmp(tokens[0], "pipeline") == 0) && (n_tokens == 2) && (strcmp(tokens[1], "codegen") == 0)) { snprintf(out, out_size, "\n%s\n", cmd_pipeline_codegen_help); @@ -3296,6 +3354,11 @@ cli_process(char *in, char *out, size_t out_size, void *obj) return; } + if (!strcmp(tokens[0], "cryptodev")) { + cmd_cryptodev(tokens, n_tokens, out, out_size, obj); + return; + } + if (strcmp(tokens[0], "pipeline") == 0) { if ((n_tokens >= 3) && (strcmp(tokens[1], "codegen") == 0)) {