diff mbox

[v2] svcrdma: add IPv6 support

Message ID 56E9A8DD.8030308@oracle.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Shirley Ma March 16, 2016, 6:41 p.m. UTC
Add rdma6 option to support NFS/RDMA IPv6.
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)

Signed-off-by: Shirley Ma <shirley.ma@oracle.com>
---

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Leon Romanovsky March 17, 2016, 8:42 a.m. UTC | #1
On Wed, Mar 16, 2016 at 11:41:33AM -0700, Shirley Ma wrote:
> Add rdma6 option to support NFS/RDMA IPv6.
> 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)

Looks good to me.
Acked-by: Leon Romanovsky <leonro@mellanox.com>

Thanks.

> 
> Signed-off-by: Shirley Ma <shirley.ma@oracle.com>
> ---
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -869,7 +869,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
>  	int ret;
>  
>  	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);
>  		return ERR_PTR(-EAFNOSUPPORT);
>  	}
> @@ -885,6 +885,16 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
>  		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);
>  	if (ret) {
>  		dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chuck Lever III March 17, 2016, 2:01 p.m. UTC | #2
Server-side patch; cc-ing Bruce.

> On Mar 17, 2016, at 4:42 AM, Leon Romanovsky <leon@leon.nu> wrote:
> 
> On Wed, Mar 16, 2016 at 11:41:33AM -0700, Shirley Ma wrote:
>> Add rdma6 option to support NFS/RDMA IPv6.
>> 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)
> 
> Looks good to me.
> Acked-by: Leon Romanovsky <leonro@mellanox.com>
> 
> Thanks.
> 
>> 
>> Signed-off-by: Shirley Ma <shirley.ma@oracle.com>
>> ---
>> 
>> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
>> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
>> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
>> @@ -869,7 +869,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
>> 	int ret;
>> 
>> 	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);
>> 		return ERR_PTR(-EAFNOSUPPORT);
>> 	}
>> @@ -885,6 +885,16 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
>> 		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);
>> 	if (ret) {
>> 		dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -869,7 +869,7 @@  static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
 	int ret;
 
 	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);
 		return ERR_PTR(-EAFNOSUPPORT);
 	}
@@ -885,6 +885,16 @@  static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
 		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);
 	if (ret) {
 		dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);