X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fipsec_sa.h;h=0997eb7d8bc81241e93e4206c4d341a705e10485;hp=79971538646b5969b9cf0fc2de3ddac8d31d4fd9;hb=e5d34919b;hpb=12989b538881f9681f078cf1485c51df1251877a diff --git a/src/vnet/ipsec/ipsec_sa.h b/src/vnet/ipsec/ipsec_sa.h index 79971538646..0997eb7d8bc 100644 --- a/src/vnet/ipsec/ipsec_sa.h +++ b/src/vnet/ipsec/ipsec_sa.h @@ -16,6 +16,7 @@ #define __IPSEC_SPD_SA_H__ #include +#include #include #include @@ -114,6 +115,8 @@ typedef struct u8 crypto_iv_size; u8 crypto_block_size; u8 integ_icv_size; + u32 encrypt_thread_index; + u32 decrypt_thread_index; u32 spi; u32 seq; u32 seq_hi; @@ -207,7 +210,7 @@ extern int ipsec_sa_add_and_lock (u32 id, u32 salt, const ip46_address_t * tunnel_src_addr, const ip46_address_t * tunnel_dst_addr, - u32 * sa_index); + u32 * sa_index, u16 dst_port); extern index_t ipsec_sa_find_and_lock (u32 id); extern int ipsec_sa_unlock_id (u32 id); extern void ipsec_sa_unlock (index_t sai); @@ -231,6 +234,8 @@ extern uword unformat_ipsec_integ_alg (unformat_input_t * input, va_list * args); extern uword unformat_ipsec_key (unformat_input_t * input, va_list * args); +#define IPSEC_UDP_PORT_NONE ((u16)~0) + /* * Anti Replay definitions */ @@ -436,6 +441,18 @@ ipsec_sa_anti_replay_advance (ipsec_sa_t * sa, u32 seq) } } + +/* + * Makes choice for thread_id should be assigned. + * if input ~0, gets random worker_id based on unix_time_now_nsec +*/ +always_inline u32 +ipsec_sa_assign_thread (u32 thread_id) +{ + return ((thread_id) ? thread_id + : (unix_time_now_nsec () % vlib_num_workers ()) + 1); +} + #endif /* __IPSEC_SPD_SA_H__ */ /*