From: Simon Horman <horms@kernel.org>
To: "D. Wythe" <alibuda@linux.alibaba.com>
Cc: mjambigi@linux.ibm.com, wenjia@linux.ibm.com,
wintera@linux.ibm.com, dust.li@linux.alibaba.com,
tonylu@linux.alibaba.com, guwen@linux.alibaba.com,
kuba@kernel.org, davem@davemloft.net, netdev@vger.kernel.org,
linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org,
pabeni@redhat.com, edumazet@google.com, sidraya@linux.ibm.com,
jaka@linux.ibm.com
Subject: Re: [PATCH net-next] net/smc: add full IPv6 support for SMC
Date: Thu, 16 Oct 2025 14:35:39 +0100 [thread overview]
Message-ID: <aPD0qwDoYNoTTaur@horms.kernel.org> (raw)
In-Reply-To: <20251016054541.692-1-alibuda@linux.alibaba.com>
On Thu, Oct 16, 2025 at 01:45:41PM +0800, D. Wythe wrote:
> The current SMC implementation is IPv4-centric. While it contains a
> workaround for IPv4-mapped IPv6 addresses, it lacks a functional path
> for native IPv6, preventing its use in modern dual-stack or IPv6-only
> networks.
>
> This patch introduces full, native IPv6 support by refactoring the
> address handling mechanism to be IP-version agnostic, which is
> achieved by:
>
> - Introducing a generic `struct smc_ipaddr` to abstract IP addresses.
> - Implementing an IPv6-specific route lookup function.
> - Extend GID matching logic for both IPv4 and IPv6 addresses
>
> With these changes, SMC can now discover RDMA devices and establish
> connections over both native IPv4 and IPv6 networks.
>
> Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
> ---
> net/smc/af_smc.c | 35 +++++++----
> net/smc/smc_core.h | 40 ++++++++++++-
> net/smc/smc_ib.c | 143 ++++++++++++++++++++++++++++++++++++++-------
> net/smc/smc_ib.h | 9 +++
> net/smc/smc_llc.c | 6 +-
> 5 files changed, 193 insertions(+), 40 deletions(-)
>
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 77b99e8ef35a..cbff0b29ad5b 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1132,12 +1132,9 @@ static int smc_find_proposal_devices(struct smc_sock *smc,
>
> /* check if there is an rdma v2 device available */
> ini->check_smcrv2 = true;
> - ini->smcrv2.saddr = smc->clcsock->sk->sk_rcv_saddr;
> +
> + smc_ipaddr_from(&ini->smcrv2.saddr, smc->clcsock->sk, sk_rcv_saddr, sk_v6_rcv_saddr);
Hi,
Unfortunately this introduces a compilation error when CONFIG_IPV6=n.
In file included from smc_wr.h:20,
from smc_llc.h:16,
from af_smc.c:47:
af_smc.c: In function ‘smc_find_proposal_devices’:
/home/horms/projects/linux/linux/include/net/sock.h:388:37: error: ‘struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?
388 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
| ^~~~~~~~~~~~~~~~
smc_core.h:639:51: note: in definition of macro ‘smc_ipaddr_from’
639 | __ipaddr->addr_v6 = __sk->_v6_member; \
| ^~~~~~~~~~
af_smc.c:1136:77: note: in expansion of macro ‘sk_v6_rcv_saddr’
1136 | smc_ipaddr_from(&ini->smcrv2.saddr, smc->clcsock->sk, sk_rcv_saddr, sk_v6_rcv_saddr);
| ^~~~~~~~~~~~~~~
> if (!(ini->smcr_version & SMC_V2) ||
> -#if IS_ENABLED(CONFIG_IPV6)
> - (smc->clcsock->sk->sk_family == AF_INET6 &&
> - !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
> -#endif
> !smc_clc_ueid_count() ||
> smc_find_rdma_device(smc, ini))
> ini->smcr_version &= ~SMC_V2;
...
> @@ -2307,8 +2316,10 @@ static void smc_find_rdma_v2_device_serv(struct smc_sock *new_smc,
> memcpy(ini->peer_mac, pclc->lcl.mac, ETH_ALEN);
> ini->check_smcrv2 = true;
> ini->smcrv2.clc_sk = new_smc->clcsock->sk;
> - ini->smcrv2.saddr = new_smc->clcsock->sk->sk_rcv_saddr;
> - ini->smcrv2.daddr = smc_ib_gid_to_ipv4(smc_v2_ext->roce);
> +
> + smc_ipaddr_from(&ini->smcrv2.saddr, new_smc->clcsock->sk, sk_rcv_saddr, sk_v6_rcv_saddr);
> + smc_ipaddr_from_gid(&ini->smcrv2.daddr, smc_v2_ext->roce);
> +
> rc = smc_find_rdma_device(new_smc, ini);
> if (rc) {
> smc_find_ism_store_rc(rc, ini);
> diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h
...
> @@ -618,4 +626,30 @@ static inline struct smc_link_group *smc_get_lgr(struct smc_link *link)
> {
> return link->lgr;
> }
> +
> +#define smc_ipaddr_from(_ipaddr, _sk, _v4_member, _v6_member) \
> + do { \
> + struct smc_ipaddr *__ipaddr = (_ipaddr); \
> + struct sock *__sk = (_sk); \
> + int __family = __sk->sk_family; \
> + __ipaddr->family = __family; \
> + if (__family == AF_INET) \
> + __ipaddr->addr = __sk->_v4_member; \
> + else \
> + __ipaddr->addr_v6 = __sk->_v6_member; \
> + } while (0)
> +
...
--
pw-bot: changes-requested
next prev parent reply other threads:[~2025-10-16 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 5:45 [PATCH net-next] net/smc: add full IPv6 support for SMC D. Wythe
2025-10-16 13:35 ` Simon Horman [this message]
2025-10-17 9:01 ` D. Wythe
2025-10-16 19:39 ` kernel test robot
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=aPD0qwDoYNoTTaur@horms.kernel.org \
--to=horms@kernel.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=jaka@linux.ibm.com \
--cc=kuba@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=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.com \
--cc=wintera@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;
as well as URLs for NNTP newsgroup(s).