RE: [PATCH RFC iproute-next 2/5] rdma: Add CM_ID resource tracking information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky
> Sent: Tuesday, February 20, 2018 6:58 AM
> To: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>
> Cc: dsahern@xxxxxxxxx; stephen@xxxxxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH RFC iproute-next 2/5] rdma: Add CM_ID resource tracking
> information
> 
> On Wed, Feb 14, 2018 at 01:07:01PM -0800, Steve Wise wrote:
> > Sample output:
> >
> > # rdma resource
> > 2: cxgb4_0: pd 5 cq 2 qp 2 cm_id 3 mr 7
> > 3: mlx4_0: pd 7 cq 3 qp 3 cm_id 3 mr 7
> >
> > # rdma resource show cm_id
> > [root@stevo1 iproute2]# /root/stevo/iproute2/rdma/rdma resource  show
> > cm_id link cxgb4_0/- lqpn 0 qp-type RC state LISTEN ps TCP dev-type
> > --- transport-type IWARP pid 30485 comm rping src-addr 0.0.0.0
> > src-port 7174 dst-addr 0.0.0.0 dst-port 0 link cxgb4_0/2 lqpn 1048
> > qp-type RC state CONNECT ps TCP dev-type ETH transport-type IWARP pid
> > 30503 comm rping src-addr 172.16.2.1 src-port 7174 dst-addr 172.16.2.1
> > dst-port 38246 link cxgb4_0/2 lqpn 1040 qp-type RC state CONNECT ps
> > TCP dev-type ETH transport-type IWARP pid 30498 comm rping src-addr
> > 172.16.2.1 src-port 38246 dst-addr 172.16.2.1 dst-port 7174 link
> > mlx4_0/- lqpn 0 qp-type RC state LISTEN ps TCP dev-type ---
> > transport-type IB pid 30485 comm rping src-addr 0.0.0.0 src-port 7174
> > dst-addr 0.0.0.0 dst-port 0 link mlx4_0/1 lqpn 539 qp-type RC state
> > CONNECT ps TCP dev-type ETH transport-type IB pid 30494 comm rping
> > src-addr 172.16.99.1 src-port 7174 dst-addr 172.16.99.1 dst-port 43670
> > link mlx4_0/1 lqpn 538 qp-type RC state CONNECT ps TCP dev-type ETH
> > transport-type IB pid 30492 comm rping src-addr 172.16.99.1 src-port
> > 43670 dst-addr 172.16.99.1 dst-port 7174
> >
> > # rdma resource show cm_id dst-port 7174 link cxgb4_0/2 lqpn 1040
> > qp-type RC state CONNECT ps TCP dev-type ETH transport-type IWARP pid
> > 30498 comm rping src-addr 172.16.2.1 src-port 38246 dst-addr
> > 172.16.2.1 dst-port 7174 link mlx4_0/1 lqpn 538 qp-type RC state
> > CONNECT ps TCP dev-type ETH transport-type IB pid 30492 comm rping
> > src-addr 172.16.99.1 src-port 43670 dst-addr 172.16.99.1 dst-port 7174
> >
> > Signed-off-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>
> > ---
> >  rdma/rdma.h  |   1 +
> >  rdma/res.c   | 312
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  rdma/utils.c |  12 +++
> >  3 files changed, 321 insertions(+), 4 deletions(-)
> 
> Thanks, for doing it.
> 
> >
> > diff --git a/rdma/rdma.h b/rdma/rdma.h index 5809f70..1ef0942 100644
> > --- a/rdma/rdma.h
> > +++ b/rdma/rdma.h
> > @@ -18,6 +18,7 @@
> >  #include <libmnl/libmnl.h>
> >  #include <rdma/rdma_netlink.h>
> >  #include <time.h>
> > +#include <net/if_arp.h>
> >
> >  #include "list.h"
> >  #include "utils.h"
> > diff --git a/rdma/res.c b/rdma/res.c
> > index 2a63e71..beae7dc 100644
> > --- a/rdma/res.c
> > +++ b/rdma/res.c
> > @@ -16,9 +16,11 @@ static int res_help(struct rd *rd)  {
> >  	pr_out("Usage: %s resource\n", rd->filename);
> >  	pr_out("          resource show [DEV]\n");
> > -	pr_out("          resource show [qp]\n");
> > +	pr_out("          resource show [qp|cm_id]\n");
> >  	pr_out("          resource show qp link [DEV/PORT]\n");
> >  	pr_out("          resource show qp link [DEV/PORT] [FILTER-NAME FILTER-
> VALUE]\n");
> > +	pr_out("          resource show cm_id link [DEV/PORT]\n");
> > +	pr_out("          resource show cm_id link [DEV/PORT] [FILTER-NAME
> FILTER-VALUE]\n");
> >  	return 0;
> >  }
> >
> > @@ -431,6 +433,278 @@ static int res_qp_parse_cb(const struct nlmsghdr
> *nlh, void *data)
> >  	return MNL_CB_OK;
> >  }
> >
> > +static void print_qp_type(struct rd *rd, uint32_t val) {
> > +	if (rd->json_output)
> > +		jsonw_string_field(rd->jw, "qp-type",
> > +				   qp_types_to_str(val));
> > +	else
> > +		pr_out("qp-type %s ", qp_types_to_str(val)); }
> > +
> > +static const char *cm_id_state_to_str(uint8_t idx) {
> > +	static const char * const cm_id_states_str[] = { "IDLE", "ADDR_QUERY",
> > +						      "ADDR_RESOLVED",
> "ROUTE_QUERY", "ROUTE_RESOLVED",
> > +						      "CONNECT",
> "DISCONNECT",
> > +						      "ADDR_BOUND", "LISTEN",
> "DEVICE_REMOVAL", "DESTROYING" };
> > +
> > +	if (idx < ARRAY_SIZE(cm_id_states_str))
> > +		return cm_id_states_str[idx];
> > +	return "UNKNOWN";
> > +}
> > +
> > +enum rdma_port_space {
> > +	RDMA_PS_SDP   = 0x0001,
> 
> Do we still support this PS? It is not set in the kernel and Parav posted internal
> patch to remove it.
> 
> > +	RDMA_PS_IPOIB = 0x0002,
> > +	RDMA_PS_IB    = 0x013F,
> > +	RDMA_PS_TCP   = 0x0106,
> > +	RDMA_PS_UDP   = 0x0111,
> > +};
> > +
> > +static const char *cm_id_ps_to_str(uint32_t ps) {
> > +	switch (ps) {
> > +	case RDMA_PS_SDP:
> > +		return "SDP";
> 
> The same question
> 
> > +	case RDMA_PS_IPOIB:
> > +		return "IPoIB";
> > +	case RDMA_PS_IB:
> > +		return "IPoIB";
> > +	case RDMA_PS_TCP:
> > +		return "TCP";
> > +	case RDMA_PS_UDP:
> > +		return "UDP";
> > +	default:
> > +		return "---";
> > +	}
> > +}
> > +
> > +static const char *cm_id_dev_type_to_str(uint8_t dev_type) {
> > +	switch (dev_type) {
> > +	case ARPHRD_INFINIBAND:
> > +		return "IB";
> > +	case ARPHRD_ETHER:
> > +		return "ETH";
> > +	default:
> > +		return "---";
> > +	}
> > +}
Since link information is given as {device,port}, not sure this is needed on how ARP is done.
I think we should rely to device,port information and skip this in NL.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux