Commit 696190ea authored by Shirley Ma's avatar Shirley Ma Committed by J. Bruce Fields

svcrdma: Support IPv6 with NFS/RDMA

Allow both IPv4 and IPv6 to bind same port at the same time,
restricts use of the IPv6 socket to IPv6 communication.

Changes from v1:
 - Check rdma_set_afonly return value (suggested by Leon Romanovsky)

Changes from v2:
 - Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarShirley Ma <shirley.ma@oracle.com>
Acked-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 14b7f4a1
...@@ -789,7 +789,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, ...@@ -789,7 +789,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
int ret; int ret;
dprintk("svcrdma: Creating RDMA socket\n"); dprintk("svcrdma: Creating RDMA socket\n");
if (sa->sa_family != AF_INET) { if ((sa->sa_family != AF_INET) && (sa->sa_family != AF_INET6)) {
dprintk("svcrdma: Address family %d is not supported.\n", sa->sa_family); dprintk("svcrdma: Address family %d is not supported.\n", sa->sa_family);
return ERR_PTR(-EAFNOSUPPORT); return ERR_PTR(-EAFNOSUPPORT);
} }
...@@ -805,6 +805,16 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, ...@@ -805,6 +805,16 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
goto err0; goto err0;
} }
/* Allow both IPv4 and IPv6 sockets to bind a single port
* at the same time.
*/
#if IS_ENABLED(CONFIG_IPV6)
ret = rdma_set_afonly(listen_id, 1);
if (ret) {
dprintk("svcrdma: rdma_set_afonly failed = %d\n", ret);
goto err1;
}
#endif
ret = rdma_bind_addr(listen_id, sa); ret = rdma_bind_addr(listen_id, sa);
if (ret) { if (ret) {
dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret); dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment