From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: akhil.goyal@nxp.com, pablo.de.lara.guarch@intel.com,
fiona.trahe@intel.com
Subject: [dpdk-dev] [PATCH v5 04/12] net/softnic: use separate session mempools
Date: Thu, 10 Jan 2019 14:50:14 +0000 [thread overview]
Message-ID: <20190110145022.42883-5-roy.fan.zhang@intel.com> (raw)
In-Reply-To: <20190110145022.42883-1-roy.fan.zhang@intel.com>
This patch uses the two session mempool approach to softnic PMD.
One mempool is for session header objects, and the other is for
session private data.
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
drivers/net/softnic/rte_eth_softnic_cli.c | 52 ++++++++++++++++++++++++-
drivers/net/softnic/rte_eth_softnic_cryptodev.c | 50 +++++++++++++++++++++++-
drivers/net/softnic/rte_eth_softnic_internals.h | 3 ++
3 files changed, 102 insertions(+), 3 deletions(-)
diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..76136c2e2 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1092,7 +1092,7 @@ cmd_tap(struct pmd_internals *softnic,
/**
* cryptodev <tap_name> dev <device_name> | dev_id <device_id>
- * queue <n_queues> <queue_size>
+ * queue <n_queues> <queue_size> max_sessions <n_sessions>
**/
static void
@@ -1106,7 +1106,7 @@ cmd_cryptodev(struct pmd_internals *softnic,
char *name;
memset(¶ms, 0, sizeof(params));
- if (n_tokens != 7) {
+ if (n_tokens != 9) {
snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
return;
}
@@ -1145,6 +1145,19 @@ cmd_cryptodev(struct pmd_internals *softnic,
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;
@@ -1739,6 +1752,41 @@ 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;
diff --git a/drivers/net/softnic/rte_eth_softnic_cryptodev.c b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
index f031d8803..18a52ed05 100644
--- a/drivers/net/softnic/rte_eth_softnic_cryptodev.c
+++ b/drivers/net/softnic/rte_eth_softnic_cryptodev.c
@@ -11,6 +11,8 @@
#include "rte_eth_softnic_internals.h"
+#define SOFTNIC_CRYPTO_SESSION_CACHE_SIZE 128
+
int
softnic_cryptodev_init(struct pmd_internals *p)
{
@@ -61,13 +63,16 @@ softnic_cryptodev_create(struct pmd_internals *p,
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->queue_size == 0) ||
+ (params->session_pool_size == 0))
return NULL;
if (params->dev_name) {
@@ -83,6 +88,12 @@ softnic_cryptodev_create(struct pmd_internals *p,
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);
@@ -119,7 +130,44 @@ softnic_cryptodev_create(struct pmd_internals *p,
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:
+ if (cryptodev->mp_create)
+ rte_mempool_free(cryptodev->mp_create);
+ if (cryptodev->mp_init)
+ 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 31698b9f0..685058be6 100644
--- a/drivers/net/softnic/rte_eth_softnic_internals.h
+++ b/drivers/net/softnic/rte_eth_softnic_internals.h
@@ -286,6 +286,7 @@ struct softnic_cryptodev_params {
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 {
@@ -293,6 +294,8 @@ struct softnic_cryptodev {
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);
--
2.13.6
next prev parent reply other threads:[~2019-01-10 14:50 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 17:24 [dpdk-dev] [PATCH 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-11-15 17:24 ` [dpdk-dev] [PATCH 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-11-16 12:05 ` Ananyev, Konstantin
2018-11-19 10:12 ` Zhang, Roy Fan
2018-12-04 16:05 ` Trahe, Fiona
2018-11-15 17:24 ` [dpdk-dev] [PATCH 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-11-16 0:47 ` Ananyev, Konstantin
2018-11-16 14:32 ` Ananyev, Konstantin
2018-11-19 10:11 ` Zhang, Roy Fan
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Fan Zhang
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 1/2] cryptodev: change queue pair configure structure Fan Zhang
2018-12-17 19:31 ` Trahe, Fiona
2018-12-11 10:34 ` [dpdk-dev] [PATCH v2 2/2] cryptodev: change symmetric session structure Fan Zhang
2018-12-17 20:29 ` Trahe, Fiona
2018-12-18 16:25 ` Zhang, Roy Fan
2018-12-18 16:32 ` Trahe, Fiona
2018-12-11 12:26 ` [dpdk-dev] [PATCH v2 0/2] lib/cryptodev: change qp conf and sym session Ananyev, Konstantin
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 0/2] cryptodev: " Fan Zhang
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 1/2] cryptodev: change queue pair configure structure Fan Zhang
2019-01-08 23:20 ` De Lara Guarch, Pablo
2019-01-09 11:30 ` Zhang, Roy Fan
2019-01-09 10:41 ` De Lara Guarch, Pablo
2018-12-21 13:55 ` [dpdk-dev] [PATCH v3 2/2] cryptodev: change symmetric session structure Fan Zhang
2019-01-08 16:12 ` Trahe, Fiona
2019-01-09 11:01 ` De Lara Guarch, Pablo
2019-01-09 11:10 ` Zhang, Roy Fan
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 9:47 ` De Lara Guarch, Pablo
2019-01-10 11:24 ` De Lara Guarch, Pablo
2019-01-09 22:55 ` [dpdk-dev] [PATCH v4 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 11:22 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 04/12] net/softnic: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 05/12] examples: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 06/12] vhost/crypto: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 07/12] test/crypto: " Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 08/12] cryptodev: add sym session header size API Fan Zhang
2019-01-10 13:28 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 13:06 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 10/12] cryptodev: add user data size to symmetric session Fan Zhang
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 12:35 ` De Lara Guarch, Pablo
2019-01-09 22:56 ` [dpdk-dev] [PATCH v4 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 01/12] cryptodev: change queue pair configure structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 02/12] cryptodev: add sym session mempool create Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 03/12] app/test-crypto-perf: use separate session mempools Fan Zhang
2019-01-10 14:50 ` Fan Zhang [this message]
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 05/12] examples: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 06/12] vhost/crypto: " Fan Zhang
2019-01-11 9:13 ` Maxime Coquelin
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 07/12] test/crypto: " Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 08/12] cryptodev: add sym session header size API Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 09/12] cryptodev: update symmetric session structure Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 10/12] cryptodev: add user data size to symmetric session Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 11/12] cryptodev: add reference count to session private data Fan Zhang
2019-01-10 14:50 ` [dpdk-dev] [PATCH v5 12/12] cryptodev: add opaque data field to symmetric session Fan Zhang
2019-01-10 15:06 ` [dpdk-dev] [PATCH v5 00/12] cryptodev: change qp conf and sym session Akhil Goyal
2019-01-10 17:18 ` De Lara Guarch, Pablo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190110145022.42883-5-roy.fan.zhang@intel.com \
--to=roy.fan.zhang@intel.com \
--cc=akhil.goyal@nxp.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=pablo.de.lara.guarch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).