X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fipsec_sa.h;h=7827ef18084a8a78e428a0b6c0e2e71151bdb61e;hb=f16e9a550;hp=84abd6ef4b44c063772e4e6d40da6327cf32de46;hpb=c7eaa711f3e25580687df0618e9ca80d3dc85e5f;p=vpp.git diff --git a/src/vnet/ipsec/ipsec_sa.h b/src/vnet/ipsec/ipsec_sa.h index 84abd6ef4b4..7827ef18084 100644 --- a/src/vnet/ipsec/ipsec_sa.h +++ b/src/vnet/ipsec/ipsec_sa.h @@ -101,7 +101,8 @@ typedef struct ipsec_key_t_ _ (32, IS_PROTECT, "Protect") \ _ (64, IS_INBOUND, "inbound") \ _ (128, IS_AEAD, "aead") \ - _ (256, IS_CTR, "ctr") + _ (256, IS_CTR, "ctr") \ + _ (512, IS_ASYNC, "async") typedef enum ipsec_sad_flags_t_ { @@ -223,6 +224,19 @@ typedef struct STATIC_ASSERT_OFFSET_OF (ipsec_sa_t, cacheline1, CLIB_CACHE_LINE_BYTES); STATIC_ASSERT_OFFSET_OF (ipsec_sa_t, cacheline2, 2 * CLIB_CACHE_LINE_BYTES); +/** + * Pool of IPSec SAs + */ +extern ipsec_sa_t *ipsec_sa_pool; + +/* + * Ensure that the IPsec data does not overlap with the IP data in + * the buffer meta data + */ +STATIC_ASSERT (STRUCT_OFFSET_OF (vnet_buffer_opaque_t, ipsec.sad_index) == + STRUCT_OFFSET_OF (vnet_buffer_opaque_t, ip.save_protocol), + "IPSec data is overlapping with IP data"); + #define _(a,v,s) \ always_inline int \ ipsec_sa_is_set_##v (const ipsec_sa_t *sa) { \ @@ -271,6 +285,7 @@ extern void ipsec_sa_set_integ_alg (ipsec_sa_t * sa, typedef walk_rc_t (*ipsec_sa_walk_cb_t) (ipsec_sa_t * sa, void *ctx); extern void ipsec_sa_walk (ipsec_sa_walk_cb_t cd, void *ctx); +extern u8 *format_ipsec_replay_window (u8 *s, va_list *args); extern u8 *format_ipsec_crypto_alg (u8 * s, va_list * args); extern u8 *format_ipsec_integ_alg (u8 * s, va_list * args); extern u8 *format_ipsec_sa (u8 * s, va_list * args); @@ -500,6 +515,12 @@ ipsec_sa_assign_thread (u32 thread_id) : (unix_time_now_nsec () % vlib_num_workers ()) + 1); } +always_inline ipsec_sa_t * +ipsec_sa_get (u32 sa_index) +{ + return (pool_elt_at_index (ipsec_sa_pool, sa_index)); +} + #endif /* __IPSEC_SPD_SA_H__ */ /*