Date: Fri, 8 Dec 2017 19:21:46 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326704 - stable/10/sys/ofed/drivers/infiniband/core Message-ID: <201712081921.vB8JLk6e081130@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Dec 8 19:21:46 2017 New Revision: 326704 URL: https://svnweb.freebsd.org/changeset/base/326704 Log: Add support for IPv6 based addresses as part of the TCP unify portspace feature in ibcore. This resolves an interopability issue when using both iWarp(T6) and RDMA(CX-4 and CX-5) devices at the same time. The problem is IPv4 based sockets cannot be bound to an IPv6 based address causing sobind() to fail preventing all use of IPv6 based addresses with RDMA when an iWarp device is present. This is a direct commit. Tested by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com> Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c Modified: stable/10/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/core/cma.c Fri Dec 8 19:19:47 2017 (r326703) +++ stable/10/sys/ofed/drivers/infiniband/core/cma.c Fri Dec 8 19:21:46 2017 (r326704) @@ -2373,32 +2373,37 @@ static int cma_get_tcp_port(struct rdma_id_private *id int ret; int size; struct socket *sock; + struct sockaddr *src_addr = (struct sockaddr *)&id_priv->id.route.addr.src_addr; - ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); + switch (src_addr->sa_family) { + case AF_INET: + case AF_INET6: + break; + default: + /* other address families are not handled by iWarp */ + id_priv->unify_ps_tcp = 0; + return (0); + } + + ret = sock_create_kern(src_addr->sa_family, SOCK_STREAM, IPPROTO_TCP, &sock); if (ret) return ret; #ifdef __linux__ - ret = sock->ops->bind(sock, - (struct sockaddr *) &id_priv->id.route.addr.src_addr, - ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr)); + ret = sock->ops->bind(sock, src_addr, ip_addr_size(src_addr)); #else SOCK_LOCK(sock); sock->so_options |= SO_REUSEADDR; SOCK_UNLOCK(sock); - ret = -sobind(sock, - (struct sockaddr *)&id_priv->id.route.addr.src_addr, - curthread); + ret = -sobind(sock, src_addr, curthread); #endif if (ret) { sock_release(sock); return ret; } - size = ip_addr_size((struct sockaddr *) &id_priv->id.route.addr.src_addr); - ret = sock_getname(sock, - (struct sockaddr *) &id_priv->id.route.addr.src_addr, - &size, 0); + size = ip_addr_size(src_addr); + ret = sock_getname(sock, src_addr, &size, 0); if (ret) { sock_release(sock); return ret;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712081921.vB8JLk6e081130>