Commit 0dd39cae authored by Chuck Lever's avatar Chuck Lever Committed by Anna Schumaker

xprtrdma: Display IPv6 addresses and port numbers correctly

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Tested-by: default avatarDevesh Sharma <Devesh.Sharma@Emulex.Com>
Tested-by: default avatarMeghana Cheripady <Meghana.Cheripady@Emulex.Com>
Tested-by: default avatarVeeresh U. Kokatnur <veereshuk@chelsio.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent dbbc1477
...@@ -156,13 +156,48 @@ static struct ctl_table sunrpc_table[] = { ...@@ -156,13 +156,48 @@ static struct ctl_table sunrpc_table[] = {
static struct rpc_xprt_ops xprt_rdma_procs; /* forward reference */ static struct rpc_xprt_ops xprt_rdma_procs; /* forward reference */
static void
xprt_rdma_format_addresses4(struct rpc_xprt *xprt, struct sockaddr *sap)
{
struct sockaddr_in *sin = (struct sockaddr_in *)sap;
char buf[20];
snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr));
xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL);
xprt->address_strings[RPC_DISPLAY_NETID] = RPCBIND_NETID_RDMA;
}
static void
xprt_rdma_format_addresses6(struct rpc_xprt *xprt, struct sockaddr *sap)
{
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
char buf[40];
snprintf(buf, sizeof(buf), "%pi6", &sin6->sin6_addr);
xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL);
xprt->address_strings[RPC_DISPLAY_NETID] = RPCBIND_NETID_RDMA6;
}
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 *) struct sockaddr *sap = (struct sockaddr *)
&rpcx_to_rdmad(xprt).addr; &rpcx_to_rdmad(xprt).addr;
struct sockaddr_in *sin = (struct sockaddr_in *)sap; char buf[128];
char buf[64];
switch (sap->sa_family) {
case AF_INET:
xprt_rdma_format_addresses4(xprt, sap);
break;
case AF_INET6:
xprt_rdma_format_addresses6(xprt, sap);
break;
default:
pr_err("rpcrdma: Unrecognized address family\n");
return;
}
(void)rpc_ntop(sap, buf, sizeof(buf)); (void)rpc_ntop(sap, buf, sizeof(buf));
xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL); xprt->address_strings[RPC_DISPLAY_ADDR] = kstrdup(buf, GFP_KERNEL);
...@@ -170,16 +205,10 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt) ...@@ -170,16 +205,10 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap)); snprintf(buf, sizeof(buf), "%u", rpc_get_port(sap));
xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL);
xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma";
snprintf(buf, sizeof(buf), "%08x", ntohl(sin->sin_addr.s_addr));
xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL);
snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap)); snprintf(buf, sizeof(buf), "%4hx", rpc_get_port(sap));
xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL);
/* netid */ xprt->address_strings[RPC_DISPLAY_PROTO] = "rdma";
xprt->address_strings[RPC_DISPLAY_NETID] = "rdma";
} }
static void static void
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/sunrpc/addr.h>
#include <asm/bitops.h> #include <asm/bitops.h>
#include "xprt_rdma.h" #include "xprt_rdma.h"
...@@ -424,7 +425,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -424,7 +425,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
struct rpcrdma_ia *ia = &xprt->rx_ia; struct rpcrdma_ia *ia = &xprt->rx_ia;
struct rpcrdma_ep *ep = &xprt->rx_ep; struct rpcrdma_ep *ep = &xprt->rx_ep;
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr; struct sockaddr *sap = (struct sockaddr *)&ep->rep_remote_addr;
#endif #endif
struct ib_qp_attr *attr = &ia->ri_qp_attr; struct ib_qp_attr *attr = &ia->ri_qp_attr;
struct ib_qp_init_attr *iattr = &ia->ri_qp_init_attr; struct ib_qp_init_attr *iattr = &ia->ri_qp_init_attr;
...@@ -480,9 +481,8 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -480,9 +481,8 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
wake_up_all(&ep->rep_connect_wait); wake_up_all(&ep->rep_connect_wait);
/*FALLTHROUGH*/ /*FALLTHROUGH*/
default: default:
dprintk("RPC: %s: %pI4:%u (ep 0x%p): %s\n", dprintk("RPC: %s: %pIS:%u (ep 0x%p): %s\n",
__func__, &addr->sin_addr.s_addr, __func__, sap, rpc_get_port(sap), ep,
ntohs(addr->sin_port), ep,
CONNECTION_MSG(event->event)); CONNECTION_MSG(event->event));
break; break;
} }
...@@ -491,19 +491,16 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event) ...@@ -491,19 +491,16 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
if (connstate == 1) { if (connstate == 1) {
int ird = attr->max_dest_rd_atomic; int ird = attr->max_dest_rd_atomic;
int tird = ep->rep_remote_cma.responder_resources; int tird = ep->rep_remote_cma.responder_resources;
printk(KERN_INFO "rpcrdma: connection to %pI4:%u "
"on %s, memreg %d slots %d ird %d%s\n", pr_info("rpcrdma: connection to %pIS:%u on %s, memreg %d slots %d ird %d%s\n",
&addr->sin_addr.s_addr, sap, rpc_get_port(sap),
ntohs(addr->sin_port),
ia->ri_id->device->name, ia->ri_id->device->name,
ia->ri_memreg_strategy, ia->ri_memreg_strategy,
xprt->rx_buf.rb_max_requests, xprt->rx_buf.rb_max_requests,
ird, ird < 4 && ird < tird / 2 ? " (low!)" : ""); ird, ird < 4 && ird < tird / 2 ? " (low!)" : "");
} else if (connstate < 0) { } else if (connstate < 0) {
printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n", pr_info("rpcrdma: connection to %pIS:%u closed (%d)\n",
&addr->sin_addr.s_addr, sap, rpc_get_port(sap), connstate);
ntohs(addr->sin_port),
connstate);
} }
#endif #endif
......
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