summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFan Zhang <roy.fan.zhang@intel.com>2019-01-10 14:50:16 +0000
committerPablo de Lara <pablo.de.lara.guarch@intel.com>2019-01-10 16:57:22 +0100
commitac5e42daca19d9484a311a2c382c6b8053367280 (patch)
tree499915e5d6b9e5be63cf52c4dd436e55647a9197 /examples
parent261bbff75e34dbbefcbf13d672b902eb0a917c5e (diff)
downloaddpdk-next-eventdev-ac5e42daca19d9484a311a2c382c6b8053367280.zip
dpdk-next-eventdev-ac5e42daca19d9484a311a2c382c6b8053367280.tar.gz
dpdk-next-eventdev-ac5e42daca19d9484a311a2c382c6b8053367280.tar.xz
vhost/crypto: use separate session mempools
This patch uses the two session mempool approach to vhost crypto. 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> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/vhost_crypto/main.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index cb30f84..8bdcb3a 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -46,6 +46,7 @@ struct vhost_crypto_info {
int vids[MAX_NB_SOCKETS];
uint32_t nb_vids;
struct rte_mempool *sess_pool;
+ struct rte_mempool *sess_priv_pool;
struct rte_mempool *cop_pool;
uint8_t cid;
uint32_t qid;
@@ -289,6 +290,7 @@ new_device(int vid)
}
ret = rte_vhost_crypto_create(vid, info->cid, info->sess_pool,
+ info->sess_priv_pool,
rte_lcore_to_socket_id(options.los[i].lcore_id));
if (ret) {
RTE_LOG(ERR, USER1, "Cannot create vhost crypto\n");
@@ -448,6 +450,7 @@ free_resource(void)
rte_mempool_free(info->cop_pool);
rte_mempool_free(info->sess_pool);
+ rte_mempool_free(info->sess_priv_pool);
for (j = 0; j < lo->nb_sockets; j++) {
rte_vhost_driver_unregister(lo->socket_files[i]);
@@ -528,11 +531,17 @@ main(int argc, char *argv[])
}
snprintf(name, 127, "SESS_POOL_%u", lo->lcore_id);
- info->sess_pool = rte_mempool_create(name, SESSION_MAP_ENTRIES,
+ info->sess_pool = rte_cryptodev_sym_session_pool_create(name,
+ SESSION_MAP_ENTRIES, 0, 0, 0,
+ rte_lcore_to_socket_id(lo->lcore_id));
+
+ snprintf(name, 127, "SESS_POOL_PRIV_%u", lo->lcore_id);
+ info->sess_priv_pool = rte_mempool_create(name,
+ SESSION_MAP_ENTRIES,
rte_cryptodev_sym_get_private_session_size(
info->cid), 64, 0, NULL, NULL, NULL, NULL,
rte_lcore_to_socket_id(lo->lcore_id), 0);
- if (!info->sess_pool) {
+ if (!info->sess_priv_pool || info->sess_pool) {
RTE_LOG(ERR, USER1, "Failed to create mempool");
goto error_exit;
}