Commit 16bed0e6 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net/tls: move tls_build_proto() on init path

Move tls_build_proto() so that TOE offload doesn't have to call it
mid way through its bypass enable path.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarJohn Hurley <john.hurley@netronome.com>
Reviewed-by: default avatarSimon Horman <simon.horman@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f21912ed
...@@ -668,14 +668,11 @@ static int tls_hw_prot(struct sock *sk) ...@@ -668,14 +668,11 @@ static int tls_hw_prot(struct sock *sk)
if (!ctx) if (!ctx)
goto out; goto out;
spin_unlock_bh(&device_spinlock);
tls_build_proto(sk);
ctx->sk_destruct = sk->sk_destruct; ctx->sk_destruct = sk->sk_destruct;
sk->sk_destruct = tls_hw_sk_destruct; sk->sk_destruct = tls_hw_sk_destruct;
ctx->rx_conf = TLS_HW_RECORD; ctx->rx_conf = TLS_HW_RECORD;
ctx->tx_conf = TLS_HW_RECORD; ctx->tx_conf = TLS_HW_RECORD;
update_sk_prot(sk, ctx); update_sk_prot(sk, ctx);
spin_lock_bh(&device_spinlock);
rc = 1; rc = 1;
break; break;
} }
...@@ -776,6 +773,8 @@ static int tls_init(struct sock *sk) ...@@ -776,6 +773,8 @@ static int tls_init(struct sock *sk)
struct tls_context *ctx; struct tls_context *ctx;
int rc = 0; int rc = 0;
tls_build_proto(sk);
if (tls_hw_prot(sk)) if (tls_hw_prot(sk))
return 0; return 0;
...@@ -788,8 +787,6 @@ static int tls_init(struct sock *sk) ...@@ -788,8 +787,6 @@ static int tls_init(struct sock *sk)
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTSUPP; return -ENOTSUPP;
tls_build_proto(sk);
/* allocate tls context */ /* allocate tls context */
write_lock_bh(&sk->sk_callback_lock); write_lock_bh(&sk->sk_callback_lock);
ctx = create_ctx(sk); ctx = create_ctx(sk);
......
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