aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSergio Gonzalez Monroy <sgmonroy@gmail.com>2019-01-30 11:26:00 +0100
committerDamjan Marion <dmarion@me.com>2019-01-31 22:07:10 +0000
commit35467f112acb21fe1ea287c7d8794b0859f149c0 (patch)
tree2bfe25d2e880c417a144523ebfc84627666cbc8b /src/plugins
parent6f70e913c58b81ff40bb980359cfa1f3c88ff150 (diff)
dpdk-ipsec: use single queue pair per crypto resource
Change-Id: I2c796583087c70fbc5cf09e8afd0f2a1f389d346 Signed-off-by: Sergio Gonzalez Monroy <sgmonroy@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/ipsec/cli.c20
-rw-r--r--src/plugins/dpdk/ipsec/crypto_node.c15
-rw-r--r--src/plugins/dpdk/ipsec/esp_decrypt.c4
-rw-r--r--src/plugins/dpdk/ipsec/esp_encrypt.c4
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c11
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.h8
6 files changed, 30 insertions, 32 deletions
diff --git a/src/plugins/dpdk/ipsec/cli.c b/src/plugins/dpdk/ipsec/cli.c
index 4efa88e4bc0..b773cd2529a 100644
--- a/src/plugins/dpdk/ipsec/cli.c
+++ b/src/plugins/dpdk/ipsec/cli.c
@@ -141,9 +141,9 @@ format_crypto_worker (u8 * s, va_list * args)
{
ind = " ";
res = vec_elt_at_index (dcm->resource, res_idx[0]);
- s = format (s, "%s%-20s dev-id %2u inbound-queue %2u outbound-queue %2u\n",
+ s = format (s, "%s%-20s dev-id %2u queue-pair %2u\n",
ind, vec_elt_at_index (dcm->dev, res->dev_id)->name,
- res->dev_id, res->qp_id, res->qp_id + 1);
+ res->dev_id, res->qp_id);
ind = " ";
if (verbose)
@@ -226,12 +226,12 @@ show_dpdk_crypto_placement_v_fn (vlib_main_t * vm, unformat_input_t * input,
* @cliexstart{show dpdk crypto placement}
* vpp# show dpdk crypto placement
* Thread 1 (vpp_wk_0):
- * cryptodev_aesni_mb_p dev-id 0 inbound-queue 0 outbound-queue 1
- * cryptodev_aesni_gcm_ dev-id 1 inbound-queue 0 outbound-queue 1
+ * cryptodev_aesni_mb_p dev-id 0 queue-pair 0
+ * cryptodev_aesni_gcm_ dev-id 1 queue-pair 0
*
* Thread 2 (vpp_wk_1):
- * cryptodev_aesni_mb_p dev-id 0 inbound-queue 2 outbound-queue 3
- * cryptodev_aesni_gcm_ dev-id 1 inbound-queue 2 outbound-queue 3
+ * cryptodev_aesni_mb_p dev-id 0 queue-pair 1
+ * cryptodev_aesni_gcm_ dev-id 1 queue-pair 1
* @cliexend
?*/
/* *INDENT-OFF* */
@@ -251,18 +251,18 @@ VLIB_CLI_COMMAND (show_dpdk_crypto_placement, static) = {
* @cliexstart{show dpdk crypto placement verbose}
* vpp# show dpdk crypto placement verbose
* Thread 1 (vpp_wk_0):
- * cryptodev_aesni_mb_p dev-id 0 inbound-queue 0 outbound-queue 1
+ * cryptodev_aesni_mb_p dev-id 0 queue-pair 0
* 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_ dev-id 1 inbound-queue 0 outbound-queue 1
+ * cryptodev_aesni_gcm_ dev-id 1 queue-pair 0
* Cipher: aes-gcm-128, aes-gcm-192, aes-gcm-256
* Auth:
*
* Thread 2 (vpp_wk_1):
- * cryptodev_aesni_mb_p dev-id 0 inbound-queue 2 outbound-queue 3
+ * cryptodev_aesni_mb_p dev-id 0 queue-pair 1
* 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_ dev-id 1 inbound-queue 2 outbound-queue 3
+ * cryptodev_aesni_gcm_ dev-id 1 queue-pair 1
* Cipher: aes-gcm-128, aes-gcm-192, aes-gcm-256
* Auth:
*
diff --git a/src/plugins/dpdk/ipsec/crypto_node.c b/src/plugins/dpdk/ipsec/crypto_node.c
index 39459733402..b9ed7af5ee3 100644
--- a/src/plugins/dpdk/ipsec/crypto_node.c
+++ b/src/plugins/dpdk/ipsec/crypto_node.c
@@ -145,7 +145,7 @@ 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, u8 outbound)
+ crypto_resource_t * res)
{
u32 thread_idx = vlib_get_thread_index ();
u8 numa = rte_socket_id ();
@@ -164,14 +164,14 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node,
ops = cwm->ops;
n_ops = n_deq = rte_cryptodev_dequeue_burst (res->dev_id,
- res->qp_id + outbound,
+ res->qp_id,
ops, VLIB_FRAME_SIZE);
/* no op dequeued, do not proceed */
if (n_deq == 0)
return 0;
- res->inflights[outbound] -= n_ops;
+ res->inflights -= n_ops;
dpdk_crypto_input_trace (vm, node, ops, n_deq);
@@ -285,13 +285,10 @@ 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[0])
- n_deq += dpdk_crypto_dequeue (vm, node, res, 0);
+ if (res->inflights)
+ n_deq += dpdk_crypto_dequeue (vm, node, res);
- if (res->inflights[1])
- n_deq += dpdk_crypto_dequeue (vm, node, res, 1);
-
- if (PREDICT_FALSE (res->remove && !(res->inflights[0] || res->inflights[1])))
+ if (PREDICT_FALSE (res->remove && !(res->inflights)))
vec_add1 (remove, res_idx[0]);
}
/* *INDENT-ON* */
diff --git a/src/plugins/dpdk/ipsec/esp_decrypt.c b/src/plugins/dpdk/ipsec/esp_decrypt.c
index d8d1d385f0f..265877f3a18 100644
--- a/src/plugins/dpdk/ipsec/esp_decrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_decrypt.c
@@ -376,7 +376,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
ESP_DECRYPT_ERROR_RX_PKTS,
from_frame->n_vectors);
- crypto_enqueue_ops (vm, cwm, 0, dpdk_esp6_decrypt_node.index,
+ crypto_enqueue_ops (vm, cwm, dpdk_esp6_decrypt_node.index,
ESP_DECRYPT_ERROR_ENQ_FAIL, numa);
}
else
@@ -385,7 +385,7 @@ dpdk_esp_decrypt_inline (vlib_main_t * vm,
ESP_DECRYPT_ERROR_RX_PKTS,
from_frame->n_vectors);
- crypto_enqueue_ops (vm, cwm, 0, dpdk_esp4_decrypt_node.index,
+ crypto_enqueue_ops (vm, cwm, dpdk_esp4_decrypt_node.index,
ESP_DECRYPT_ERROR_ENQ_FAIL, numa);
}
diff --git a/src/plugins/dpdk/ipsec/esp_encrypt.c b/src/plugins/dpdk/ipsec/esp_encrypt.c
index fc12eece989..279cfea8249 100644
--- a/src/plugins/dpdk/ipsec/esp_encrypt.c
+++ b/src/plugins/dpdk/ipsec/esp_encrypt.c
@@ -548,7 +548,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm,
ESP_ENCRYPT_ERROR_RX_PKTS,
from_frame->n_vectors);
- crypto_enqueue_ops (vm, cwm, 1, dpdk_esp6_encrypt_node.index,
+ crypto_enqueue_ops (vm, cwm, dpdk_esp6_encrypt_node.index,
ESP_ENCRYPT_ERROR_ENQ_FAIL, numa);
}
else
@@ -557,7 +557,7 @@ dpdk_esp_encrypt_inline (vlib_main_t * vm,
ESP_ENCRYPT_ERROR_RX_PKTS,
from_frame->n_vectors);
- crypto_enqueue_ops (vm, cwm, 1, dpdk_esp4_encrypt_node.index,
+ crypto_enqueue_ops (vm, cwm, dpdk_esp4_encrypt_node.index,
ESP_ENCRYPT_ERROR_ENQ_FAIL, numa);
}
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index dd64f6db568..520708476a8 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -19,6 +19,7 @@
#include <vlib/node_funcs.h>
#include <dpdk/device/dpdk.h>
+#include <dpdk/buffer.h>
#include <dpdk/ipsec/ipsec.h>
dpdk_crypto_main_t dpdk_crypto_main;
@@ -705,7 +706,7 @@ crypto_scan_devs (u32 n_mains)
continue;
}
- max_res_idx = (dev->max_qp / 2) - 1;
+ max_res_idx = dev->max_qp - 1;
vec_validate (dev->free_resources, max_res_idx);
@@ -714,13 +715,13 @@ crypto_scan_devs (u32 n_mains)
(crypto_resource_t) EMPTY_STRUCT,
CLIB_CACHE_LINE_BYTES);
- for (j = 0; j <= max_res_idx; j++, res_idx++)
+ for (j = 0; j <= max_res_idx; j++)
{
- vec_elt (dev->free_resources, max_res_idx - j) = res_idx;
- res = &dcm->resource[res_idx];
+ vec_elt (dev->free_resources, max_res_idx - j) = res_idx + j;
+ res = &dcm->resource[res_idx + j];
res->dev_id = i;
res->drv_id = drv_id;
- res->qp_id = j * 2;
+ res->qp_id = j;
res->numa = dev->numa;
res->thread_idx = (u16) ~ 0;
}
diff --git a/src/plugins/dpdk/ipsec/ipsec.h b/src/plugins/dpdk/ipsec/ipsec.h
index 054fe9b0223..ac2b9b875a1 100644
--- a/src/plugins/dpdk/ipsec/ipsec.h
+++ b/src/plugins/dpdk/ipsec/ipsec.h
@@ -114,7 +114,7 @@ typedef struct
u8 dev_id;
u8 numa;
u16 qp_id;
- u16 inflights[2];
+ u16 inflights;
u16 n_ops;
u16 __unused;
struct rte_crypto_op *ops[VLIB_FRAME_SIZE];
@@ -301,7 +301,7 @@ crypto_free_ops (u8 numa, struct rte_crypto_op **ops, u32 n)
}
static_always_inline void
-crypto_enqueue_ops (vlib_main_t * vm, crypto_worker_main_t * cwm, u8 outbound,
+crypto_enqueue_ops (vlib_main_t * vm, crypto_worker_main_t * cwm,
u32 node_index, u32 error, u8 numa)
{
dpdk_crypto_main_t *dcm = &dpdk_crypto_main;
@@ -317,9 +317,9 @@ crypto_enqueue_ops (vlib_main_t * vm, crypto_worker_main_t * cwm, u8 outbound,
if (!res->n_ops)
continue;
- enq = rte_cryptodev_enqueue_burst (res->dev_id, res->qp_id + outbound,
+ enq = rte_cryptodev_enqueue_burst (res->dev_id, res->qp_id,
res->ops, res->n_ops);
- res->inflights[outbound] += enq;
+ res->inflights += enq;
if (PREDICT_FALSE (enq < res->n_ops))
{