From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Pismenny Subject: [PATCH net-next 07/18] tls: Split tls_sw_release_resources_rx Date: Wed, 4 Jul 2018 16:32:30 +0300 Message-ID: <1530711161-14578-8-git-send-email-borisp@mellanox.com> References: <1530711161-14578-1-git-send-email-borisp@mellanox.com> Cc: netdev@vger.kernel.org, davejwatson@fb.com, aviadye@mellanox.com, borisp@mellanox.com, saeedm@mellanox.com To: davem@davemloft.net Return-path: Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:40553 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752921AbeGDNcs (ORCPT ); Wed, 4 Jul 2018 09:32:48 -0400 In-Reply-To: <1530711161-14578-1-git-send-email-borisp@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: This patch splits tls_sw_release_resources_rx into two functions one which releases all inner software tls structures and another that also frees the containing structure. In TLS_DEVICE we will need to release the software structures without freeeing the containing structure, which contains other information. Signed-off-by: Boris Pismenny --- include/net/tls.h | 1 + net/tls/tls_sw.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/tls.h b/include/net/tls.h index 49b8922..7a485de 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -223,6 +223,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, void tls_sw_close(struct sock *sk, long timeout); void tls_sw_free_resources_tx(struct sock *sk); void tls_sw_free_resources_rx(struct sock *sk); +void tls_sw_release_resources_rx(struct sock *sk); int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); unsigned int tls_sw_poll(struct file *file, struct socket *sock, diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 8f53b92..7a5c36c 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -1034,7 +1034,7 @@ void tls_sw_free_resources_tx(struct sock *sk) kfree(ctx); } -void tls_sw_free_resources_rx(struct sock *sk) +void tls_sw_release_resources_rx(struct sock *sk) { struct tls_context *tls_ctx = tls_get_ctx(sk); struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); @@ -1053,6 +1053,14 @@ void tls_sw_free_resources_rx(struct sock *sk) strp_done(&ctx->strp); lock_sock(sk); } +} + +void tls_sw_free_resources_rx(struct sock *sk) +{ + struct tls_context *tls_ctx = tls_get_ctx(sk); + struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); + + tls_sw_release_resources_rx(sk); kfree(ctx); } -- 1.8.3.1