* [PATCH net-next v7] net/tls: Use socket data_ready callback on record availability
@ 2018-07-30 10:38 Vakul Garg
2018-07-30 16:42 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Vakul Garg @ 2018-07-30 10:38 UTC (permalink / raw)
To: netdev; +Cc: borisp, aviadye, davejwatson, davem, Vakul Garg
On receipt of a complete tls record, use socket's saved data_ready
callback instead of state_change callback. In function tls_queue(),
the TLS record is queued in encrypted state. But the decryption
happen inline when tls_sw_recvmsg() or tls_sw_splice_read() get invoked.
So it should be ok to notify the waiting context about the availability
of data as soon as we could collect a full TLS record. For new data
availability notification, sk_data_ready callback is more appropriate.
It points to sock_def_readable() which wakes up specifically for EPOLLIN
event. This is in contrast to the socket callback sk_state_change which
points to sock_def_wakeup() which issues a wakeup unconditionally
(without event mask).
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
---
v6->v7: Improved the commit message to contain the detailed reasoning.
(The same analysis was shared on the mail list.)
net/tls/tls_sw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 6deceb7c56ba..33838f11fafa 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -1028,7 +1028,7 @@ static void tls_queue(struct strparser *strp, struct sk_buff *skb)
ctx->recv_pkt = skb;
strp_pause(strp);
- strp->sk->sk_state_change(strp->sk);
+ ctx->saved_data_ready(strp->sk);
}
static void tls_data_ready(struct sock *sk)
--
2.13.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next v7] net/tls: Use socket data_ready callback on record availability
2018-07-30 10:38 [PATCH net-next v7] net/tls: Use socket data_ready callback on record availability Vakul Garg
@ 2018-07-30 16:42 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-30 16:42 UTC (permalink / raw)
To: vakul.garg; +Cc: netdev, borisp, aviadye, davejwatson
From: Vakul Garg <vakul.garg@nxp.com>
Date: Mon, 30 Jul 2018 16:08:33 +0530
> On receipt of a complete tls record, use socket's saved data_ready
> callback instead of state_change callback. In function tls_queue(),
> the TLS record is queued in encrypted state. But the decryption
> happen inline when tls_sw_recvmsg() or tls_sw_splice_read() get invoked.
> So it should be ok to notify the waiting context about the availability
> of data as soon as we could collect a full TLS record. For new data
> availability notification, sk_data_ready callback is more appropriate.
> It points to sock_def_readable() which wakes up specifically for EPOLLIN
> event. This is in contrast to the socket callback sk_state_change which
> points to sock_def_wakeup() which issues a wakeup unconditionally
> (without event mask).
>
> Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
> ---
> v6->v7: Improved the commit message to contain the detailed reasoning.
> (The same analysis was shared on the mail list.)
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-30 18:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-30 10:38 [PATCH net-next v7] net/tls: Use socket data_ready callback on record availability Vakul Garg
2018-07-30 16:42 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).