summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_sa.h
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-02-25 16:01:28 +0000
committerFlorin Coras <florin.coras@gmail.com>2021-02-26 02:12:06 +0000
commitc5fe57dac12a46fa618259643909afaec1ac5aae (patch)
tree6962f3f1a8d10f2f30f0884889aaa379d0d3e509 /src/vnet/ipsec/ipsec_sa.h
parentcc9a1a0d39f22f653801f5d08bfe4892325254b5 (diff)
ipsec: move the IPSec SA pool out of ipsec_main
Type: refactor this allows the ipsec_sa_get funtion to be moved from ipsec.h to ipsec_sa.h where it belongs. Also use ipsec_sa_get throughout the code base. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I2dce726c4f7052b5507dd8dcfead0ed5604357df
Diffstat (limited to 'src/vnet/ipsec/ipsec_sa.h')
-rw-r--r--src/vnet/ipsec/ipsec_sa.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/vnet/ipsec/ipsec_sa.h b/src/vnet/ipsec/ipsec_sa.h
index a5756f556f9..705034e8b47 100644
--- a/src/vnet/ipsec/ipsec_sa.h
+++ b/src/vnet/ipsec/ipsec_sa.h
@@ -223,6 +223,11 @@ 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
@@ -279,6 +284,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);
@@ -508,6 +514,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__ */
/*