net: pass back whether socket was empty post accept
authorJens Axboe <axboe@kernel.dk>
Thu, 9 May 2024 15:35:01 +0000 (09:35 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 14 May 2024 00:19:20 +0000 (18:19 -0600)
commit7951e36ac620a9ba1bae0ac0ddd62d2e82285725
tree1154f51ffebda2c624b11f73755dda2a86bc4b7d
parent0645fbe760afcc5332c858d1cbf416bf77ef3c29
net: pass back whether socket was empty post accept

This adds an 'is_empty' argument to struct proto_accept_arg, which can
be used to pass back information on whether or not the given socket has
more connections to accept post the one just accepted.

To utilize this information, the caller should initialize the 'is_empty'
field to, eg, -1 and then check for 0/1 after the accept. If the field
has been set, the caller knows whether there are more pending connections
or not. If the field remains -1 after the accept call, the protocol
doesn't support passing back this information.

This patch wires it up for ipv4/6 TCP.

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/net/sock.h
net/ipv4/inet_connection_sock.c