aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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))
{