summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/ipsec
diff options
context:
space:
mode:
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>2017-10-18 14:44:24 +0100
committerDamjan Marion <dmarion.lists@gmail.com>2017-10-19 12:35:25 +0000
commitc47652c50bd1dcf7492d5e991d99be284a0683fd (patch)
treed0ec28db919605ea01f644f21a09117b1c248f19 /src/plugins/dpdk/ipsec
parentfb353ce54efc3abf3c2ba7795d0c9bf7aed6df96 (diff)
dpdk/ipsec: fix digest physical address
VPP-1034 Change-Id: Ib13cf0395bc2e42d24de51347e0aeed8a137f2f2 Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Diffstat (limited to 'src/plugins/dpdk/ipsec')
-rw-r--r--src/plugins/dpdk/ipsec/esp.h4
-rw-r--r--src/plugins/dpdk/ipsec/esp_decrypt.c4
-rw-r--r--src/plugins/dpdk/ipsec/esp_encrypt.c16
3 files changed, 10 insertions, 14 deletions
diff --git a/src/plugins/dpdk/ipsec/esp.h b/src/plugins/dpdk/ipsec/esp.h
index 5b5c81aef47..51224d6c1a1 100644
--- a/src/plugins/dpdk/ipsec/esp.h
+++ b/src/plugins/dpdk/ipsec/esp.h
@@ -334,10 +334,6 @@ crypto_op_setup (u8 is_aead, struct rte_mbuf *mb0,
sym_cop->m_src = mb0;
rte_crypto_op_attach_sym_session (cop, session);
- if (!digest_paddr)
- digest_paddr =
- rte_pktmbuf_mtophys_offset (mb0, (uintptr_t) digest - (uintptr_t) mb0);
-
#if DPDK_NO_AEAD
sym_cop->cipher.data.offset = cipher_off;
sym_cop->cipher.data.length = cipher_len;
diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c
index c4f295d393c..20936b36f94 100644
--- a/src/plugins/dpdk/ipsec/esp_decrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_decrypt.c
@@ -236,7 +236,7 @@ dpdk_esp_decrypt_node_fn (vlib_main_t * vm,
u32 cipher_off, cipher_len;
u32 auth_off = 0, auth_len = 0, aad_size = 0;
u8 *aad = NULL, *digest = NULL;
- u64 digest_paddr = 0;
+ u64 digest_paddr;
u8 *iv = rte_pktmbuf_mtod_offset(mb0, void*, sizeof (esp_header_t));
dpdk_cop_priv_t *priv = (dpdk_cop_priv_t *)(sym_cop + 1);
@@ -249,6 +249,8 @@ dpdk_esp_decrypt_node_fn (vlib_main_t * vm,
vlib_buffer_get_current (b0) + sizeof(esp_header_t) +
iv_size + payload_len;
+ digest_paddr = mb0->buf_physaddr + (digest - (u8 *) mb0->buf_addr);
+
if (is_aead)
{
u32 *_iv = (u32 *) iv;
diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c
index 6de444fd3bc..b4e29e918ae 100644
--- a/src/plugins/dpdk/ipsec/esp_encrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_encrypt.c
@@ -358,6 +358,12 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm,
u32 cipher_off, cipher_len;
u32 auth_off = 0, auth_len = 0, aad_size = 0;
u8 *aad = NULL, *digest = NULL;
+ u64 digest_paddr;
+
+ digest =
+ vlib_buffer_get_current (b0) + b0->current_length - trunc_size;
+
+ digest_paddr = mb0->buf_physaddr + (digest - (u8 *) mb0->buf_addr);
if (is_aead)
{
@@ -380,10 +386,6 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm,
*((u32 *) & aad[8]) = sa0->seq_hi;
aad_size = 12;
}
-
- digest =
- vlib_buffer_get_current (b0) + b0->current_length -
- trunc_size;
}
else
{
@@ -393,10 +395,6 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm,
auth_off = ip_hdr_size;
auth_len = b0->current_length - ip_hdr_size - trunc_size;
- digest =
- vlib_buffer_get_current (b0) + b0->current_length -
- trunc_size;
-
if (PREDICT_FALSE (sa0->use_esn))
{
*((u32 *) digest) = sa0->seq_hi;
@@ -407,7 +405,7 @@ dpdk_esp_encrypt_node_fn (vlib_main_t * vm,
crypto_op_setup (is_aead, mb0, cop, sess,
cipher_off, cipher_len, (u8 *) icb, iv_size,
auth_off, auth_len, aad, aad_size,
- digest, 0, trunc_size);
+ digest, digest_paddr, trunc_size);
if (PREDICT_FALSE (is_ipv6))
{