summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_spd.c
diff options
context:
space:
mode:
authorPiotr Bronowski <piotrx.bronowski@intel.com>2022-05-10 13:18:22 +0000
committerPiotr Bronowski <piotrx.bronowski@intel.com>2022-06-29 09:05:51 +0000
commit0464310fd3d4234e5b0aaf730360a1db2b5f7384 (patch)
tree312e4a3df3bc57408cc10c52e565d8c46a2e77c8 /src/vnet/ipsec/ipsec_spd.c
parentfc20c8e50f2784ad62b97bdb0094605d2b86f596 (diff)
ipsec: add/delete ipsec fast path policy
This patch introduces functions to add and delete fast path policies. Type: feature Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com> Change-Id: I3f1f1323148080c9dac531fbe9fa33bad4efe814
Diffstat (limited to 'src/vnet/ipsec/ipsec_spd.c')
-rw-r--r--src/vnet/ipsec/ipsec_spd.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/vnet/ipsec/ipsec_spd.c b/src/vnet/ipsec/ipsec_spd.c
index 4e8017c35ff..aecb50dd346 100644
--- a/src/vnet/ipsec/ipsec_spd.c
+++ b/src/vnet/ipsec/ipsec_spd.c
@@ -46,7 +46,13 @@ ipsec_add_del_spd (vlib_main_t * vm, u32 spd_id, int is_add)
#define _(s,v) vec_free(spd->policies[IPSEC_SPD_POLICY_##s]);
foreach_ipsec_spd_policy_type
#undef _
- pool_put (im->spds, spd);
+ if (im->fp_spd_is_enabled)
+ {
+ ipsec_spd_fp_t *fp_spd = &spd->fp_spd;
+
+ clib_bihash_free_16_8 (&fp_spd->fp_ip4_lookup_hash);
+ }
+ pool_put (im->spds, spd);
}
else /* create new SPD */
{
@@ -55,6 +61,15 @@ ipsec_add_del_spd (vlib_main_t * vm, u32 spd_id, int is_add)
spd_index = spd - im->spds;
spd->id = spd_id;
hash_set (im->spd_index_by_spd_id, spd_id, spd_index);
+ if (im->fp_spd_is_enabled)
+ {
+ ipsec_spd_fp_t *fp_spd = &spd->fp_spd;
+
+ clib_bihash_init_16_8 (
+ &fp_spd->fp_ip4_lookup_hash, "SPD_FP ip4 rules lookup bihash",
+ im->fp_lookup_hash_buckets,
+ im->fp_lookup_hash_buckets * IPSEC_FP_IP4_HASH_MEM_PER_BUCKET);
+ }
}
return 0;
}