[ofa-general] RE: [PATCH v2] rdma_cm: Add debugfs entries to monitor rdma_cm connections

Sean Hefty sean.hefty at intel.com
Thu Apr 23 15:47:08 PDT 2009


The output is much easier to read.  :)

>@@ -59,6 +62,10 @@ MODULE_LICENSE("Dual BSD/GPL");
> #define CMA_MAX_CM_RETRIES 15
> #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
>
>+#define CASE_RET(val, ret) case val: return #ret;

I would just drop this abstraction.

>+static const char *format_node_type(enum rdma_node_type nt)
>+{
>+	enum rdma_transport_type tt;
>+	if (nt) {
>+		tt = rdma_node_get_transport(nt);
>+		switch (tt) {

We don't really need the local variable tt.

>+static int cma_rdma_id_seq_show(struct seq_file *file, void *v)
>+{
>+	struct rdma_id_private *id_priv;
>+	char local_addr[64], remote_addr[64];
>+
>+	if (!v)
>+		return 0;
>+	if (v == SEQ_START_TOKEN) {
>+		seq_printf(file,
>+		       "%-5s"
>+		       "%-8s"
>+		       "%-5s"
>+		       "%-8s"
>+		       "%-52s"
>+		       "%-52s"
>+		       "%-6s"
>+		       "%-15s"
>+		       "%-8s"
>+		       "\n",
>+		       "TYPE", "DEVICE", "PORT", "NET_DEV", "SRC_ADDR",
"DST_ADDR",
>"SPACE", "STATE", "QP_NUM");
>+	} else {
>+		id_priv = list_entry(v, struct rdma_id_private, list);
>+	       format_addr((struct sockaddr *)&id_priv->id.route.addr.src_addr,
>+				       local_addr);
>+	       format_addr((struct sockaddr *)&id_priv->id.route.addr.dst_addr,
>+				       remote_addr);
>+
>+		       seq_printf(file,
>+			       "%-5s"
>+			       "%-8s"
>+			       "%-5d"
>+			       "%-8s"
>+			       "%-52s"
>+			       "%-52s"
>+			       "%-6s"
>+			       "%-15s"
>+			       "%-8d"
>+			       "\n",
>+			       format_node_type(id_priv-
>>id.route.addr.dev_addr.dev_type),
>+			       (id_priv->id.device) ? id_priv->id.device->name :
"",
>+			       id_priv->id.port_num,
>+			       (id_priv->id.route.addr.dev_addr.src_dev) ?
id_priv-
>>id.route.addr.dev_addr.src_dev->name : "",
>+			       local_addr,
>+			       remote_addr,
>+			       format_port_space(id_priv->id.ps),
>+			       format_cma_state(id_priv->state),
>+			       id_priv->qp_num);
>+	}

I still think this requires a lot of scrolling to get past a couple of print
statements.  Can we at least collapse the "%-5s" ... "\n" stuff down to a single
line?




More information about the general mailing list