Skip to content

Commit

Permalink
net/tls: store async_capable on a single bit
Browse files Browse the repository at this point in the history
Store async_capable on a single bit instead of a full integer
to save space.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Oct 7, 2019
1 parent 4de30a8 commit 5c5458e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/net/tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct tls_sw_context_tx {
struct list_head tx_list;
atomic_t encrypt_pending;
int async_notify;
int async_capable;
u8 async_capable:1;

#define BIT_TX_SCHEDULED 0
#define BIT_TX_CLOSING 1
Expand All @@ -152,7 +152,7 @@ struct tls_sw_context_rx {

struct sk_buff *recv_pkt;
u8 control;
int async_capable;
u8 async_capable:1;
bool decrypted;
atomic_t decrypt_pending;
bool async_notify;
Expand Down
5 changes: 3 additions & 2 deletions net/tls/tls_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2391,10 +2391,11 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
tfm = crypto_aead_tfm(sw_ctx_rx->aead_recv);

if (crypto_info->version == TLS_1_3_VERSION)
sw_ctx_rx->async_capable = false;
sw_ctx_rx->async_capable = 0;
else
sw_ctx_rx->async_capable =
tfm->__crt_alg->cra_flags & CRYPTO_ALG_ASYNC;
!!(tfm->__crt_alg->cra_flags &
CRYPTO_ALG_ASYNC);

/* Set up strparser */
memset(&cb, 0, sizeof(cb));
Expand Down

0 comments on commit 5c5458e

Please sign in to comment.