diff options
author | Neale Ranns <neale@graphiant.com> | 2021-02-25 16:01:28 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-02-26 02:12:06 +0000 |
commit | c5fe57dac12a46fa618259643909afaec1ac5aae (patch) | |
tree | 6962f3f1a8d10f2f30f0884889aaa379d0d3e509 /src/vnet/ipsec/ipsec.c | |
parent | cc9a1a0d39f22f653801f5d08bfe4892325254b5 (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.c')
-rw-r--r-- | src/vnet/ipsec/ipsec.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/vnet/ipsec/ipsec.c b/src/vnet/ipsec/ipsec.c index 84d2293d482..45ae5acd4b0 100644 --- a/src/vnet/ipsec/ipsec.c +++ b/src/vnet/ipsec/ipsec.c @@ -246,10 +246,9 @@ clib_error_t * ipsec_rsc_in_use (ipsec_main_t * im) { /* return an error is crypto resource are in use */ - if (pool_elts (im->sad) > 0) - return clib_error_return (0, - "%d SA entries configured", - pool_elts (im->sad)); + if (pool_elts (ipsec_sa_pool) > 0) + return clib_error_return (0, "%d SA entries configured", + pool_elts (ipsec_sa_pool)); return (NULL); } @@ -331,20 +330,20 @@ ipsec_set_async_mode (u32 is_enabled) ipsec_sa_t *sa; /* lock all SAs before change im->async_mode */ - pool_foreach (sa, im->sad) - { - fib_node_lock (&sa->node); - } + pool_foreach (sa, ipsec_sa_pool) + { + fib_node_lock (&sa->node); + } im->async_mode = is_enabled; /* change SA crypto op data before unlock them */ - pool_foreach (sa, im->sad) - { - sa->crypto_op_data = is_enabled ? - sa->async_op_data.data : sa->sync_op_data.data; - fib_node_unlock (&sa->node); - } + pool_foreach (sa, ipsec_sa_pool) + { + sa->crypto_op_data = + is_enabled ? sa->async_op_data.data : sa->sync_op_data.data; + fib_node_unlock (&sa->node); + } } static void |