From aa3a25c1c9534a634ca20f64cbeb287733c67d9d Mon Sep 17 00:00:00 2001 From: Sergio Gonzalez Monroy Date: Tue, 31 Oct 2017 15:55:39 +0000 Subject: dpdk/ipsec: fix digest physical address VPP-1034 Change-Id: I02b4db9e52446ab8578df1f011dd27f39de64c70 Signed-off-by: Sergio Gonzalez Monroy --- src/plugins/dpdk/ipsec/esp_decrypt.c | 7 ++++--- src/plugins/dpdk/ipsec/esp_encrypt.c | 4 +++- src/plugins/dpdk/ipsec/ipsec.h | 3 --- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c index 6de1f004347..ab98d56bbfd 100644 --- a/src/plugins/dpdk/ipsec/esp_decrypt.c +++ b/src/plugins/dpdk/ipsec/esp_decrypt.c @@ -271,8 +271,7 @@ dpdk_esp_decrypt_node_fn (vlib_main_t * vm, u32 cipher_off, cipher_len; u32 auth_len = 0, aad_size = 0; - u8 *aad = NULL, *digest = NULL; - u64 digest_paddr = 0; + u8 *aad = NULL; u8 *iv = (u8 *) (esp0 + 1); @@ -281,7 +280,9 @@ dpdk_esp_decrypt_node_fn (vlib_main_t * vm, cipher_off = sizeof (esp_header_t) + iv_size; cipher_len = payload_len; - digest = vlib_buffer_get_tail (b0) - trunc_size; + u8 *digest = vlib_buffer_get_tail (b0) - trunc_size; + u64 digest_paddr = + mb0->buf_physaddr + digest - ((u8 *) mb0->buf_addr); if (!is_aead && cipher_alg->alg == RTE_CRYPTO_CIPHER_AES_CBC) clib_memcpy(icb, iv, 16); diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c index 7d14a3a2007..ac60fdd589f 100644 --- a/src/plugins/dpdk/ipsec/esp_encrypt.c +++ b/src/plugins/dpdk/ipsec/esp_encrypt.c @@ -420,6 +420,8 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm, u32 auth_len = 0, aad_size = 0; u32 *aad = NULL; u8 *digest = vlib_buffer_get_tail (b0) - trunc_size; + u64 digest_paddr = + mb0->buf_physaddr + digest - ((u8 *) mb0->buf_addr); if (!is_aead && cipher_alg->alg == RTE_CRYPTO_CIPHER_AES_CBC) { @@ -466,7 +468,7 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm, crypto_op_setup (is_aead, mb0, op, session, cipher_off, cipher_len, (u8 *) icb, iv_size, 0, auth_len, (u8 *) aad, aad_size, - digest, 0, trunc_size); + digest, digest_paddr, trunc_size); trace: if (PREDICT_FALSE (b0->flags & VLIB_BUFFER_IS_TRACED)) diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h index 22890628ec6..2a48e4e6110 100644 --- a/src/plugins/dpdk/ipsec/ipsec.h +++ b/src/plugins/dpdk/ipsec/ipsec.h @@ -328,9 +328,6 @@ crypto_op_setup (u8 is_aead, struct rte_mbuf *mb0, sym_op->m_src = mb0; sym_op->session = session; - if (!digest_paddr) - digest_paddr = mb0->buf_physaddr + ((u8 *) digest) - ((u8 *) mb0); - #if DPDK_NO_AEAD sym_op->cipher.data.offset = cipher_off; sym_op->cipher.data.length = cipher_len; -- cgit 1.2.3-korg