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

Guangguan Wang posted 2 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH net-next 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Guangguan Wang 1 year, 2 months ago
AF_INET6 is not supported for smc-r v2 client before, event 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>
---
 net/smc/af_smc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 9d76e902fd77..41923e0a6e33 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1116,7 +1116,8 @@ 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 ||
+	    (smc->clcsock->sk->sk_family != AF_INET &&
+	     !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
 	    !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 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by kernel test robot 1 year, 2 months ago
Hi Guangguan,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Guangguan-Wang/net-smc-support-SMC-R-V2-for-rdma-devices-with-max_recv_sge-equals-to-1/20241128-111259
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241127094533.18459-3-guangguan.wang%40linux.alibaba.com
patch subject: [PATCH net-next 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
config: arm-randconfig-001-20241128 (https://download.01.org/0day-ci/archive/20241128/202411282154.DjX7ilwF-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241128/202411282154.DjX7ilwF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411282154.DjX7ilwF-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/smc/af_smc.c:27:
   In file included from include/linux/if_vlan.h:10:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/arm/include/asm/cacheflush.h:10:
   In file included from include/linux/mm.h:2225:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> net/smc/af_smc.c:1120:46: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
    1120 |              !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
         |                                                     ^
   include/net/sock.h:376:37: note: expanded from macro 'sk_v6_rcv_saddr'
     376 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
         |                                     ^
   include/net/sock.h:155:11: note: 'skc_rcv_saddr' declared here
     155 |                         __be32  skc_rcv_saddr;
         |                                 ^
   1 warning and 1 error generated.


vim +1120 net/smc/af_smc.c

  1087	
  1088	static int smc_find_proposal_devices(struct smc_sock *smc,
  1089					     struct smc_init_info *ini)
  1090	{
  1091		int rc = 0;
  1092	
  1093		/* check if there is an ism device available */
  1094		if (!(ini->smcd_version & SMC_V1) ||
  1095		    smc_find_ism_device(smc, ini) ||
  1096		    smc_connect_ism_vlan_setup(smc, ini))
  1097			ini->smcd_version &= ~SMC_V1;
  1098		/* else ISM V1 is supported for this connection */
  1099	
  1100		/* check if there is an rdma device available */
  1101		if (!(ini->smcr_version & SMC_V1) ||
  1102		    smc_find_rdma_device(smc, ini))
  1103			ini->smcr_version &= ~SMC_V1;
  1104		/* else RDMA is supported for this connection */
  1105	
  1106		ini->smc_type_v1 = smc_indicated_type(ini->smcd_version & SMC_V1,
  1107						      ini->smcr_version & SMC_V1);
  1108	
  1109		/* check if there is an ism v2 device available */
  1110		if (!(ini->smcd_version & SMC_V2) ||
  1111		    !smc_ism_is_v2_capable() ||
  1112		    smc_find_ism_v2_device_clnt(smc, ini))
  1113			ini->smcd_version &= ~SMC_V2;
  1114	
  1115		/* check if there is an rdma v2 device available */
  1116		ini->check_smcrv2 = true;
  1117		ini->smcrv2.saddr = smc->clcsock->sk->sk_rcv_saddr;
  1118		if (!(ini->smcr_version & SMC_V2) ||
  1119		    (smc->clcsock->sk->sk_family != AF_INET &&
> 1120		     !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
  1121		    !smc_clc_ueid_count() ||
  1122		    smc_find_rdma_device(smc, ini))
  1123			ini->smcr_version &= ~SMC_V2;
  1124		ini->check_smcrv2 = false;
  1125	
  1126		ini->smc_type_v2 = smc_indicated_type(ini->smcd_version & SMC_V2,
  1127						      ini->smcr_version & SMC_V2);
  1128	
  1129		/* if neither ISM nor RDMA are supported, fallback */
  1130		if (ini->smc_type_v1 == SMC_TYPE_N && ini->smc_type_v2 == SMC_TYPE_N)
  1131			rc = SMC_CLC_DECL_NOSMCDEV;
  1132	
  1133		return rc;
  1134	}
  1135	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH net-next 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
Posted by Guangguan Wang 1 year, 2 months ago
Sorry for build error, I will fix it in the next version.

On 2024/11/28 21:52, kernel test robot wrote:
> Hi Guangguan,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on net-next/main]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Guangguan-Wang/net-smc-support-SMC-R-V2-for-rdma-devices-with-max_recv_sge-equals-to-1/20241128-111259
> base:   net-next/main
> patch link:    https://lore.kernel.org/r/20241127094533.18459-3-guangguan.wang%40linux.alibaba.com
> patch subject: [PATCH net-next 2/2] net/smc: support ipv4 mapped ipv6 addr client for smc-r v2
> config: arm-randconfig-001-20241128 (https://download.01.org/0day-ci/archive/20241128/202411282154.DjX7ilwF-lkp@intel.com/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241128/202411282154.DjX7ilwF-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202411282154.DjX7ilwF-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from net/smc/af_smc.c:27:
>    In file included from include/linux/if_vlan.h:10:
>    In file included from include/linux/netdevice.h:38:
>    In file included from include/net/net_namespace.h:43:
>    In file included from include/linux/skbuff.h:17:
>    In file included from include/linux/bvec.h:10:
>    In file included from include/linux/highmem.h:8:
>    In file included from include/linux/cacheflush.h:5:
>    In file included from arch/arm/include/asm/cacheflush.h:10:
>    In file included from include/linux/mm.h:2225:
>    include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
>      518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
>          |                               ~~~~~~~~~~~ ^ ~~~
>>> net/smc/af_smc.c:1120:46: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
>     1120 |              !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
>          |                                                     ^
>    include/net/sock.h:376:37: note: expanded from macro 'sk_v6_rcv_saddr'
>      376 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
>          |                                     ^
>    include/net/sock.h:155:11: note: 'skc_rcv_saddr' declared here
>      155 |                         __be32  skc_rcv_saddr;
>          |                                 ^
>    1 warning and 1 error generated.
> 
> 
> vim +1120 net/smc/af_smc.c
> 
>   1087	
>   1088	static int smc_find_proposal_devices(struct smc_sock *smc,
>   1089					     struct smc_init_info *ini)
>   1090	{
>   1091		int rc = 0;
>   1092	
>   1093		/* check if there is an ism device available */
>   1094		if (!(ini->smcd_version & SMC_V1) ||
>   1095		    smc_find_ism_device(smc, ini) ||
>   1096		    smc_connect_ism_vlan_setup(smc, ini))
>   1097			ini->smcd_version &= ~SMC_V1;
>   1098		/* else ISM V1 is supported for this connection */
>   1099	
>   1100		/* check if there is an rdma device available */
>   1101		if (!(ini->smcr_version & SMC_V1) ||
>   1102		    smc_find_rdma_device(smc, ini))
>   1103			ini->smcr_version &= ~SMC_V1;
>   1104		/* else RDMA is supported for this connection */
>   1105	
>   1106		ini->smc_type_v1 = smc_indicated_type(ini->smcd_version & SMC_V1,
>   1107						      ini->smcr_version & SMC_V1);
>   1108	
>   1109		/* check if there is an ism v2 device available */
>   1110		if (!(ini->smcd_version & SMC_V2) ||
>   1111		    !smc_ism_is_v2_capable() ||
>   1112		    smc_find_ism_v2_device_clnt(smc, ini))
>   1113			ini->smcd_version &= ~SMC_V2;
>   1114	
>   1115		/* check if there is an rdma v2 device available */
>   1116		ini->check_smcrv2 = true;
>   1117		ini->smcrv2.saddr = smc->clcsock->sk->sk_rcv_saddr;
>   1118		if (!(ini->smcr_version & SMC_V2) ||
>   1119		    (smc->clcsock->sk->sk_family != AF_INET &&
>> 1120		     !ipv6_addr_v4mapped(&smc->clcsock->sk->sk_v6_rcv_saddr)) ||
>   1121		    !smc_clc_ueid_count() ||
>   1122		    smc_find_rdma_device(smc, ini))
>   1123			ini->smcr_version &= ~SMC_V2;
>   1124		ini->check_smcrv2 = false;
>   1125	
>   1126		ini->smc_type_v2 = smc_indicated_type(ini->smcd_version & SMC_V2,
>   1127						      ini->smcr_version & SMC_V2);
>   1128	
>   1129		/* if neither ISM nor RDMA are supported, fallback */
>   1130		if (ini->smc_type_v1 == SMC_TYPE_N && ini->smc_type_v2 == SMC_TYPE_N)
>   1131			rc = SMC_CLC_DECL_NOSMCDEV;
>   1132	
>   1133		return rc;
>   1134	}
>   1135	
>