From 63c7e14f2e62caa1246349cfe341a93176ec4a43 Mon Sep 17 00:00:00 2001 From: Sergio Gonzalez Monroy Date: Wed, 22 Mar 2017 16:11:06 +0000 Subject: dpdk: cryptodev support enabled by default This patch slightly modifes how to enable DPDK Cryptodev. The startup option 'enable-cryptodev' has been removed and unless not enough cryptodevs are found, DPDK cryptodev will be enabled by default. Change-Id: Ic0ac507802cdc0eeb51f065e04ec43a1885617cf Signed-off-by: Sergio Gonzalez Monroy --- src/plugins/dpdk/device/dpdk.h | 1 - src/plugins/dpdk/device/init.c | 3 --- src/plugins/dpdk/ipsec/cli.c | 3 +-- src/plugins/dpdk/ipsec/dpdk_crypto_ipsec_doc.md | 18 +++++------------- src/plugins/dpdk/ipsec/ipsec.c | 10 +--------- src/plugins/dpdk/ipsec/ipsec.h | 1 + 6 files changed, 8 insertions(+), 28 deletions(-) diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 90e93e75..82e5938a 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -323,7 +323,6 @@ typedef struct u8 *uio_driver_name; u8 no_multi_seg; u8 enable_tcp_udp_checksum; - u8 cryptodev; /* Required config parameters */ u8 coremask_set_manually; diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 33ecde44..e20b2585 100755 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -995,9 +995,6 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) else if (unformat (input, "no-multi-seg")) conf->no_multi_seg = 1; - else if (unformat (input, "enable-cryptodev")) - conf->cryptodev = 1; - else if (unformat (input, "dev default %U", unformat_vlib_cli_sub_input, &sub_input)) { diff --git a/src/plugins/dpdk/ipsec/cli.c b/src/plugins/dpdk/ipsec/cli.c index 3ae8c9b8..a9314065 100644 --- a/src/plugins/dpdk/ipsec/cli.c +++ b/src/plugins/dpdk/ipsec/cli.c @@ -20,12 +20,11 @@ static void dpdk_ipsec_show_mapping (vlib_main_t * vm, u16 detail_display) { - dpdk_config_main_t *conf = &dpdk_config_main; dpdk_crypto_main_t *dcm = &dpdk_crypto_main; vlib_thread_main_t *tm = vlib_get_thread_main (); u32 i, skip_master; - if (!conf->cryptodev) + if (!dcm->enabled) { vlib_cli_output (vm, "DPDK Cryptodev support is disabled\n"); return; diff --git a/src/plugins/dpdk/ipsec/dpdk_crypto_ipsec_doc.md b/src/plugins/dpdk/ipsec/dpdk_crypto_ipsec_doc.md index b3d3cc48..5a9f9c6e 100644 --- a/src/plugins/dpdk/ipsec/dpdk_crypto_ipsec_doc.md +++ b/src/plugins/dpdk/ipsec/dpdk_crypto_ipsec_doc.md @@ -23,15 +23,7 @@ Set new default next nodes: ### How to enable VPP IPSec with DPDK Cryptodev support -DPDK Cryptodev is supported in DPDK enabled VPP. -By default, only HW Cryptodev is supported but needs to be explicetly enabled with the following config option: - -``` -dpdk { - enable-cryptodev -} -``` - +DPDK Cryptodev is supported in DPDK enabled VPP and by default only HW Cryptodev is supported. To enable SW Cryptodev support (AESNI-MB-PMD and GCM-PMD), we need the following env option: vpp_uses_dpdk_cryptodev_sw=yes @@ -47,15 +39,15 @@ When enabling SW Cryptodev support, it means that you need to pre-build the requ VPP allocates crypto resources based on a best effort approach: * first allocate Hardware crypto resources, then Software. -* if there are not enough crypto resources for all workers, the graph node is not modifed, therefore the default VPP IPsec implementation based in OpenSSL is used. The following message is displayed: +* if there are not enough crypto resources for all workers, the graph node is not modifed and the default VPP IPsec implementation based in OpenSSL is used. The following message is displayed: - 0: dpdk_ipsec_init: not enough cryptodevs for ipsec + 0: dpdk_ipsec_init: not enough Cryptodevs, default to OpenSSL IPsec ### Configuration example -To enable DPDK Cryptodev the user just need to provide the startup.conf option -as mentioned previously. +To enable DPDK Cryptodev the user just need to provide cryptodevs int the +startup.conf. Example startup.conf: diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c index 5d8f4fba..7066564d 100644 --- a/src/plugins/dpdk/ipsec/ipsec.c +++ b/src/plugins/dpdk/ipsec/ipsec.c @@ -224,7 +224,6 @@ static uword dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f) { - dpdk_config_main_t *conf = &dpdk_config_main; ipsec_main_t *im = &ipsec_main; dpdk_crypto_main_t *dcm = &dpdk_crypto_main; vlib_thread_main_t *tm = vlib_get_thread_main (); @@ -235,19 +234,12 @@ dpdk_ipsec_process (vlib_main_t * vm, vlib_node_runtime_t * rt, i32 dev_id, ret; u32 i, skip_master; - if (!conf->cryptodev) - { - clib_warning ("DPDK Cryptodev support is disabled, " - "default to OpenSSL IPsec"); - return 0; - } - if (check_cryptodev_queues () < 0) { - conf->cryptodev = 0; clib_warning ("not enough Cryptodevs, default to OpenSSL IPsec"); return 0; } + dcm->enabled = 1; vec_alloc (dcm->workers_main, tm->n_vlib_mains); _vec_len (dcm->workers_main) = tm->n_vlib_mains; diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h index f0f793c0..d7940345 100644 --- a/src/plugins/dpdk/ipsec/ipsec.h +++ b/src/plugins/dpdk/ipsec/ipsec.h @@ -83,6 +83,7 @@ typedef struct { struct rte_mempool **cop_pools; crypto_worker_main_t *workers_main; + u8 enabled; } dpdk_crypto_main_t; dpdk_crypto_main_t dpdk_crypto_main; -- cgit 1.2.3-korg