From: Geliang Tang Before commit c5c37af6ecad9 ("tcp: Convert do_tcp_sendpages() to use MSG_SPLICE_PAGES"), do_tcp_sendpages() did not call tcp_rate_check_app_limited() internally, so callers needed an explicit tcp_rate_check_app_limited() to cover it. That commit replaced do_tcp_sendpages() with direct tcp_sendmsg_locked() calls, which perform the check on every path that queues data. The outer call became redundant but was left in place. The site changed here, tls_push_sg(), holds the socket lock and invokes tcp_sendmsg_locked() on every iteration. The early-return paths in tcp_sendmsg_locked() that skip tcp_rate_check_app_limited() -- the MSG_ZEROCOPY allocation failure and MSG_FASTOPEN branches -- return without queueing any MSG_SPLICE_PAGES data, so there is no functional consequence from omitting the outer check. A potential benefit of this change is that it facilitates future reuse of tls_push_sg() for KTLS support in protocols beyond TCP, such as MPTCP. Since tcp_rate_check_app_limited() is TCP-specific while sendmsg_locked() is a generic interface in struct proto_ops, this change allows us to switch to different protocols via sk->sk_socket->ops->sendmsg_locked() without carrying protocol-specific assumptions. Signed-off-by: Geliang Tang --- Note: The patch benefits my ongoing "MPTCP KTLS support" work [1]. In patch 9 of that series, I had defined a check_app_limited() interface in struct tls_prot_ops, but this interface is unnecessary if we can drop this redundant call. v3: - send this patch separately to net-next as Jakub suggested. - update the commit log. v2: - drop the "Fixes" tags and update the prefixes and commit logs as Jiayuan suggested. - https://patchwork.kernel.org/project/netdevbpf/cover/cover.1789469930.git.tanggeliang@kylinos.cn/ v1: - https://patchwork.kernel.org/project/netdevbpf/cover/cover.1789368148.git.tanggeliang@kylinos.cn/ [1] MPTCP KTLS support https://lore.kernel.org/netdev/cover.1782123118.git.tanggeliang@kylinos.cn/ --- net/tls/tls_main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index fbb274287aa5..8bdb78718a8d 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -185,8 +185,6 @@ int tls_push_sg(struct sock *sk, ctx->splicing_pages = true; while (1) { - /* is sending application-limited? */ - tcp_rate_check_app_limited(sk); p = sg_page(sg); retry: bvec_set_page(&bvec, p, size, offset); -- 2.53.0