diff options
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r-- | src/plugins/dpdk/ipsec/esp_decrypt.c | 17 | ||||
-rw-r--r-- | src/plugins/dpdk/ipsec/esp_encrypt.c | 69 |
2 files changed, 43 insertions, 43 deletions
diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c index bab76e3b665..9377970a00a 100644 --- a/src/plugins/dpdk/ipsec/esp_decrypt.c +++ b/src/plugins/dpdk/ipsec/esp_decrypt.c @@ -96,15 +96,8 @@ dpdk_esp_decrypt_node_fn (vlib_main_t * vm, from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; - if (PREDICT_FALSE(!dcm->workers_main)) - { - vlib_node_increment_counter (vm, dpdk_esp_decrypt_node.index, - ESP_DECRYPT_ERROR_NO_CRYPTODEV, n_left_from); - vlib_buffer_free(vm, from, n_left_from); - return n_left_from; - } - - crypto_worker_main_t *cwm = vec_elt_at_index(dcm->workers_main, thread_index); + crypto_worker_main_t *cwm = + vec_elt_at_index(dcm->workers_main, thread_index); u32 n_qps = vec_len(cwm->qp_data); struct rte_crypto_op ** cops_to_enq[n_qps]; u32 n_cop_qp[n_qps], * bi_to_enq[n_qps]; @@ -366,6 +359,7 @@ trace: return from_frame->n_vectors; } +/* *INDENT-OFF* */ VLIB_REGISTER_NODE (dpdk_esp_decrypt_node) = { .function = dpdk_esp_decrypt_node_fn, .name = "dpdk-esp-decrypt", @@ -383,6 +377,7 @@ VLIB_REGISTER_NODE (dpdk_esp_decrypt_node) = { #undef _ }, }; +/* *INDENT-ON* */ VLIB_NODE_FUNCTION_MULTIARCH (dpdk_esp_decrypt_node, dpdk_esp_decrypt_node_fn) @@ -478,7 +473,7 @@ dpdk_esp_decrypt_post_node_fn (vlib_main_t * vm, vlib_buffer_advance (b0, sizeof (esp_header_t) + iv_size); b0->current_length -= (icv_size + 2); - b0->flags = VLIB_BUFFER_TOTAL_LENGTH_VALID; + b0->flags |= VLIB_BUFFER_TOTAL_LENGTH_VALID; f0 = (esp_footer_t *) ((u8 *) vlib_buffer_get_current (b0) + b0->current_length); b0->current_length -= f0->pad_length; @@ -573,6 +568,7 @@ trace: return from_frame->n_vectors; } +/* *INDENT-OFF* */ VLIB_REGISTER_NODE (dpdk_esp_decrypt_post_node) = { .function = dpdk_esp_decrypt_post_node_fn, .name = "dpdk-esp-decrypt-post", @@ -590,5 +586,6 @@ VLIB_REGISTER_NODE (dpdk_esp_decrypt_post_node) = { #undef _ }, }; +/* *INDENT-ON* */ VLIB_NODE_FUNCTION_MULTIARCH (dpdk_esp_decrypt_post_node, dpdk_esp_decrypt_post_node_fn) diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c index 8e948504fbe..73d9880a23a 100644 --- a/src/plugins/dpdk/ipsec/esp_encrypt.c +++ b/src/plugins/dpdk/ipsec/esp_encrypt.c @@ -101,16 +101,6 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm, from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; - if (PREDICT_FALSE (!dcm->workers_main)) - { - /* Likely there are not enough cryptodevs, so drop frame */ - vlib_node_increment_counter (vm, dpdk_esp_encrypt_node.index, - ESP_ENCRYPT_ERROR_NO_CRYPTODEV, - n_left_from); - vlib_buffer_free (vm, from, n_left_from); - return n_left_from; - } - crypto_worker_main_t *cwm = vec_elt_at_index (dcm->workers_main, thread_index); u32 n_qps = vec_len (cwm->qp_data); @@ -367,12 +357,15 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm, icb->salt = sa0->salt; icb->iv[0] = sa0->seq; icb->iv[1] = sa0->seq_hi; + icb->cnt = clib_host_to_net_u32 (1); if (sa0->crypto_alg == IPSEC_CRYPTO_ALG_AES_GCM_128) { - icb->cnt = clib_host_to_net_u32 (1); - clib_memcpy (vlib_buffer_get_current (b0) + ip_hdr_size + - sizeof (esp_header_t), icb->iv, 8); + u32 *esp_iv = + (u32 *) vlib_buffer_get_current (b0) + ip_hdr_size + + sizeof (esp_header_t); + esp_iv[0] = sa0->seq; + esp_iv[1] = sa0->seq_hi; sym_cop->cipher.data.offset = ip_hdr_size + sizeof (esp_header_t) + iv_size; sym_cop->cipher.data.length = BLOCK_SIZE * blocks; @@ -497,16 +490,22 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm, return from_frame->n_vectors; } -VLIB_REGISTER_NODE (dpdk_esp_encrypt_node) = -{ - .function = dpdk_esp_encrypt_node_fn,.name = "dpdk-esp-encrypt",.flags = - VLIB_NODE_FLAG_IS_OUTPUT,.vector_size = sizeof (u32),.format_trace = - format_esp_encrypt_trace,.n_errors = - ARRAY_LEN (esp_encrypt_error_strings),.error_strings = - esp_encrypt_error_strings,.n_next_nodes = 1,.next_nodes = - { - [ESP_ENCRYPT_NEXT_DROP] = "error-drop",} +/* *INDENT-OFF* */ +VLIB_REGISTER_NODE (dpdk_esp_encrypt_node) = { + .function = dpdk_esp_encrypt_node_fn, + .name = "dpdk-esp-encrypt", + .flags = VLIB_NODE_FLAG_IS_OUTPUT, + .vector_size = sizeof (u32), + .format_trace = format_esp_encrypt_trace, + .n_errors = ARRAY_LEN (esp_encrypt_error_strings), + .error_strings = esp_encrypt_error_strings, + .n_next_nodes = 1, + .next_nodes = + { + [ESP_ENCRYPT_NEXT_DROP] = "error-drop", + } }; +/* *INDENT-ON* */ VLIB_NODE_FUNCTION_MULTIARCH (dpdk_esp_encrypt_node, dpdk_esp_encrypt_node_fn) /* @@ -585,20 +584,24 @@ dpdk_esp_encrypt_post_node_fn (vlib_main_t * vm, return from_frame->n_vectors; } -VLIB_REGISTER_NODE (dpdk_esp_encrypt_post_node) = -{ - .function = dpdk_esp_encrypt_post_node_fn,.name = - "dpdk-esp-encrypt-post",.vector_size = sizeof (u32),.format_trace = - format_esp_encrypt_post_trace,.type = VLIB_NODE_TYPE_INTERNAL,.n_errors = - ARRAY_LEN (esp_encrypt_post_error_strings),.error_strings = - esp_encrypt_post_error_strings,.n_next_nodes = - ESP_ENCRYPT_N_NEXT,.next_nodes = - { +/* *INDENT-OFF* */ +VLIB_REGISTER_NODE (dpdk_esp_encrypt_post_node) = { + .function = dpdk_esp_encrypt_post_node_fn, + .name = "dpdk-esp-encrypt-post", + .vector_size = sizeof (u32), + .format_trace = format_esp_encrypt_post_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + .n_errors = ARRAY_LEN (esp_encrypt_post_error_strings), + .error_strings = esp_encrypt_post_error_strings, + .n_next_nodes = ESP_ENCRYPT_N_NEXT, + .next_nodes = + { #define _(s,n) [ESP_ENCRYPT_NEXT_##s] = n, - foreach_esp_encrypt_next + foreach_esp_encrypt_next #undef _ - } + } }; +/* *INDENT-ON* */ VLIB_NODE_FUNCTION_MULTIARCH (dpdk_esp_encrypt_post_node, dpdk_esp_encrypt_post_node_fn) |