* [PATCHv2] net/tls: avoid TCP window full during ->read_sock()
@ 2023-08-07 7:10 Hannes Reinecke
2023-08-07 8:54 ` Sagi Grimberg
2023-08-08 23:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2023-08-07 7:10 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Sagi Grimberg, Keith Busch, linux-nvme, Jakub Kicinski,
Eric Dumazet, Paolo Abeni, netdev, Hannes Reinecke
When flushing the backlog after decoding a record we don't really
know how much data the caller want us to evaluate, so use INT_MAX
and 0 as arguments to tls_read_flush_backlog() to ensure we flush
at 128k of data. Otherwise we might be reading too much data and
trigger a TCP window full.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
net/tls/tls_sw.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 9c1f13541708..5c122d7bb784 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -2240,7 +2240,6 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc,
tlm = tls_msg(skb);
} else {
struct tls_decrypt_arg darg;
- int to_decrypt;
err = tls_rx_rec_wait(sk, NULL, true, released);
if (err <= 0)
@@ -2248,20 +2247,18 @@ int tls_sw_read_sock(struct sock *sk, read_descriptor_t *desc,
memset(&darg.inargs, 0, sizeof(darg.inargs));
- rxm = strp_msg(tls_strp_msg(ctx));
- tlm = tls_msg(tls_strp_msg(ctx));
-
- to_decrypt = rxm->full_len - prot->overhead_size;
-
err = tls_rx_one_record(sk, NULL, &darg);
if (err < 0) {
tls_err_abort(sk, -EBADMSG);
goto read_sock_end;
}
- released = tls_read_flush_backlog(sk, prot, rxm->full_len, to_decrypt,
- decrypted, &flushed_at);
+ released = tls_read_flush_backlog(sk, prot, INT_MAX,
+ 0, decrypted,
+ &flushed_at);
skb = darg.skb;
+ rxm = strp_msg(skb);
+ tlm = tls_msg(skb);
decrypted += rxm->full_len;
tls_rx_rec_done(ctx);
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv2] net/tls: avoid TCP window full during ->read_sock()
2023-08-07 7:10 [PATCHv2] net/tls: avoid TCP window full during ->read_sock() Hannes Reinecke
@ 2023-08-07 8:54 ` Sagi Grimberg
2023-08-08 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2023-08-07 8:54 UTC (permalink / raw)
To: Hannes Reinecke, Christoph Hellwig
Cc: Keith Busch, linux-nvme, Jakub Kicinski, Eric Dumazet,
Paolo Abeni, netdev
> When flushing the backlog after decoding a record we don't really
> know how much data the caller want us to evaluate, so use INT_MAX
> and 0 as arguments to tls_read_flush_backlog() to ensure we flush
> at 128k of data. Otherwise we might be reading too much data and
> trigger a TCP window full.
>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
This looks fine to me,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2] net/tls: avoid TCP window full during ->read_sock()
2023-08-07 7:10 [PATCHv2] net/tls: avoid TCP window full during ->read_sock() Hannes Reinecke
2023-08-07 8:54 ` Sagi Grimberg
@ 2023-08-08 23:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-08 23:00 UTC (permalink / raw)
To: Hannes Reinecke
Cc: hch, sagi, kbusch, linux-nvme, kuba, edumazet, pabeni, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 7 Aug 2023 09:10:22 +0200 you wrote:
> When flushing the backlog after decoding a record we don't really
> know how much data the caller want us to evaluate, so use INT_MAX
> and 0 as arguments to tls_read_flush_backlog() to ensure we flush
> at 128k of data. Otherwise we might be reading too much data and
> trigger a TCP window full.
>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
>
> [...]
Here is the summary with links:
- [PATCHv2] net/tls: avoid TCP window full during ->read_sock()
https://git.kernel.org/netdev/net-next/c/ba4a734e1aa0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-08 23:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-07 7:10 [PATCHv2] net/tls: avoid TCP window full during ->read_sock() Hannes Reinecke
2023-08-07 8:54 ` Sagi Grimberg
2023-08-08 23:00 ` patchwork-bot+netdevbpf
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).