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 8D706A00C4; Thu, 4 Aug 2022 18:59:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C71AE42C09; Thu, 4 Aug 2022 18:58:58 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 1945B42BE8 for ; Thu, 4 Aug 2022 18:58:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659632334; x=1691168334; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HvyFX9xalBofYK7SjFBXjTpxxHepbB7sYFI/oC0GSMU=; b=c9SsVJ3fHGzQQAIVBWV8ikWHpzQvwupE1eT7BYGullEpZkexvs48zr77 4m/YoWIiPI0R3IUFF793/Y4xroZfNoUrVq6we4O+OkeU4BcRce4+KcUT4 XE8MWDFGn6kW09DR3j780Eb6yiUPPruRyGaRPNbL6R5ls75VfowrwLeDj IhD4xNwroLOqtDo0sXJYU5/9EOimPlpz6l6ZygLVqV6h+YmXLQnXIXoYA +4y1Vg5G6cXgSZGd73TYFz8PJM6Jq1glbIwMXeqfsm3pY7Nj+yX+rC0dY AIGBiQi2/uGPdFL0MDhYQXn2iO52EWPc8z3C4p8Bo2Ke6JD+8Uv5c43jA Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10429"; a="290000097" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290000097" 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:58:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="636163110" 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:58:48 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: jasvinder.singh@intel.com, yogesh.jangra@intel.com Subject: [PATCH 04/21] net/softnic: remove cryptodev support Date: Thu, 4 Aug 2022 16:58:22 +0000 Message-Id: <20220804165839.1074817-5-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 Remove the cryptographic device API support. Signed-off-by: Cristian Dumitrescu Signed-off-by: Yogesh Jangra --- drivers/net/softnic/meson.build | 3 +- drivers/net/softnic/rte_eth_softnic.c | 1 - drivers/net/softnic/rte_eth_softnic_cli.c | 171 ------------------ .../net/softnic/rte_eth_softnic_cryptodev.c | 168 ----------------- .../net/softnic/rte_eth_softnic_internals.h | 54 ------ .../net/softnic/rte_eth_softnic_pipeline.c | 54 ------ 6 files changed, 1 insertion(+), 450 deletions(-) delete mode 100644 drivers/net/softnic/rte_eth_softnic_cryptodev.c diff --git a/drivers/net/softnic/meson.build b/drivers/net/softnic/meson.build index d466dc7700..b3d235841d 100644 --- a/drivers/net/softnic/meson.build +++ b/drivers/net/softnic/meson.build @@ -12,7 +12,6 @@ sources = files( 'rte_eth_softnic.c', 'rte_eth_softnic_action.c', 'rte_eth_softnic_cli.c', - 'rte_eth_softnic_cryptodev.c', 'rte_eth_softnic_link.c', 'rte_eth_softnic_mempool.c', 'rte_eth_softnic_pipeline.c', @@ -20,4 +19,4 @@ sources = files( 'rte_eth_softnic_tap.c', 'rte_eth_softnic_thread.c', ) -deps += ['pipeline', 'port', 'table', 'cryptodev'] +deps += ['pipeline', 'port', 'table'] diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index a7136bb0c0..1ea5989223 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -264,7 +264,6 @@ pmd_init(struct pmd_params *params) softnic_swq_init(p); softnic_link_init(p); softnic_tap_init(p); - softnic_cryptodev_init(p); softnic_port_in_action_profile_init(p); softnic_table_action_profile_init(p); softnic_pipeline_init(p); diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 671f96cf77..bca0b176d6 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -213,80 +213,6 @@ cmd_tap(struct pmd_internals *softnic, } } -/** - * cryptodev dev | dev_id - * queue max_sessions - **/ - -static void -cmd_cryptodev(struct pmd_internals *softnic, - char **tokens, - uint32_t n_tokens, - char *out, - size_t out_size) -{ - struct softnic_cryptodev_params params; - char *name; - - memset(¶ms, 0, sizeof(params)); - if (n_tokens != 9) { - snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); - return; - } - - name = tokens[1]; - - if (strcmp(tokens[2], "dev") == 0) - params.dev_name = tokens[3]; - else if (strcmp(tokens[2], "dev_id") == 0) { - if (softnic_parser_read_uint32(¶ms.dev_id, tokens[3]) < 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "dev_id"); - return; - } - } else { - snprintf(out, out_size, MSG_ARG_INVALID, - "cryptodev"); - return; - } - - if (strcmp(tokens[4], "queue")) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, - "4"); - return; - } - - if (softnic_parser_read_uint32(¶ms.n_queues, tokens[5]) < 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "q"); - return; - } - - if (softnic_parser_read_uint32(¶ms.queue_size, tokens[6]) < 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "queue_size"); - return; - } - - if (strcmp(tokens[7], "max_sessions")) { - snprintf(out, out_size, MSG_ARG_NOT_FOUND, - "4"); - return; - } - - if (softnic_parser_read_uint32(¶ms.session_pool_size, tokens[8]) - < 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "q"); - return; - } - - if (softnic_cryptodev_create(softnic, name, ¶ms) == NULL) { - snprintf(out, out_size, MSG_CMD_FAIL, tokens[0]); - return; - } -} - /** * port in action profile * [filter match | mismatch offset mask key port ] @@ -879,41 +805,6 @@ cmd_table_action_profile(struct pmd_internals *softnic, t0 += 1; } /* decap */ - if (t0 < n_tokens && (strcmp(tokens[t0], "sym_crypto") == 0)) { - struct softnic_cryptodev *cryptodev; - - if (n_tokens < t0 + 5 || - strcmp(tokens[t0 + 1], "dev") || - strcmp(tokens[t0 + 3], "offset")) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "table action profile sym_crypto"); - return; - } - - cryptodev = softnic_cryptodev_find(softnic, tokens[t0 + 2]); - if (cryptodev == NULL) { - snprintf(out, out_size, MSG_ARG_INVALID, - "table action profile sym_crypto"); - return; - } - - p.sym_crypto.cryptodev_id = cryptodev->dev_id; - - if (softnic_parser_read_uint32(&p.sym_crypto.op_offset, - tokens[t0 + 4]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "table action profile sym_crypto"); - return; - } - - p.sym_crypto.mp_create = cryptodev->mp_create; - p.sym_crypto.mp_init = cryptodev->mp_init; - - p.action_mask |= 1LLU << RTE_TABLE_ACTION_SYM_CRYPTO; - - t0 += 5; - } /* sym_crypto */ - if (t0 < n_tokens) { snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); return; @@ -985,7 +876,6 @@ cmd_pipeline(struct pmd_internals *softnic, * | swq * | tap mempool mtu * | source mempool file bpp - * | cryptodev rxq * [action ] * [disabled] */ @@ -1138,27 +1028,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, } t0 += 7; - } else if (strcmp(tokens[t0], "cryptodev") == 0) { - if (n_tokens < t0 + 3) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port in cryptodev"); - return; - } - - p.type = PORT_IN_CRYPTODEV; - - strlcpy(p.dev_name, tokens[t0 + 1], sizeof(p.dev_name)); - if (softnic_parser_read_uint16(&p.rxq.queue_id, - tokens[t0 + 3]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, - "rxq"); - return; - } - - p.cryptodev.arg_callback = NULL; - p.cryptodev.f_callback = NULL; - - t0 += 4; } else { snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]); return; @@ -1207,7 +1076,6 @@ cmd_pipeline_port_in(struct pmd_internals *softnic, * | swq * | tap * | sink [file pkts ] - * | cryptodev txq offset */ static void cmd_pipeline_port_out(struct pmd_internals *softnic, @@ -1322,40 +1190,6 @@ cmd_pipeline_port_out(struct pmd_internals *softnic, return; } } - } else if (strcmp(tokens[6], "cryptodev") == 0) { - if (n_tokens != 12) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port out cryptodev"); - return; - } - - p.type = PORT_OUT_CRYPTODEV; - - strlcpy(p.dev_name, tokens[7], sizeof(p.dev_name)); - - if (strcmp(tokens[8], "txq")) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port out cryptodev"); - return; - } - - if (softnic_parser_read_uint16(&p.cryptodev.queue_id, tokens[9]) - != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "queue_id"); - return; - } - - if (strcmp(tokens[10], "offset")) { - snprintf(out, out_size, MSG_ARG_MISMATCH, - "pipeline port out cryptodev"); - return; - } - - if (softnic_parser_read_uint32(&p.cryptodev.op_offset, - tokens[11]) != 0) { - snprintf(out, out_size, MSG_ARG_INVALID, "queue_id"); - return; - } } else { snprintf(out, out_size, MSG_ARG_INVALID, tokens[0]); return; @@ -4771,11 +4605,6 @@ softnic_cli_process(char *in, char *out, size_t out_size, void *arg) return; } - if (strcmp(tokens[0], "cryptodev") == 0) { - cmd_cryptodev(softnic, tokens, n_tokens, out, out_size); - return; - } - if (strcmp(tokens[0], "port") == 0) { cmd_port_in_action_profile(softnic, tokens, n_tokens, out, out_size); return; diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c deleted file mode 100644 index e4754055e9..0000000000 --- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c +++ /dev/null @@ -1,168 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2018 Intel Corporation - */ - -#include -#include - -#include -#include -#include - -#include "rte_eth_softnic_internals.h" - -#define SOFTNIC_CRYPTO_SESSION_CACHE_SIZE 128 - -int -softnic_cryptodev_init(struct pmd_internals *p) -{ - TAILQ_INIT(&p->cryptodev_list); - - return 0; -} - -void -softnic_cryptodev_free(struct pmd_internals *p) -{ - for ( ; ; ) { - struct softnic_cryptodev *cryptodev; - - cryptodev = TAILQ_FIRST(&p->cryptodev_list); - if (cryptodev == NULL) - break; - - TAILQ_REMOVE(&p->cryptodev_list, cryptodev, node); - free(cryptodev); - } -} - -struct softnic_cryptodev * -softnic_cryptodev_find(struct pmd_internals *p, - const char *name) -{ - struct softnic_cryptodev *cryptodev; - - if (name == NULL) - return NULL; - - TAILQ_FOREACH(cryptodev, &p->cryptodev_list, node) - if (strcmp(cryptodev->name, name) == 0) - return cryptodev; - - return NULL; -} - -struct softnic_cryptodev * -softnic_cryptodev_create(struct pmd_internals *p, - const char *name, - struct softnic_cryptodev_params *params) -{ - struct rte_cryptodev_info dev_info; - struct rte_cryptodev_config dev_conf; - struct rte_cryptodev_qp_conf queue_conf; - struct softnic_cryptodev *cryptodev; - uint32_t dev_id, i; - uint32_t socket_id; - uint32_t cache_size; - char mp_name[NAME_SIZE]; - int status; - - /* Check input params */ - if ((name == NULL) || - softnic_cryptodev_find(p, name) || - (params->n_queues == 0) || - (params->queue_size == 0) || - (params->session_pool_size == 0)) - return NULL; - - if (params->dev_name) { - status = rte_cryptodev_get_dev_id(params->dev_name); - if (status == -1) - return NULL; - - dev_id = (uint32_t)status; - } else { - if (rte_cryptodev_is_valid_dev(params->dev_id) == 0) - return NULL; - - dev_id = params->dev_id; - } - - cache_size = (params->session_pool_size / 2 < - SOFTNIC_CRYPTO_SESSION_CACHE_SIZE) ? - (params->session_pool_size / 2) : - SOFTNIC_CRYPTO_SESSION_CACHE_SIZE; - - socket_id = rte_cryptodev_socket_id(dev_id); - rte_cryptodev_info_get(dev_id, &dev_info); - - if (dev_info.max_nb_queue_pairs < params->n_queues) - return NULL; - if (dev_info.feature_flags & RTE_CRYPTODEV_FF_HW_ACCELERATED) - return NULL; - - dev_conf.socket_id = socket_id; - dev_conf.nb_queue_pairs = params->n_queues; - - status = rte_cryptodev_configure(dev_id, &dev_conf); - if (status < 0) - return NULL; - - queue_conf.nb_descriptors = params->queue_size; - for (i = 0; i < params->n_queues; i++) { - status = rte_cryptodev_queue_pair_setup(dev_id, i, - &queue_conf, socket_id); - if (status < 0) - return NULL; - } - - if (rte_cryptodev_start(dev_id) < 0) - return NULL; - - cryptodev = calloc(1, sizeof(struct softnic_cryptodev)); - if (cryptodev == NULL) { - rte_cryptodev_stop(dev_id); - return NULL; - } - - strlcpy(cryptodev->name, name, sizeof(cryptodev->name)); - cryptodev->dev_id = dev_id; - cryptodev->n_queues = params->n_queues; - - snprintf(mp_name, NAME_SIZE, "%s_mp%u", name, dev_id); - cryptodev->mp_create = rte_cryptodev_sym_session_pool_create(mp_name, - params->session_pool_size, - 0, - cache_size, - 0, - socket_id); - if (!cryptodev->mp_create) - goto error_exit; - - snprintf(mp_name, NAME_SIZE, "%s_priv_mp%u", name, dev_id); - cryptodev->mp_init = rte_mempool_create(mp_name, - params->session_pool_size, - rte_cryptodev_sym_get_private_session_size(dev_id), - cache_size, - 0, - NULL, - NULL, - NULL, - NULL, - socket_id, - 0); - if (!cryptodev->mp_init) - goto error_exit; - - TAILQ_INSERT_TAIL(&p->cryptodev_list, cryptodev, node); - - return cryptodev; - -error_exit: - rte_mempool_free(cryptodev->mp_create); - rte_mempool_free(cryptodev->mp_init); - - free(cryptodev); - - return NULL; -} diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h index d578cb1f25..ddcde99b98 100644 --- a/drivers/net/softnic/rte_eth_softnic_internals.h +++ b/drivers/net/softnic/rte_eth_softnic_internals.h @@ -100,28 +100,6 @@ struct softnic_tap { TAILQ_HEAD(softnic_tap_list, softnic_tap); -/** - * Cryptodev - */ -struct softnic_cryptodev_params { - const char *dev_name; - uint32_t dev_id; /**< Valid only when *dev_name* is NULL. */ - uint32_t n_queues; - uint32_t queue_size; - uint32_t session_pool_size; -}; - -struct softnic_cryptodev { - TAILQ_ENTRY(softnic_cryptodev) node; - char name[NAME_SIZE]; - uint16_t dev_id; - uint32_t n_queues; - struct rte_mempool *mp_create; - struct rte_mempool *mp_init; -}; - -TAILQ_HEAD(softnic_cryptodev_list, softnic_cryptodev); - /** * Input port action */ @@ -187,7 +165,6 @@ enum softnic_port_in_type { PORT_IN_SWQ, PORT_IN_TAP, PORT_IN_SOURCE, - PORT_IN_CRYPTODEV, }; struct softnic_port_in_params { @@ -209,12 +186,6 @@ struct softnic_port_in_params { const char *file_name; uint32_t n_bytes_per_pkt; } source; - - struct { - uint16_t queue_id; - void *f_callback; - void *arg_callback; - } cryptodev; }; uint32_t burst_size; @@ -227,7 +198,6 @@ enum softnic_port_out_type { PORT_OUT_SWQ, PORT_OUT_TAP, PORT_OUT_SINK, - PORT_OUT_CRYPTODEV, }; struct softnic_port_out_params { @@ -242,11 +212,6 @@ struct softnic_port_out_params { const char *file_name; uint32_t max_n_pkts; } sink; - - struct { - uint16_t queue_id; - uint32_t op_offset; - } cryptodev; }; uint32_t burst_size; int retry; @@ -421,7 +386,6 @@ struct pmd_internals { struct softnic_swq_list swq_list; struct softnic_link_list link_list; struct softnic_tap_list tap_list; - struct softnic_cryptodev_list cryptodev_list; struct softnic_port_in_action_profile_list port_in_action_profile_list; struct softnic_table_action_profile_list table_action_profile_list; struct pipeline_list pipeline_list; @@ -519,24 +483,6 @@ struct softnic_tap * softnic_tap_create(struct pmd_internals *p, const char *name); -/** - * Sym Crypto - */ -int -softnic_cryptodev_init(struct pmd_internals *p); - -void -softnic_cryptodev_free(struct pmd_internals *p); - -struct softnic_cryptodev * -softnic_cryptodev_find(struct pmd_internals *p, - const char *name); - -struct softnic_cryptodev * -softnic_cryptodev_create(struct pmd_internals *p, - const char *name, - struct softnic_cryptodev_params *params); - /** * Input port action */ diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 2cf7fa52d1..51a1ea73c0 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -227,7 +227,6 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic, struct rte_port_sched_reader_params sched; struct rte_port_fd_reader_params fd; struct rte_port_source_params source; - struct rte_port_sym_crypto_reader_params cryptodev; } pp; struct pipeline *pipeline; @@ -330,23 +329,6 @@ softnic_pipeline_port_in_create(struct pmd_internals *softnic, break; } - case PORT_IN_CRYPTODEV: - { - struct softnic_cryptodev *cryptodev; - - cryptodev = softnic_cryptodev_find(softnic, params->dev_name); - if (cryptodev == NULL) - return -1; - - pp.cryptodev.cryptodev_id = cryptodev->dev_id; - pp.cryptodev.queue_id = params->cryptodev.queue_id; - pp.cryptodev.f_callback = params->cryptodev.f_callback; - pp.cryptodev.arg_callback = params->cryptodev.arg_callback; - p.ops = &rte_port_sym_crypto_reader_ops; - p.arg_create = &pp.cryptodev; - break; - } - default: return -1; } @@ -433,14 +415,12 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic, struct rte_port_sched_writer_params sched; struct rte_port_fd_writer_params fd; struct rte_port_sink_params sink; - struct rte_port_sym_crypto_writer_params cryptodev; } pp; union { struct rte_port_ethdev_writer_nodrop_params ethdev; struct rte_port_ring_writer_nodrop_params ring; struct rte_port_fd_writer_nodrop_params fd; - struct rte_port_sym_crypto_writer_nodrop_params cryptodev; } pp_nodrop; struct pipeline *pipeline; @@ -554,40 +534,6 @@ softnic_pipeline_port_out_create(struct pmd_internals *softnic, break; } - case PORT_OUT_CRYPTODEV: - { - struct softnic_cryptodev *cryptodev; - - cryptodev = softnic_cryptodev_find(softnic, params->dev_name); - if (cryptodev == NULL) - return -1; - - if (params->cryptodev.queue_id >= cryptodev->n_queues) - return -1; - - pp.cryptodev.cryptodev_id = cryptodev->dev_id; - pp.cryptodev.queue_id = params->cryptodev.queue_id; - pp.cryptodev.tx_burst_sz = params->burst_size; - pp.cryptodev.crypto_op_offset = params->cryptodev.op_offset; - - pp_nodrop.cryptodev.cryptodev_id = cryptodev->dev_id; - pp_nodrop.cryptodev.queue_id = params->cryptodev.queue_id; - pp_nodrop.cryptodev.tx_burst_sz = params->burst_size; - pp_nodrop.cryptodev.n_retries = params->retry; - pp_nodrop.cryptodev.crypto_op_offset = - params->cryptodev.op_offset; - - if (params->retry == 0) { - p.ops = &rte_port_sym_crypto_writer_ops; - p.arg_create = &pp.cryptodev; - } else { - p.ops = &rte_port_sym_crypto_writer_nodrop_ops; - p.arg_create = &pp_nodrop.cryptodev; - } - - break; - } - default: return -1; } -- 2.34.1