mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: "D. Wythe" <alibuda@linux.alibaba.com>,
	 Dust Li <dust.li@linux.alibaba.com>,
	 Sidraya Jayagond <sidraya@linux.ibm.com>,
	 Wenjia Zhang <wenjia@linux.ibm.com>,
	 Mahanta Jambigi <mjambigi@linux.ibm.com>,
	 Tony Lu <tonylu@linux.alibaba.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Simon Horman <horms@kernel.org>,
	Shuah Khan <shuah@kernel.org>
Cc: linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org,
	Breno Leitao <leitao@debian.org>,
	 kernel-team@meta.com
Subject: [PATCH net-next 0/2] net/smc: convert getsockopt to getsockopt_iter
Date: Fri, 05 Jun 2026 05:13:24 -0700	[thread overview]
Message-ID: <20260605-getsockopt_smc-v1-0-65da62fa44c4@debian.org> (raw)

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>


             reply	other threads:[~2026-06-05 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05 12:13 Breno Leitao [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260605-getsockopt_smc-v1-0-65da62fa44c4@debian.org \
    --to=leitao@debian.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®