aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2019-01-25 05:18:51 -0500
committerDave Barach <openvpp@barachs.net>2019-02-05 15:02:53 +0000
commitb8999b1070ce987dc168ac0776696cc9671132b4 (patch)
tree7c8769be21e5b69625f7c90cc64aaf00cc89521a /src/plugins/dpdk
parent623eb5676689f6874716857a1085d0efd4974c4c (diff)
crypto-input: fix broken buffer trace issue
dpdk_crypto_input_trace was called before vlib_buffer_enqueue_to_next then VLIB_FRAME_TRACE of next_frame->flag will be overwritten by vlib_next_frame_change_ownership(), leading to a broken trace. now it is working: Packet 1 00:00:15:654983: dpdk-crypto-input dev_id 0 next-index 1 00:00:15:654999: ip4-lookup fib 0 dpo-idx 0 flow hash: 0x00000000 IPSEC_ESP: 18.1.0.71 -> 18.1.0.241 tos 0x00, ttl 254, length 168, checksum 0x96ea ...... Change-Id: I73d77c06c11db8911866adb6240b2565b690f469 Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com>
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r--src/plugins/dpdk/ipsec/crypto_node.c53
1 files changed, 16 insertions, 37 deletions
diff --git a/src/plugins/dpdk/ipsec/crypto_node.c b/src/plugins/dpdk/ipsec/crypto_node.c
index b9ed7af5ee3..6b57069ed22 100644
--- a/src/plugins/dpdk/ipsec/crypto_node.c
+++ b/src/plugins/dpdk/ipsec/crypto_node.c
@@ -50,34 +50,11 @@ extern vlib_node_registration_t dpdk_crypto_input_node;
typedef struct
{
- u32 status;
+ /* dev id of this cryptodev */
+ u16 dev_id;
+ u16 next_index;
} dpdk_crypto_input_trace_t;
-#define foreach_cryptodev_status \
- _(SUCCESS, "success") \
- _(NOT_PROCESSED, "not processed") \
- _(AUTH_FAILED, "auth failed") \
- _(INVALID_SESSION, "invalid session") \
- _(INVALID_ARGS, "invalid arguments") \
- _(ERROR, "error")
-
-static u8 *
-format_cryptodev_status (u8 * s, va_list * args)
-{
- u32 status = va_arg (*args, u32);
- char *str = 0;
-
- switch (status)
- {
-#define _(x, z) case RTE_CRYPTO_OP_STATUS_##x: str = z; break;
- foreach_cryptodev_status
-#undef _
- }
- s = format (s, "%s", str);
-
- return s;
-}
-
static u8 *
format_dpdk_crypto_input_trace (u8 * s, va_list * args)
{
@@ -85,7 +62,7 @@ format_dpdk_crypto_input_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
dpdk_crypto_input_trace_t *t = va_arg (*args, dpdk_crypto_input_trace_t *);
- s = format (s, "status: %U", format_cryptodev_status, t->status);
+ s = format (s, "cryptodev-id %d next-index %d", t->dev_id, t->next_index);
return s;
}
@@ -110,9 +87,10 @@ dpdk_crypto_input_check_op (vlib_main_t * vm, vlib_node_runtime_t * node,
always_inline void
dpdk_crypto_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
- struct rte_crypto_op **ops, u32 n_deq)
+ u8 dev_id, u32 * bis, u16 * nexts, u32 n_deq)
{
u32 n_left, n_trace;
+
if (PREDICT_FALSE ((n_trace = vlib_get_trace_count (vm, node))))
{
n_left = n_deq;
@@ -120,24 +98,25 @@ dpdk_crypto_input_trace (vlib_main_t * vm, vlib_node_runtime_t * node,
while (n_trace && n_left)
{
vlib_buffer_t *b0;
- struct rte_crypto_op *op0;
u16 next;
+ u32 bi;
- op0 = ops[0];
+ bi = bis[0];
+ next = nexts[0];
- next = crypto_op_get_priv (op0)->next;
-
- b0 = vlib_buffer_from_rte_mbuf (op0->sym[0].m_src);
+ b0 = vlib_get_buffer (vm, bi);
vlib_trace_buffer (vm, node, next, b0, /* follow_chain */ 0);
dpdk_crypto_input_trace_t *tr =
vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->status = op0->status;
+ tr->dev_id = dev_id;
+ tr->next_index = next;
n_trace--;
n_left--;
- ops++;
+ nexts++;
+ bis++;
}
vlib_set_trace_count (vm, node, n_trace);
}
@@ -173,8 +152,6 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node,
res->inflights -= n_ops;
- dpdk_crypto_input_trace (vm, node, ops, n_deq);
-
while (n_ops >= 4)
{
struct rte_crypto_op *op0, *op1, *op2, *op3;
@@ -263,6 +240,8 @@ dpdk_crypto_dequeue (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_buffer_enqueue_to_next (vm, node, bis, nexts, n_deq);
+ dpdk_crypto_input_trace (vm, node, res->dev_id, bis, nexts, n_deq);
+
crypto_free_ops (numa, cwm->ops, n_deq);
return n_deq;