[PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2

Guangguan Wang posted 2 patches 1 year ago
[PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Guangguan Wang 1 year ago
AF_INET6 is not supported for smc-r v2 client before, even if the
ipv6 addr is ipv4 mapped. Thus, when using AF_INET6, smc-r connection
will fallback to tcp, especially for java applications running smc-r.
This patch support ipv4 mapped ipv6 addr client for smc-r v2. Clients
using real global ipv6 addr is still not supported yet.

Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
---
 net/smc/af_smc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 9d76e902fd77..c3f9c0457418 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1116,7 +1116,10 @@ static int smc_find_proposal_devices(struct smc_sock *smc,
 	ini->check_smcrv2 = true;
 	ini->smcrv2.saddr = smc->clcsock->sk->sk_rcv_saddr;
 	if (!(ini->smcr_version & SMC_V2) ||
-	    smc->clcsock->sk->sk_family != AF_INET ||
+#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;
-- 
2.24.3 (Apple Git-128)
Re: [PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Halil Pasic 1 year ago
On Wed, 11 Dec 2024 10:30:55 +0800
Guangguan Wang <guangguan.wang@linux.alibaba.com> wrote:

> AF_INET6 is not supported for smc-r v2 client before, even if the
> ipv6 addr is ipv4 mapped. Thus, when using AF_INET6, smc-r connection
> will fallback to tcp, especially for java applications running smc-r.
> This patch support ipv4 mapped ipv6 addr client for smc-r v2. Clients
> using real global ipv6 addr is still not supported yet.
> 
> Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
> Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
> Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
> Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Reviewed-by: Halil Pasic <pasic@linux.ibm.com>

Sorry for the late remark, but does this need a Fixes tag? I mean
my gut feeling is that this is a bugfix -- i.e. should have been
working from the get go -- and not a mere enhancement. No strong
opinions here.

Halil
Re: [PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Paolo Abeni 1 year ago
On 12/11/24 19:54, Halil Pasic wrote:
> On Wed, 11 Dec 2024 10:30:55 +0800
> Guangguan Wang <guangguan.wang@linux.alibaba.com> wrote:
> 
>> AF_INET6 is not supported for smc-r v2 client before, even if the
>> ipv6 addr is ipv4 mapped. Thus, when using AF_INET6, smc-r connection
>> will fallback to tcp, especially for java applications running smc-r.
>> This patch support ipv4 mapped ipv6 addr client for smc-r v2. Clients
>> using real global ipv6 addr is still not supported yet.
>>
>> Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
>> Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
>> Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
>> Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
>> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
>> Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
> 
> Sorry for the late remark, but does this need a Fixes tag? I mean
> my gut feeling is that this is a bugfix -- i.e. should have been
> working from the get go -- and not a mere enhancement. No strong
> opinions here.

FTR: my take is this is really a new feature, as the ipv6 support for
missing from the smc-r v2 introduction and sub-system maintainers
already implicitly agreed on that via RB tags.

Cheers,

/P
Re: [PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Halil Pasic 1 year ago
On Thu, 12 Dec 2024 13:49:29 +0100
Paolo Abeni <pabeni@redhat.com> wrote:

> > Sorry for the late remark, but does this need a Fixes tag? I mean
> > my gut feeling is that this is a bugfix -- i.e. should have been
> > working from the get go -- and not a mere enhancement. No strong
> > opinions here.  
> 
> FTR: my take is this is really a new feature, as the ipv6 support for
> missing from the smc-r v2 introduction and sub-system maintainers
> already implicitly agreed on that via RB tags.

Works with me! Thanks!

Regards,
Halil
Re: [PATCH net-next RESEND v3 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Guangguan Wang 1 year ago

On 2024/12/12 20:49, Paolo Abeni wrote:
> On 12/11/24 19:54, Halil Pasic wrote:
>> On Wed, 11 Dec 2024 10:30:55 +0800
>> Guangguan Wang <guangguan.wang@linux.alibaba.com> wrote:
>>
>>> AF_INET6 is not supported for smc-r v2 client before, even if the
>>> ipv6 addr is ipv4 mapped. Thus, when using AF_INET6, smc-r connection
>>> will fallback to tcp, especially for java applications running smc-r.
>>> This patch support ipv4 mapped ipv6 addr client for smc-r v2. Clients
>>> using real global ipv6 addr is still not supported yet.
>>>
>>> Signed-off-by: Guangguan Wang <guangguan.wang@linux.alibaba.com>
>>> Reviewed-by: Wen Gu <guwen@linux.alibaba.com>
>>> Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
>>> Reviewed-by: D. Wythe <alibuda@linux.alibaba.com>
>>> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
>>> Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
>>
>> Sorry for the late remark, but does this need a Fixes tag? I mean
>> my gut feeling is that this is a bugfix -- i.e. should have been
>> working from the get go -- and not a mere enhancement. No strong
>> opinions here.
> 
> FTR: my take is this is really a new feature, as the ipv6 support for
> missing from the smc-r v2 introduction and sub-system maintainers
> already implicitly agreed on that via RB tags.
> 
> Cheers,
> 
> /P

Agree.
This patch enlarges the scope of using SMCRv2, so I think it is a new feature.

Thanks,
Guangguan Wang