diff options
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r-- | src/plugins/dpdk/ipsec/cli.c | 117 | ||||
-rw-r--r-- | src/plugins/dpdk/ipsec/crypto_node.c | 37 | ||||
-rw-r--r-- | src/plugins/dpdk/ipsec/esp_decrypt.c | 2 | ||||
-rw-r--r-- | src/plugins/dpdk/ipsec/esp_encrypt.c | 2 | ||||
-rw-r--r-- | src/plugins/dpdk/ipsec/ipsec.h | 1 |
5 files changed, 115 insertions, 44 deletions
diff --git a/src/plugins/dpdk/ipsec/cli.c b/src/plugins/dpdk/ipsec/cli.c index b773cd2529a..01ef985af84 100644 --- a/src/plugins/dpdk/ipsec/cli.c +++ b/src/plugins/dpdk/ipsec/cli.c @@ -18,6 +18,24 @@ #include <dpdk/ipsec/ipsec.h> static u8 * +format_crypto_resource (u8 * s, va_list * args) +{ + dpdk_crypto_main_t *dcm = &dpdk_crypto_main; + + u32 indent = va_arg (*args, u32); + u32 res_idx = va_arg (*args, u32); + + crypto_resource_t *res = vec_elt_at_index (dcm->resource, res_idx); + + s = + format (s, "%U thr_id %3d qp %2u inflight %u\n", + format_white_space, indent, (i16) res->thread_idx, + res->qp_id, res->inflights); + + return s; +} + +static u8 * format_crypto (u8 * s, va_list * args) { dpdk_crypto_main_t *dcm = &dpdk_crypto_main; @@ -30,8 +48,6 @@ format_crypto (u8 * s, va_list * args) s = format (s, "%-25s%-20s%-10s\n", dev->name, drv->name, rte_cryptodevs[dev->id].data->dev_started ? "up" : "down"); s = format (s, " numa_node %u, max_queues %u\n", dev->numa, dev->max_qp); - s = format (s, " free_resources %u, used_resources %u\n", - vec_len (dev->free_resources), vec_len (dev->used_resources)); if (dev->features) { @@ -67,11 +83,79 @@ format_crypto (u8 * s, va_list * args) s = format (s, "%s%s", pre, dcm->auth_algs[i].name); pre = ", "; } - s = format (s, "\n\n"); + s = format (s, "\n"); + + struct rte_cryptodev_stats stats; + rte_cryptodev_stats_get (dev->id, &stats); + + s = + format (s, + " enqueue %-10lu dequeue %-10lu enqueue_err %-10lu dequeue_err %-10lu \n", + stats.enqueued_count, stats.dequeued_count, + stats.enqueue_err_count, stats.dequeue_err_count); + + u16 *res_idx; + s = format (s, " free_resources %u :", vec_len (dev->free_resources)); + + u32 indent = format_get_indent (s); + s = format (s, "\n"); + + /* *INDENT-OFF* */ + vec_foreach (res_idx, dev->free_resources) + s = format (s, "%U", format_crypto_resource, indent, res_idx[0]); + /* *INDENT-ON* */ + + s = format (s, " used_resources %u :", vec_len (dev->used_resources)); + indent = format_get_indent (s); + + s = format (s, "\n"); + + /* *INDENT-OFF* */ + vec_foreach (res_idx, dev->used_resources) + s = format (s, "%U", format_crypto_resource, indent, res_idx[0]); + /* *INDENT-ON* */ + + s = format (s, "\n"); return s; } + +static clib_error_t * +clear_crypto_stats_fn (vlib_main_t * vm, unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + dpdk_crypto_main_t *dcm = &dpdk_crypto_main; + crypto_dev_t *dev; + + /* *INDENT-OFF* */ + vec_foreach (dev, dcm->dev) + rte_cryptodev_stats_reset (dev->id); + /* *INDENT-ON* */ + + return NULL; +} + +/*? + * This command is used to clear the DPDK Crypto device statistics. + * + * @cliexpar + * Example of how to clear the DPDK Crypto device statistics: + * @cliexsart{clear dpdk crypto devices statistics} + * vpp# clear dpdk crypto devices statistics + * @cliexend + * Example of clearing the DPDK Crypto device statistic data: + * @cliexend +?*/ +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (clear_dpdk_crypto_stats, static) = { + .path = "clear dpdk crypto devices statistics", + .short_help = "clear dpdk crypto devices statistics", + .function = clear_crypto_stats_fn, +}; +/* *INDENT-ON* */ + + static clib_error_t * show_dpdk_crypto_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) @@ -94,19 +178,18 @@ show_dpdk_crypto_fn (vlib_main_t * vm, unformat_input_t * input, * Example of how to display the DPDK Crypto device information: * @cliexsart{show dpdk crypto devices} * vpp# show dpdk crypto devices - * cryptodev_aesni_mb_pmd crypto_aesni_mb down - * numa_node 1, max_queues 8 - * free_resources 2, used_resources 2 - * SYMMETRIC_CRYPTO, SYM_OPERATION_CHAINING, CPU_AVX2, CPU_AESNI - * Cipher: aes-cbc-128, aes-cbc-192, aes-cbc-256, aes-ctr-128, aes-ctr-192, aes-ctr-256 - * Auth: md5-96, sha1-96, sha-256-128, sha-384-192, sha-512-256 - * - * cryptodev_aesni_gcm_pmd crypto_aesni_gcm down - * numa_node 1, max_queues 8 - * free_resources 2, used_resources 2 - * SYMMETRIC_CRYPTO, SYM_OPERATION_CHAINING, CPU_AVX2, CPU_AESNI, MBUF_SCATTER_GATHER - * Cipher: aes-gcm-128, aes-gcm-192, aes-gcm-256 - * Auth: + * aesni_mb0 crypto_aesni_mb up + * numa_node 0, max_queues 4 + * SYMMETRIC_CRYPTO, SYM_OPERATION_CHAINING, CPU_AVX2, CPU_AESNI + * Cipher: aes-cbc-128, aes-cbc-192, aes-cbc-256, aes-ctr-128, aes-ctr-192, aes-ctr-256, aes-gcm-128, aes-gcm-192, aes-gcm-256 + * Auth: md5-96, sha1-96, sha-256-128, sha-384-192, sha-512-256 + * enqueue 2 dequeue 2 enqueue_err 0 dequeue_err 0 + * free_resources 3 : + * thr_id -1 qp 3 inflight 0 + * thr_id -1 qp 2 inflight 0 + * thr_id -1 qp 1 inflight 0 + * used_resources 1 : + * thr_id 1 qp 0 inflight 0 * @cliexend * Example of displaying the DPDK Crypto device data when enabled: * @cliexend @@ -538,7 +621,7 @@ show_dpdk_crypto_pools_fn (vlib_main_t * vm, struct rte_mempool **mp; vec_foreach (mp, data->session_drv) if (mp[0]) - vlib_cli_output (vm, "%U\n", format_dpdk_mempool, mp[0]); + vlib_cli_output (vm, "%U\n", format_dpdk_mempool, mp[0]); } /* *INDENT-ON* */ diff --git a/src/plugins/dpdk/ipsec/crypto_node.c b/src/plugins/dpdk/ipsec/crypto_node.c index 6b57069ed22..9c22e93beed 100644 --- a/src/plugins/dpdk/ipsec/crypto_node.c +++ b/src/plugins/dpdk/ipsec/crypto_node.c @@ -123,16 +123,10 @@ dpdk_crypto_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node, } static_always_inline u32 -dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node, - crypto_resource_t * res) +dpdk_crypto_dequeue (vlib_main_t * vm, crypto_worker_main_t * cwm, + vlib_node_runtime_t * node, crypto_resource_t * res) { - u32 thread_idx = vlib_get_thread_index (); u8 numa = rte_socket_id (); - - dpdk_crypto_main_t *dcm = &dpdk_crypto_main; - crypto_worker_main_t *cwm = - vec_elt_at_index (dcm->workers_main, thread_idx); - u32 n_ops, n_deq; u32 bis[VLIB_FRAME_SIZE], *bi; u16 nexts[VLIB_FRAME_SIZE], *next; @@ -155,7 +149,6 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node, while (n_ops >= 4) { struct rte_crypto_op *op0, *op1, *op2, *op3; - vlib_buffer_t *b0, *b1, *b2, *b3; /* Prefetch next iteration. */ if (n_ops >= 8) @@ -185,21 +178,16 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node, next[2] = crypto_op_get_priv (op2)->next; next[3] = crypto_op_get_priv (op3)->next; + bi[0] = crypto_op_get_priv (op0)->bi; + bi[1] = crypto_op_get_priv (op1)->bi; + bi[2] = crypto_op_get_priv (op2)->bi; + bi[3] = crypto_op_get_priv (op3)->bi; + dpdk_crypto_input_check_op (vm, node, op0, next + 0); dpdk_crypto_input_check_op (vm, node, op1, next + 1); dpdk_crypto_input_check_op (vm, node, op2, next + 2); dpdk_crypto_input_check_op (vm, node, op3, next + 3); - b0 = vlib_buffer_from_rte_mbuf (op0->sym[0].m_src); - b1 = vlib_buffer_from_rte_mbuf (op1->sym[0].m_src); - b2 = vlib_buffer_from_rte_mbuf (op2->sym[0].m_src); - b3 = vlib_buffer_from_rte_mbuf (op3->sym[0].m_src); - - bi[0] = vlib_get_buffer_index (vm, b0); - bi[1] = vlib_get_buffer_index (vm, b1); - bi[2] = vlib_get_buffer_index (vm, b2); - bi[3] = vlib_get_buffer_index (vm, b3); - op0->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; op1->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; op2->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; @@ -214,18 +202,14 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node, while (n_ops > 0) { struct rte_crypto_op *op0; - vlib_buffer_t *b0; op0 = ops[0]; next[0] = crypto_op_get_priv (op0)->next; + bi[0] = crypto_op_get_priv (op0)->bi; dpdk_crypto_input_check_op (vm, node, op0, next + 0); - /* XXX store bi0 and next0 in op0 private? */ - b0 = vlib_buffer_from_rte_mbuf (op0->sym[0].m_src); - bi[0] = vlib_get_buffer_index (vm, b0); - op0->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; /* next */ @@ -251,9 +235,8 @@ static_always_inline uword dpdk_crypto_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { - u32 thread_index = vlib_get_thread_index (); dpdk_crypto_main_t *dcm = &dpdk_crypto_main; - crypto_worker_main_t *cwm = &dcm->workers_main[thread_index]; + crypto_worker_main_t *cwm = &dcm->workers_main[vm->thread_index]; crypto_resource_t *res; u32 n_deq = 0; u16 *remove = NULL, *res_idx; @@ -265,7 +248,7 @@ dpdk_crypto_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, res = vec_elt_at_index (dcm->resource, res_idx[0]); if (res->inflights) - n_deq += dpdk_crypto_dequeue (vm, node, res); + n_deq += dpdk_crypto_dequeue (vm, cwm, node, res); if (PREDICT_FALSE (res->remove && !(res->inflights))) vec_add1 (remove, res_idx[0]); diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c index 265877f3a18..cd35ee7576e 100644 --- a/src/plugins/dpdk/ipsec/esp_decrypt.c +++ b/src/plugins/dpdk/ipsec/esp_decrypt.c @@ -165,6 +165,8 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm, ASSERT (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED); dpdk_op_priv_t *priv = crypto_op_get_priv (op); + /* store bi in op private */ + priv->bi = bi0; u16 op_len = sizeof (op[0]) + sizeof (op[0].sym[0]) + sizeof (priv[0]); diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c index 279cfea8249..eea99eb8694 100644 --- a/src/plugins/dpdk/ipsec/esp_encrypt.c +++ b/src/plugins/dpdk/ipsec/esp_encrypt.c @@ -192,6 +192,8 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm, ASSERT (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED); dpdk_op_priv_t *priv = crypto_op_get_priv (op); + /* store bi in op private */ + priv->bi = bi0; u16 op_len = sizeof (op[0]) + sizeof (op[0].sym[0]) + sizeof (priv[0]); diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h index ac2b9b875a1..4866142630b 100644 --- a/src/plugins/dpdk/ipsec/ipsec.h +++ b/src/plugins/dpdk/ipsec/ipsec.h @@ -58,6 +58,7 @@ typedef struct typedef struct { u32 next; + u32 bi; dpdk_gcm_cnt_blk cb __attribute__ ((aligned (16))); u8 aad[16]; u8 icv[32]; |