xprtrdma: Make xprt_setup_rdma() agnostic to family of server address
In particular, recognize when an IPv6 connection is bound. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Devesh Sharma <devesh.sharma@avagotech.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
74d33293e4
commit
5231eb9773
|
@ -175,10 +175,8 @@ xprt_rdma_format_addresses6(struct rpc_xprt *xprt, struct sockaddr *sap)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xprt_rdma_format_addresses(struct rpc_xprt *xprt)
|
xprt_rdma_format_addresses(struct rpc_xprt *xprt, struct sockaddr *sap)
|
||||||
{
|
{
|
||||||
struct sockaddr *sap = (struct sockaddr *)
|
|
||||||
&rpcx_to_rdmad(xprt).addr;
|
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
switch (sap->sa_family) {
|
switch (sap->sa_family) {
|
||||||
|
@ -302,7 +300,7 @@ xprt_setup_rdma(struct xprt_create *args)
|
||||||
struct rpc_xprt *xprt;
|
struct rpc_xprt *xprt;
|
||||||
struct rpcrdma_xprt *new_xprt;
|
struct rpcrdma_xprt *new_xprt;
|
||||||
struct rpcrdma_ep *new_ep;
|
struct rpcrdma_ep *new_ep;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr *sap;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (args->addrlen > sizeof(xprt->addr)) {
|
if (args->addrlen > sizeof(xprt->addr)) {
|
||||||
|
@ -333,26 +331,20 @@ xprt_setup_rdma(struct xprt_create *args)
|
||||||
* Set up RDMA-specific connect data.
|
* Set up RDMA-specific connect data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Put server RDMA address in local cdata */
|
sap = (struct sockaddr *)&cdata.addr;
|
||||||
memcpy(&cdata.addr, args->dstaddr, args->addrlen);
|
memcpy(sap, args->dstaddr, args->addrlen);
|
||||||
|
|
||||||
/* Ensure xprt->addr holds valid server TCP (not RDMA)
|
/* Ensure xprt->addr holds valid server TCP (not RDMA)
|
||||||
* address, for any side protocols which peek at it */
|
* address, for any side protocols which peek at it */
|
||||||
xprt->prot = IPPROTO_TCP;
|
xprt->prot = IPPROTO_TCP;
|
||||||
xprt->addrlen = args->addrlen;
|
xprt->addrlen = args->addrlen;
|
||||||
memcpy(&xprt->addr, &cdata.addr, xprt->addrlen);
|
memcpy(&xprt->addr, sap, xprt->addrlen);
|
||||||
|
|
||||||
sin = (struct sockaddr_in *)&cdata.addr;
|
if (rpc_get_port(sap))
|
||||||
if (ntohs(sin->sin_port) != 0)
|
|
||||||
xprt_set_bound(xprt);
|
xprt_set_bound(xprt);
|
||||||
|
|
||||||
dprintk("RPC: %s: %pI4:%u\n",
|
|
||||||
__func__, &sin->sin_addr.s_addr, ntohs(sin->sin_port));
|
|
||||||
|
|
||||||
/* Set max requests */
|
|
||||||
cdata.max_requests = xprt->max_reqs;
|
cdata.max_requests = xprt->max_reqs;
|
||||||
|
|
||||||
/* Set some length limits */
|
|
||||||
cdata.rsize = RPCRDMA_MAX_SEGS * PAGE_SIZE; /* RDMA write max */
|
cdata.rsize = RPCRDMA_MAX_SEGS * PAGE_SIZE; /* RDMA write max */
|
||||||
cdata.wsize = RPCRDMA_MAX_SEGS * PAGE_SIZE; /* RDMA read max */
|
cdata.wsize = RPCRDMA_MAX_SEGS * PAGE_SIZE; /* RDMA read max */
|
||||||
|
|
||||||
|
@ -375,8 +367,7 @@ xprt_setup_rdma(struct xprt_create *args)
|
||||||
|
|
||||||
new_xprt = rpcx_to_rdmax(xprt);
|
new_xprt = rpcx_to_rdmax(xprt);
|
||||||
|
|
||||||
rc = rpcrdma_ia_open(new_xprt, (struct sockaddr *) &cdata.addr,
|
rc = rpcrdma_ia_open(new_xprt, sap, xprt_rdma_memreg_strategy);
|
||||||
xprt_rdma_memreg_strategy);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out1;
|
goto out1;
|
||||||
|
|
||||||
|
@ -409,7 +400,7 @@ xprt_setup_rdma(struct xprt_create *args)
|
||||||
INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
|
INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
|
||||||
xprt_rdma_connect_worker);
|
xprt_rdma_connect_worker);
|
||||||
|
|
||||||
xprt_rdma_format_addresses(xprt);
|
xprt_rdma_format_addresses(xprt, sap);
|
||||||
xprt->max_payload = new_xprt->rx_ia.ri_ops->ro_maxpages(new_xprt);
|
xprt->max_payload = new_xprt->rx_ia.ri_ops->ro_maxpages(new_xprt);
|
||||||
if (xprt->max_payload == 0)
|
if (xprt->max_payload == 0)
|
||||||
goto out4;
|
goto out4;
|
||||||
|
@ -420,6 +411,9 @@ xprt_setup_rdma(struct xprt_create *args)
|
||||||
if (!try_module_get(THIS_MODULE))
|
if (!try_module_get(THIS_MODULE))
|
||||||
goto out4;
|
goto out4;
|
||||||
|
|
||||||
|
dprintk("RPC: %s: %s:%s\n", __func__,
|
||||||
|
xprt->address_strings[RPC_DISPLAY_ADDR],
|
||||||
|
xprt->address_strings[RPC_DISPLAY_PORT]);
|
||||||
return xprt;
|
return xprt;
|
||||||
|
|
||||||
out4:
|
out4:
|
||||||
|
|
Loading…
Reference in a new issue