aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Sliwa <szs@semihalf.com>2018-02-19 11:56:25 +0100
committerSzymon Sliwa <szs@semihalf.com>2018-02-19 17:47:48 +0100
commitbd514bb6b1ddee47d76cb69cad2622e81926a50c (patch)
tree0a9e8488e8d62664376e30daa72ab37cac732f7b
parentf07c57b36821e8fa508e8de409bc5c2c912b71b5 (diff)
plugins: odp: ipsec: add error check
Add a check if crypto operation was successful Change-Id: Iaa7c4df89aab309a4c85300240d245b4cdb30533 Signed-off-by: Szymon Sliwa <szs@semihalf.com>
-rw-r--r--src/plugins/odp/ipsec/crypto_input.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/plugins/odp/ipsec/crypto_input.c b/src/plugins/odp/ipsec/crypto_input.c
index 12855f7..0b0fba3 100644
--- a/src/plugins/odp/ipsec/crypto_input.c
+++ b/src/plugins/odp/ipsec/crypto_input.c
@@ -21,7 +21,8 @@ typedef enum
} odp_crypto_input_next_t;
#define foreach_crypto_input_error \
-_(DEQUE_COP, "Dequed crypto operations")
+_(DEQUE_COP, "Dequed crypto operations") \
+_(CRYPTO_ERROR, "Error while performing crypto")
typedef enum
{
@@ -77,16 +78,28 @@ odp_dequeue_cops (vlib_main_t * vm, vlib_node_runtime_t * node,
{
odp_event_t event = events[index++];
- ASSERT (ODP_EVENT_CRYPTO_COMPL == odp_event_type (event));
-
odp_crypto_compl_t compl;
odp_crypto_op_result_t result;
odp_packet_t pkt;
vlib_buffer_t *b0;
u32 bi0;
+ u32 next0 = next_index;
+
+ /* We are not interested in other event types */
+ ASSERT (ODP_EVENT_PACKET == odp_event_type (event));
+
compl = odp_crypto_compl_from_event (event);
odp_crypto_compl_result (compl, &result);
+
+ if (PREDICT_FALSE (!result.ok))
+ {
+ vlib_node_increment_counter (vm, odp_crypto_input_node.index,
+ CRYPTO_INPUT_ERROR_CRYPTO_ERROR,
+ 1);
+ next0 = ODP_CRYPTO_INPUT_NEXT_DROP;
+ }
+
pkt = result.pkt;
b0 = vlib_buffer_from_odp_packet (pkt);
@@ -102,12 +115,12 @@ odp_dequeue_cops (vlib_main_t * vm, vlib_node_runtime_t * node,
{
odp_packet_crypto_trace_t *tr;
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
- tr->next_index = next_index;
+ tr->next_index = next0;
}
vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
to_next, n_left_to_next, bi0,
- next_node_index);
+ next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}