Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/smc: convert getsockopt to getsockopt_iter
@ 2026-06-05 12:13 Breno Leitao
  2026-06-05 12:13 ` [PATCH net-next 1/2] smc: convert " Breno Leitao
  2026-06-05 12:13 ` [PATCH net-next 2/2] selftests: net: add SMC getsockopt_iter conversion test Breno Leitao
  0 siblings, 2 replies; 4+ messages in thread
From: Breno Leitao @ 2026-06-05 12:13 UTC (permalink / raw)
  To: D. Wythe, Dust Li, Sidraya Jayagond, Wenjia Zhang,
	Mahanta Jambigi, Tony Lu, Wen Gu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
  Cc: linux-rdma, linux-s390, netdev, linux-kernel, linux-kselftest,
	Breno Leitao, kernel-team

SMC is the last protocol to be converted to getsockopt_iter(). As soon
as this series lands, and all the other outstanding conversion patches
land, getsockopt_iter() will be renamed back to getsockopt() and the
first part of the conversion will be complete.

This series converts SMC's getsockopt() to the new getsockopt_iter()
callback, which hands protocols a sockopt_t that abstracts the optval
buffer as an iov_iter and the option length as a plain int instead of
raw (char __user *optval, int __user *optlen) pointers. This is part of
the broader effort to move getsockopt() off __user pointers so that
kernel-backed callers (e.g. io_uring) can issue socket options.

SMC is a proxy socket: only the SOL_SMC level is handled locally, while
every other level is forwarded to the underlying CLC (TCP) socket. That
sub-socket's getsockopt() still operates on __user buffers, so the
pass-through cannot simply forward the sockopt_t. Instead it reconstructs
optval from a user-backed iter_out, forwards the preserved user optlen
pointer (kept in sockopt_t by the base patch), and mirrors the length
reported by the clcsock back into opt->optlen.

Because of that, the SOL_SMC level is fully converted and works with any
iov_iter type, but the CLC pass-through is intentionally limited to
user-backed iters (ubuf) and returns -EOPNOTSUPP otherwise. This is a
deliberate, temporary restriction: SMC will continue to operate on ubuf
only until the underlying protocols (TCP/IP) grow their own
getsockopt_iter() callbacks. Once that generic callback path is enabled,
the pass-through can forward the sockopt_t directly and drop the ubuf
restriction, supporting all iov_iter types.

The series contains:

  1) smc: convert getsockopt to getsockopt_iter / sockopt_t.

  2) selftests: net: I've vibe coded a kselftest exercising both the
     SOL_SMC path and the CLC pass-through, including the
     oversized-buffer writeback.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
Breno Leitao (2):
      smc: convert to getsockopt_iter
      selftests: net: add SMC getsockopt_iter conversion test

 net/smc/af_smc.c                             |  41 +++++--
 net/smc/smc.h                                |   2 +-
 net/smc/smc_inet.c                           |   4 +-
 tools/testing/selftests/net/Makefile         |   1 +
 tools/testing/selftests/net/getsockopt_smc.c | 175 +++++++++++++++++++++++++++
 5 files changed, 208 insertions(+), 15 deletions(-)
---
base-commit: 0a8b288e2248cb62a62f748bc095c2136acf22b2
change-id: 20260604-getsockopt_smc-e2ad719486eb

Best regards,
-- 
Breno Leitao <leitao@debian.org>


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

end of thread, other threads:[~2026-06-08 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 12:13 [PATCH net-next 0/2] net/smc: convert getsockopt to getsockopt_iter Breno Leitao
2026-06-05 12:13 ` [PATCH net-next 1/2] smc: convert " Breno Leitao
2026-06-08 10:48   ` Breno Leitao
2026-06-05 12:13 ` [PATCH net-next 2/2] selftests: net: add SMC getsockopt_iter conversion test Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox