Re: [PATCH net-next v11 5/6] tls: Suppress spurious saved_data_ready on all receive paths

Sabrina Dubroca <[email protected]> Thu, 28 May 2026 11:15:12 +0200
Newsgroups dev.linux.lists.kernel-tls-handshake,org.kernel.vger.netdev
Message-ID <ahgHoCb5H6SO4bLg@krikkit>
2026-05-26, 10:21:35 -0400, Chuck Lever wrote:
> From: Chuck Lever <[email protected]>
> 
> Each record release via tls_strp_msg_done() triggered
> tls_strp_check_rcv(), which called tls_rx_msg_ready() and
> fired saved_data_ready(). During a multi-record receive, the
> first N-1 wakeups are pure overhead: the caller is already
> running and will pick up subsequent records on the next loop
> iteration. The recvmsg and splice_read paths share this waste.
> 
> Suppress per-record notifications and emit a single one on
> reader exit. tls_rx_rec_done() releases the current record
> and parses the next without announcing; tls_strp_check_rcv()
> gains a bool announce parameter so callers can request the
> quiet form. tls_rx_reader_release() fires the deferred
> announce on exit through tls_rx_msg_maybe_announce(), an
> idempotent helper that calls saved_data_ready() only when a
> record is parsed and has not yet been announced.
> 
> To keep the final notification idempotent against records that
> the BH or the worker has already announced, tls_strparser gains
> a msg_announced bit. tls_rx_msg_maybe_announce() sets the bit
> when firing saved_data_ready(); the bit is cleared whenever
> the parsed record is wiped, by tls_strp_msg_consume() on
> consumption or by tls_strp_msg_load() when the lower socket
> loses bytes from under the parse. A second call for the same
> parsed record -- as when recvmsg() satisfies the request from
> ctx->rx_list without touching the strparser -- becomes a
> no-op.
> 
> With no remaining callers, tls_strp_msg_done() is removed.
> 
> Signed-off-by: Chuck Lever <[email protected]>
> ---
>  include/net/tls.h  |  5 +++++
>  net/tls/tls.h      |  5 ++---
>  net/tls/tls_main.c |  2 +-
>  net/tls/tls_strp.c | 23 ++++++++++++-----------
>  net/tls/tls_sw.c   | 27 ++++++++++++++++++++++++---
>  5 files changed, 44 insertions(+), 18 deletions(-)

Reviewed-by: Sabrina Dubroca <[email protected]>

-- 
Sabrina