Skip to content

Commit

Permalink
net/tls: move tls_build_proto() on init path
Browse files Browse the repository at this point in the history
Move tls_build_proto() so that TOE offload doesn't have to call it
mid way through its bypass enable path.

Signed-off-by: Jakub Kicinski <[email protected]>
Reviewed-by: John Hurley <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jakub Kicinski authored and davem330 committed Oct 4, 2019
1 parent f21912e commit 16bed0e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/tls/tls_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,14 +668,11 @@ static int tls_hw_prot(struct sock *sk)
if (!ctx)
goto out;

spin_unlock_bh(&device_spinlock);
tls_build_proto(sk);
ctx->sk_destruct = sk->sk_destruct;
sk->sk_destruct = tls_hw_sk_destruct;
ctx->rx_conf = TLS_HW_RECORD;
ctx->tx_conf = TLS_HW_RECORD;
update_sk_prot(sk, ctx);
spin_lock_bh(&device_spinlock);
rc = 1;
break;
}
Expand Down Expand Up @@ -776,6 +773,8 @@ static int tls_init(struct sock *sk)
struct tls_context *ctx;
int rc = 0;

tls_build_proto(sk);

if (tls_hw_prot(sk))
return 0;

Expand All @@ -788,8 +787,6 @@ static int tls_init(struct sock *sk)
if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTSUPP;

tls_build_proto(sk);

/* allocate tls context */
write_lock_bh(&sk->sk_callback_lock);
ctx = create_ctx(sk);
Expand Down

0 comments on commit 16bed0e

Please sign in to comment.