Commit 4f486699 authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by David S. Miller

tls: remove tls_context argument from tls_set_device_offload

It's not really needed since we end up refetching it as tls_ctx. We
can also remove the NULL check, since we have already dereferenced ctx
in do_tls_setsockopt_conf.

While at it, fix up the reverse xmas tree ordering.
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b6a30ec9
...@@ -227,7 +227,7 @@ static inline bool tls_strp_msg_mixed_decrypted(struct tls_sw_context_rx *ctx) ...@@ -227,7 +227,7 @@ static inline bool tls_strp_msg_mixed_decrypted(struct tls_sw_context_rx *ctx)
#ifdef CONFIG_TLS_DEVICE #ifdef CONFIG_TLS_DEVICE
int tls_device_init(void); int tls_device_init(void);
void tls_device_cleanup(void); void tls_device_cleanup(void);
int tls_set_device_offload(struct sock *sk, struct tls_context *ctx); int tls_set_device_offload(struct sock *sk);
void tls_device_free_resources_tx(struct sock *sk); void tls_device_free_resources_tx(struct sock *sk);
int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx); int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx);
void tls_device_offload_cleanup_rx(struct sock *sk); void tls_device_offload_cleanup_rx(struct sock *sk);
...@@ -238,7 +238,7 @@ static inline int tls_device_init(void) { return 0; } ...@@ -238,7 +238,7 @@ static inline int tls_device_init(void) { return 0; }
static inline void tls_device_cleanup(void) {} static inline void tls_device_cleanup(void) {}
static inline int static inline int
tls_set_device_offload(struct sock *sk, struct tls_context *ctx) tls_set_device_offload(struct sock *sk)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -1057,21 +1057,21 @@ static struct tls_offload_context_tx *alloc_offload_ctx_tx(struct tls_context *c ...@@ -1057,21 +1057,21 @@ static struct tls_offload_context_tx *alloc_offload_ctx_tx(struct tls_context *c
return offload_ctx; return offload_ctx;
} }
int tls_set_device_offload(struct sock *sk, struct tls_context *ctx) int tls_set_device_offload(struct sock *sk)
{ {
struct tls_context *tls_ctx = tls_get_ctx(sk);
struct tls_prot_info *prot = &tls_ctx->prot_info;
const struct tls_cipher_desc *cipher_desc;
struct tls_record_info *start_marker_record; struct tls_record_info *start_marker_record;
struct tls_offload_context_tx *offload_ctx; struct tls_offload_context_tx *offload_ctx;
const struct tls_cipher_desc *cipher_desc;
struct tls_crypto_info *crypto_info; struct tls_crypto_info *crypto_info;
struct tls_prot_info *prot;
struct net_device *netdev; struct net_device *netdev;
char *iv, *rec_seq; struct tls_context *ctx;
struct sk_buff *skb; struct sk_buff *skb;
char *iv, *rec_seq;
int rc; int rc;
if (!ctx) ctx = tls_get_ctx(sk);
return -EINVAL; prot = &ctx->prot_info;
if (ctx->priv_ctx_tx) if (ctx->priv_ctx_tx)
return -EEXIST; return -EEXIST;
......
...@@ -657,7 +657,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval, ...@@ -657,7 +657,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
} }
if (tx) { if (tx) {
rc = tls_set_device_offload(sk, ctx); rc = tls_set_device_offload(sk);
conf = TLS_HW; conf = TLS_HW;
if (!rc) { if (!rc) {
TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSTXDEVICE); TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSTXDEVICE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment