netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net-next 0/7] af_unix: Introduce SO_INQ & SCM_INQ.
@ 2025-07-02 22:35 Kuniyuki Iwashima
  2025-07-02 22:35 ` [PATCH v1 net-next 1/7] af_unix: Don't hold unix_state_lock() in __unix_dgram_recvmsg() Kuniyuki Iwashima
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Kuniyuki Iwashima @ 2025-07-02 22:35 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

We have an application that uses almost the same code for TCP and
AF_UNIX (SOCK_STREAM).

The application uses TCP_INQ for TCP, but AF_UNIX doesn't have it
and requires an extra syscall, ioctl(SIOCINQ) or getsockopt(SO_MEMINFO)
as an alternative.

Also, ioctl(SIOCINQ) for AF_UNIX SOCK_STREAM is more expensive because
it needs to iterate all skb in the receive queue.

This series adds a cached field for SIOCINQ to speed it up and introduce
SO_INQ, the generic version of TCP_INQ to get the queue length as cmsg in
each recvmsg().


Kuniyuki Iwashima (7):
  af_unix: Don't hold unix_state_lock() in __unix_dgram_recvmsg().
  af_unix: Don't check SOCK_DEAD in unix_stream_read_skb().
  af_unix: Don't use skb_recv_datagram() in unix_stream_read_skb().
  af_unix: Use cached value for SOCK_STREAM in unix_inq_len().
  af_unix: Cache state->msg in unix_stream_read_generic().
  af_unix: Introduce SO_INQ.
  selftest: af_unix: Add test for SO_INQ.

 arch/alpha/include/uapi/asm/socket.h          |   3 +
 arch/mips/include/uapi/asm/socket.h           |   3 +
 arch/parisc/include/uapi/asm/socket.h         |   3 +
 arch/sparc/include/uapi/asm/socket.h          |   3 +
 include/net/af_unix.h                         |   2 +
 include/uapi/asm-generic/socket.h             |   3 +
 net/unix/af_unix.c                            | 180 ++++++++++++------
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/af_unix/Makefile  |   2 +-
 tools/testing/selftests/net/af_unix/scm_inq.c | 125 ++++++++++++
 10 files changed, 269 insertions(+), 56 deletions(-)
 create mode 100644 tools/testing/selftests/net/af_unix/scm_inq.c

-- 
2.50.0.727.gbf7dc18ff4-goog


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-07-09  1:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 22:35 [PATCH v1 net-next 0/7] af_unix: Introduce SO_INQ & SCM_INQ Kuniyuki Iwashima
2025-07-02 22:35 ` [PATCH v1 net-next 1/7] af_unix: Don't hold unix_state_lock() in __unix_dgram_recvmsg() Kuniyuki Iwashima
2025-07-06 14:10   ` Willem de Bruijn
2025-07-02 22:35 ` [PATCH v1 net-next 2/7] af_unix: Don't check SOCK_DEAD in unix_stream_read_skb() Kuniyuki Iwashima
2025-07-02 22:35 ` [PATCH v1 net-next 3/7] af_unix: Don't use skb_recv_datagram() " Kuniyuki Iwashima
2025-07-02 22:35 ` [PATCH v1 net-next 4/7] af_unix: Use cached value for SOCK_STREAM in unix_inq_len() Kuniyuki Iwashima
2025-07-06 13:53   ` Willem de Bruijn
2025-07-06 14:13   ` Willem de Bruijn
2025-07-02 22:35 ` [PATCH v1 net-next 5/7] af_unix: Cache state->msg in unix_stream_read_generic() Kuniyuki Iwashima
2025-07-02 22:35 ` [PATCH v1 net-next 6/7] af_unix: Introduce SO_INQ Kuniyuki Iwashima
2025-07-06 14:02   ` Willem de Bruijn
2025-07-06 19:21     ` Kuniyuki Iwashima
2025-07-02 22:35 ` [PATCH v1 net-next 7/7] selftest: af_unix: Add test for SO_INQ Kuniyuki Iwashima
2025-07-06 14:04   ` Willem de Bruijn
2025-07-09  1:30 ` [PATCH v1 net-next 0/7] af_unix: Introduce SO_INQ & SCM_INQ 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).