diff options
author | Fan Zhang <roy.fan.zhang@intel.com> | 2020-10-19 13:08:34 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-10-24 09:38:00 +0000 |
commit | 18f0e312f73b5b27748ef229be11da9c4ee1bc1b (patch) | |
tree | 1572a5d8177b018a8d6e892a76b2b7f0717386a1 /src/vnet/ipsec/esp.h | |
parent | 78f487e113fb0fbd1a06b90f3681d237f7edc495 (diff) |
ipsec: remove pending node
This patch removes esp-encrypt-pending and esp-decrypt-pending
graph nodes from ipsec data-path.
Type: improvement
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Change-Id: Icd90837eafdbfbfdf348681dcafb872593978980
Diffstat (limited to 'src/vnet/ipsec/esp.h')
-rw-r--r-- | src/vnet/ipsec/esp.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/vnet/ipsec/esp.h b/src/vnet/ipsec/esp.h index 6c47bb05428..01210157734 100644 --- a/src/vnet/ipsec/esp.h +++ b/src/vnet/ipsec/esp.h @@ -128,6 +128,46 @@ esp_aad_fill (u8 * data, const esp_header_t * esp, const ipsec_sa_t * sa) } } +/* Special case to drop or hand off packets for sync/async modes. + * + * Different than sync mode, async mode only enqueue drop or hand-off packets + * to next nodes. + */ +always_inline void +esp_set_next_index (int is_async, u32 * from, u16 * nexts, u32 bi, + u16 * drop_index, u16 drop_next, u16 * next) +{ + if (is_async) + { + from[*drop_index] = bi; + nexts[*drop_index] = drop_next; + *drop_index += 1; + } + else + next[0] = drop_next; +} + +/* when submitting a frame is failed, drop all buffers in the frame */ +always_inline void +esp_async_recycle_failed_submit (vnet_crypto_async_frame_t * f, + vlib_buffer_t ** b, u32 * from, u16 * nexts, + u16 * n_dropped, u16 drop_next_index, + vlib_error_t err) +{ + u32 n_drop = f->n_elts; + u32 *bi = f->buffer_indices; + b -= n_drop; + while (n_drop--) + { + b[0]->error = err; + esp_set_next_index (1, from, nexts, bi[0], n_dropped, drop_next_index, + NULL); + bi++; + b++; + } + vnet_crypto_async_reset_frame (f); +} + /** * The post data structure to for esp_encrypt/decrypt_inline to write to * vib_buffer_t opaque unused field, and for post nodes to pick up after |