diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-06-04 01:17:04 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-05 00:33:50 +0300 |
commit | f0aaa2c975617da78b80feebc87e74dba9ec1f53 (patch) | |
tree | cf4d41bb83de5c1c276f89b792ec6b5452206ae3 /include/net/tls.h | |
parent | 9cd81988cce195598e04fd8290fea873052bb7bd (diff) | |
download | linux-f0aaa2c975617da78b80feebc87e74dba9ec1f53.tar.xz |
net/tls: reorganize struct tls_context
struct tls_context is slightly badly laid out. If we reorder things
right we can save 16 bytes (320 -> 304) but also make all fast path
data fit into two cache lines (one read only and one read/write,
down from four cache lines).
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tls.h')
-rw-r--r-- | include/net/tls.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/include/net/tls.h b/include/net/tls.h index 39ea62f0c1f6..a463a6074e5d 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -236,34 +236,32 @@ struct tls_prot_info { }; struct tls_context { + /* read-only cache line */ struct tls_prot_info prot_info; - union tls_crypto_context crypto_send; - union tls_crypto_context crypto_recv; + u8 tx_conf:3; + u8 rx_conf:3; - struct list_head list; - struct net_device *netdev; - refcount_t refcount; + int (*push_pending_record)(struct sock *sk, int flags); + void (*sk_write_space)(struct sock *sk); void *priv_ctx_tx; void *priv_ctx_rx; - u8 tx_conf:3; - u8 rx_conf:3; + struct net_device *netdev; + /* rw cache line */ struct cipher_context tx; struct cipher_context rx; struct scatterlist *partially_sent_record; u16 partially_sent_offset; - unsigned long flags; bool in_tcp_sendpages; bool pending_open_record_frags; + unsigned long flags; - int (*push_pending_record)(struct sock *sk, int flags); - - void (*sk_write_space)(struct sock *sk); + /* cache cold stuff */ void (*sk_destruct)(struct sock *sk); void (*sk_proto_close)(struct sock *sk, long timeout); @@ -275,6 +273,12 @@ struct tls_context { int __user *optlen); int (*hash)(struct sock *sk); void (*unhash)(struct sock *sk); + + union tls_crypto_context crypto_send; + union tls_crypto_context crypto_recv; + + struct list_head list; + refcount_t refcount; }; enum tls_offload_ctx_dir { |