summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_tun.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-10-19 13:23:33 +0000
committerDamjan Marion <dmarion@me.com>2020-10-21 11:10:13 +0000
commit302b25a00ed913767798d58148ef4d36092ee490 (patch)
tree2bc11d23b088084a3dd6b76afc0f967f8ea81d1d /src/vnet/ipsec/ipsec_tun.h
parent5824cc52d1a000b4c4b2ed5da2f1b7761888f0cc (diff)
ipsec: Add to the SA info directly in the bihash
Type: improvement this save the cache miss on the protect structure. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I867d5e49df5edfd6b368f17a34747f32840080e4
Diffstat (limited to 'src/vnet/ipsec/ipsec_tun.h')
-rw-r--r--src/vnet/ipsec/ipsec_tun.h52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/vnet/ipsec/ipsec_tun.h b/src/vnet/ipsec/ipsec_tun.h
index 0d911a2876c..b8e80d3565f 100644
--- a/src/vnet/ipsec/ipsec_tun.h
+++ b/src/vnet/ipsec/ipsec_tun.h
@@ -17,20 +17,31 @@
#include <vnet/ipsec/ipsec.h>
+#define foreach_ipsec_protect_flags \
+ _(L2, 1, "l2") \
+ _(ENCAPED, 2, "encapped") \
+ _(ITF, 4, "itf") \
+
+typedef enum ipsec_protect_flags_t_
+{
+ IPSEC_PROTECT_NONE = 0,
+#define _(a,b,c) IPSEC_PROTECT_##a = b,
+ foreach_ipsec_protect_flags
+#undef _
+} __clib_packed ipsec_protect_flags_t;
+
+extern u8 *format_ipsec_tun_protect_flags (u8 * s, va_list * args);
+
/**
* result of a lookup in the protection bihash
*/
typedef struct ipsec_tun_lkup_result_t_
{
- union
- {
- struct
- {
- u32 tun_index;
- u32 sa_index;
- };
- u64 as_u64;
- };
+ u32 tun_index;
+ u32 sa_index;
+ u32 sw_if_index;
+ ipsec_protect_flags_t flags;
+ u8 __pad[3];
} ipsec_tun_lkup_result_t;
typedef struct ipsec4_tunnel_kv_t
@@ -43,9 +54,9 @@ typedef struct ipsec4_tunnel_kv_t
ipsec_tun_lkup_result_t value;
} __clib_packed ipsec4_tunnel_kv_t;
-STATIC_ASSERT_SIZEOF (ipsec4_tunnel_kv_t, sizeof (clib_bihash_kv_8_8_t));
+STATIC_ASSERT_SIZEOF (ipsec4_tunnel_kv_t, sizeof (clib_bihash_kv_8_16_t));
STATIC_ASSERT_OFFSET_OF (ipsec4_tunnel_kv_t, value,
- STRUCT_OFFSET_OF (clib_bihash_kv_8_8_t, value));
+ STRUCT_OFFSET_OF (clib_bihash_kv_8_16_t, value));
static inline void
ipsec4_tunnel_mk_key (ipsec4_tunnel_kv_t * k,
@@ -77,28 +88,13 @@ typedef struct ipsec6_tunnel_kv_t_
ipsec_tun_lkup_result_t value;
} __clib_packed ipsec6_tunnel_kv_t;
-STATIC_ASSERT_SIZEOF (ipsec6_tunnel_kv_t, sizeof (clib_bihash_kv_24_8_t));
+STATIC_ASSERT_SIZEOF (ipsec6_tunnel_kv_t, sizeof (clib_bihash_kv_24_16_t));
STATIC_ASSERT_OFFSET_OF (ipsec6_tunnel_kv_t, value,
- STRUCT_OFFSET_OF (clib_bihash_kv_24_8_t, value));
+ STRUCT_OFFSET_OF (clib_bihash_kv_24_16_t, value));
extern u8 *format_ipsec4_tunnel_kv (u8 * s, va_list * args);
extern u8 *format_ipsec6_tunnel_kv (u8 * s, va_list * args);
-#define foreach_ipsec_protect_flags \
- _(L2, 1, "l2") \
- _(ENCAPED, 2, "encapped") \
- _(ITF, 4, "itf") \
-
-typedef enum ipsec_protect_flags_t_
-{
- IPSEC_PROTECT_NONE = 0,
-#define _(a,b,c) IPSEC_PROTECT_##a = b,
- foreach_ipsec_protect_flags
-#undef _
-} __clib_packed ipsec_protect_flags_t;
-
-extern u8 *format_ipsec_tun_protect_flags (u8 * s, va_list * args);
-
typedef struct ipsec_ep_t_
{
ip46_address_t src;