aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/crypto
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-03-26 13:16:42 +0100
committerDamjan Marion <dmarion@me.com>2019-03-27 12:40:18 +0000
commitd709cbcb1ef80633af657c5427608831e5bbd919 (patch)
treecb389257174014b546e32cb3a6ab15df781703d8 /src/vnet/crypto
parentfbf278adc2fa5ffd1671fb9f91eb03d6d0dc5a9e (diff)
ipsec: compress ipsec_sa_t so data used by dataplane code fits in cacheline
Change-Id: I81ecdf9fdcfcb017117b47dc031f93208e004d7c Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/crypto')
-rw-r--r--src/vnet/crypto/crypto.h14
-rw-r--r--src/vnet/crypto/format.c2
2 files changed, 11 insertions, 5 deletions
diff --git a/src/vnet/crypto/crypto.h b/src/vnet/crypto/crypto.h
index ad6286ccfcb..62db291fce2 100644
--- a/src/vnet/crypto/crypto.h
+++ b/src/vnet/crypto/crypto.h
@@ -57,9 +57,12 @@ typedef enum
foreach_hmac_alg
#undef _
VNET_CRYPTO_N_OP_TYPES,
-} vnet_crypto_op_type_t;
+} __attribute__ ((packed)) vnet_crypto_op_type_t;
/* *INDENT-ON* */
+STATIC_ASSERT (sizeof (vnet_crypto_op_type_t) <= 2,
+ "crypto op type > 2 bytes");
+
typedef struct
{
char *name;
@@ -70,13 +73,16 @@ typedef enum
VNET_CRYPTO_OP_STATUS_PENDING,
VNET_CRYPTO_OP_STATUS_COMPLETED,
VNET_CRYPTO_OP_STATUS_FAIL_NO_HANDLER,
-} vnet_crypto_op_status_t;
+} __attribute__ ((packed)) vnet_crypto_op_status_t;
+
+STATIC_ASSERT (sizeof (vnet_crypto_op_status_t) == 1,
+ "crypto op status > 1 byte");
typedef struct
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
- vnet_crypto_op_type_t op:16;
- vnet_crypto_op_status_t status:8;
+ vnet_crypto_op_type_t op;
+ vnet_crypto_op_status_t status;
u8 key_len, hmac_trunc_len;
u16 flags;
#define VNET_CRYPTO_OP_FLAG_INIT_IV 1
diff --git a/src/vnet/crypto/format.c b/src/vnet/crypto/format.c
index 88c7c0fe7f1..c2786ee5afd 100644
--- a/src/vnet/crypto/format.c
+++ b/src/vnet/crypto/format.c
@@ -30,7 +30,7 @@ u8 *
format_vnet_crypto_op (u8 * s, va_list * args)
{
vnet_crypto_main_t *cm = &crypto_main;
- vnet_crypto_op_type_t op = va_arg (*args, vnet_crypto_op_type_t);
+ vnet_crypto_op_type_t op = va_arg (*args, int); // vnet_crypto_op_type_t);
vnet_crypto_op_type_data_t *otd = cm->opt_data + op;
return format (s, "%s-%U", otd->desc, format_vnet_crypto_alg, otd->alg);