Commit dd229cee authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker

xprtrdma: Remove another sockaddr_storage field (cdata::addr)

Save more space in struct rpcrdma_xprt by removing the redundant
"addr" field from struct rpcrdma_create_data_internal. Wherever
we have rpcrdma_xprt, we also have the rpc_xprt, which has a
sockaddr_storage field with the same content.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent d461f1f2
...@@ -361,9 +361,7 @@ xprt_setup_rdma(struct xprt_create *args) ...@@ -361,9 +361,7 @@ xprt_setup_rdma(struct xprt_create *args)
/* /*
* Set up RDMA-specific connect data. * Set up RDMA-specific connect data.
*/ */
sap = args->dstaddr;
sap = (struct sockaddr *)&cdata.addr;
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 */
...@@ -397,7 +395,7 @@ xprt_setup_rdma(struct xprt_create *args) ...@@ -397,7 +395,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, sap); rc = rpcrdma_ia_open(new_xprt);
if (rc) if (rc)
goto out1; goto out1;
...@@ -483,8 +481,6 @@ xprt_rdma_set_port(struct rpc_xprt *xprt, u16 port) ...@@ -483,8 +481,6 @@ xprt_rdma_set_port(struct rpc_xprt *xprt, u16 port)
sap = (struct sockaddr_in *)&xprt->addr; sap = (struct sockaddr_in *)&xprt->addr;
sap->sin_port = htons(port); sap->sin_port = htons(port);
sap = (struct sockaddr_in *)&rpcx_to_rdmad(xprt).addr;
sap->sin_port = htons(port);
dprintk("RPC: %s: %u\n", __func__, port); dprintk("RPC: %s: %u\n", __func__, port);
} }
......
...@@ -294,8 +294,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -294,8 +294,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
} }
static struct rdma_cm_id * static struct rdma_cm_id *
rpcrdma_create_id(struct rpcrdma_xprt *xprt, rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
struct rpcrdma_ia *ia, struct sockaddr *addr)
{ {
unsigned long wtimeout = msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1; unsigned long wtimeout = msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT) + 1;
struct rdma_cm_id *id; struct rdma_cm_id *id;
...@@ -314,7 +313,9 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, ...@@ -314,7 +313,9 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
} }
ia->ri_async_rc = -ETIMEDOUT; ia->ri_async_rc = -ETIMEDOUT;
rc = rdma_resolve_addr(id, NULL, addr, RDMA_RESOLVE_TIMEOUT); rc = rdma_resolve_addr(id, NULL,
(struct sockaddr *)&xprt->rx_xprt.addr,
RDMA_RESOLVE_TIMEOUT);
if (rc) { if (rc) {
dprintk("RPC: %s: rdma_resolve_addr() failed %i\n", dprintk("RPC: %s: rdma_resolve_addr() failed %i\n",
__func__, rc); __func__, rc);
...@@ -361,19 +362,18 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, ...@@ -361,19 +362,18 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt,
/** /**
* rpcrdma_ia_open - Open and initialize an Interface Adapter. * rpcrdma_ia_open - Open and initialize an Interface Adapter.
* @xprt: controlling transport * @xprt: transport with IA to (re)initialize
* @addr: IP address of remote peer
* *
* Returns 0 on success, negative errno if an appropriate * Returns 0 on success, negative errno if an appropriate
* Interface Adapter could not be found and opened. * Interface Adapter could not be found and opened.
*/ */
int int
rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr) rpcrdma_ia_open(struct rpcrdma_xprt *xprt)
{ {
struct rpcrdma_ia *ia = &xprt->rx_ia; struct rpcrdma_ia *ia = &xprt->rx_ia;
int rc; int rc;
ia->ri_id = rpcrdma_create_id(xprt, ia, addr); ia->ri_id = rpcrdma_create_id(xprt, ia);
if (IS_ERR(ia->ri_id)) { if (IS_ERR(ia->ri_id)) {
rc = PTR_ERR(ia->ri_id); rc = PTR_ERR(ia->ri_id);
goto out_err; goto out_err;
...@@ -649,13 +649,12 @@ static int ...@@ -649,13 +649,12 @@ static int
rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt, rpcrdma_ep_recreate_xprt(struct rpcrdma_xprt *r_xprt,
struct rpcrdma_ep *ep, struct rpcrdma_ia *ia) struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
{ {
struct sockaddr *sap = (struct sockaddr *)&r_xprt->rx_data.addr;
int rc, err; int rc, err;
pr_info("%s: r_xprt = %p\n", __func__, r_xprt); pr_info("%s: r_xprt = %p\n", __func__, r_xprt);
rc = -EHOSTUNREACH; rc = -EHOSTUNREACH;
if (rpcrdma_ia_open(r_xprt, sap)) if (rpcrdma_ia_open(r_xprt))
goto out1; goto out1;
rc = -ENOMEM; rc = -ENOMEM;
...@@ -687,7 +686,6 @@ static int ...@@ -687,7 +686,6 @@ static int
rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt, struct rpcrdma_ep *ep, rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt, struct rpcrdma_ep *ep,
struct rpcrdma_ia *ia) struct rpcrdma_ia *ia)
{ {
struct sockaddr *sap = (struct sockaddr *)&r_xprt->rx_data.addr;
struct rdma_cm_id *id, *old; struct rdma_cm_id *id, *old;
int err, rc; int err, rc;
...@@ -696,7 +694,7 @@ rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt, struct rpcrdma_ep *ep, ...@@ -696,7 +694,7 @@ rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt, struct rpcrdma_ep *ep,
rpcrdma_ep_disconnect(ep, ia); rpcrdma_ep_disconnect(ep, ia);
rc = -EHOSTUNREACH; rc = -EHOSTUNREACH;
id = rpcrdma_create_id(r_xprt, ia, sap); id = rpcrdma_create_id(r_xprt, ia);
if (IS_ERR(id)) if (IS_ERR(id))
goto out; goto out;
......
...@@ -430,7 +430,6 @@ struct rpcrdma_buffer { ...@@ -430,7 +430,6 @@ struct rpcrdma_buffer {
* This data should be set with mount options * This data should be set with mount options
*/ */
struct rpcrdma_create_data_internal { struct rpcrdma_create_data_internal {
struct sockaddr_storage addr; /* RDMA server address */
unsigned int max_requests; /* max requests (slots) in flight */ unsigned int max_requests; /* max requests (slots) in flight */
unsigned int rsize; /* mount rsize - max read hdr+data */ unsigned int rsize; /* mount rsize - max read hdr+data */
unsigned int wsize; /* mount wsize - max write hdr+data */ unsigned int wsize; /* mount wsize - max write hdr+data */
...@@ -543,7 +542,7 @@ extern unsigned int xprt_rdma_memreg_strategy; ...@@ -543,7 +542,7 @@ extern unsigned int xprt_rdma_memreg_strategy;
/* /*
* Interface Adapter calls - xprtrdma/verbs.c * Interface Adapter calls - xprtrdma/verbs.c
*/ */
int rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr); int rpcrdma_ia_open(struct rpcrdma_xprt *xprt);
void rpcrdma_ia_remove(struct rpcrdma_ia *ia); void rpcrdma_ia_remove(struct rpcrdma_ia *ia);
void rpcrdma_ia_close(struct rpcrdma_ia *); void rpcrdma_ia_close(struct rpcrdma_ia *);
bool frwr_is_supported(struct rpcrdma_ia *); bool frwr_is_supported(struct rpcrdma_ia *);
......
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