Skip to content

af_unix: Introduce SO_INQ & SCM_INQ.

Kuniyuki Iwashima netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 6 repliesApplied 7/7

Patches in v1 All 7 applied

#Subject and filesSizeRepliesApplied
1/7af_unix: Don't hold unix_state_lock() in __unix_dgram_recvmsg().net/unix/af_unix.c+1 -31 replyApplied
2/7af_unix: Don't check SOCK_DEAD in unix_stream_read_skb().net/unix/af_unix.c+0 -100 repliesApplied
3/7af_unix: Don't use skb_recv_datagram() in unix_stream_read_skb().net/unix/af_unix.c+22 -170 repliesApplied
4/7af_unix: Use cached value for SOCK_STREAM in unix_inq_len().include/net/af_unix.h net/unix/af_unix.c+29 -102 repliesApplied
5/7af_unix: Cache state->msg in unix_stream_read_generic().net/unix/af_unix.c+17 -160 repliesApplied
6/7af_unix: Introduce SO_INQ.arch/alpha/include/uapi/asm/socket.h arch/mips/include/uapi/asm/socket.h arch/parisc/include/uapi/asm/socket.h +4 more+76 -22 repliesApplied
7/7selftest: af_unix: Add test for SO_INQ.tools/testing/selftests/net/.gitignore tools/testing/selftests/net/af_unix/Makefile tools/testing/selftests/net/af_unix/scm_inq.c+127 -11 replyApplied

Reviews trailers per patch

4 of 7 patches have a Reviewed-by or Acked-by.

PatchWillem de Bruijn
1/7R-b
2/7
3/7
4/7R-b
5/7
6/7R-b
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 net-next 0/7] af_unix: Introduce SO_INQ & SCM_INQ.

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
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog