All of lore.kernel.org
 help / color / mirror / Atom feed
* Generic logging helpers
@ 2015-05-11 10:00 Sagi Grimberg
       [not found] ` <1431338443-13216-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2015-05-11 10:00 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Chuck Lever, Bart Van Assche, Doug Ledford, Or Gerlitz,
	Chien Yen, Sagi Grimberg

This small set adds some meaningful verbosity to some
of the core/rdma_cm enumerated events. Its useful to
see the meaning of the opcodes instead of revisiting the
code for every new status/event that left the cache in our
brain.

Changes from v0 (RFC):
- Moved string arrays to .c files
- Changed string helpers from macros to exported functions
- Aligned rds to generic helpers as well

Sagi Grimberg (2):
  IB/core, cma: Nice log-friendly string helpers
  ulps: Align several ULPs to use core/rdma_cm logging helpers

 drivers/infiniband/core/cma.c            |   26 +++++++++
 drivers/infiniband/core/verbs.c          |   61 ++++++++++++++++++++
 drivers/infiniband/ulp/iser/iser_verbs.c |   26 +++++---
 drivers/infiniband/ulp/isert/ib_isert.c  |   19 ++++--
 drivers/infiniband/ulp/srp/ib_srp.c      |   15 +++--
 include/rdma/ib_verbs.h                  |    4 +
 include/rdma/rdma_cm.h                   |    2 +
 net/rds/af_rds.c                         |    9 ---
 net/rds/ib.h                             |    1 -
 net/rds/ib_cm.c                          |   36 +-----------
 net/rds/ib_recv.c                        |    4 +-
 net/rds/ib_send.c                        |   38 +------------
 net/rds/rdma_transport.c                 |   34 +----------
 net/rds/rds.h                            |    1 -
 net/sunrpc/xprtrdma/verbs.c              |   90 ++----------------------------
 15 files changed, 145 insertions(+), 221 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] IB/core, cma: Nice log-friendly string helpers
       [not found] ` <1431338443-13216-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-05-11 10:00   ` Sagi Grimberg
       [not found]     ` <1431338443-13216-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2015-05-11 10:00   ` [PATCH v1 2/2] ulps: Align several ULPs to use core/rdma_cm new logging helpers Sagi Grimberg
  1 sibling, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2015-05-11 10:00 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Chuck Lever, Bart Van Assche, Doug Ledford, Or Gerlitz,
	Chien Yen, Sagi Grimberg

Some of us keep revisiting the code to decode enumerations that
appear in our logs. Let's borrow the nice logging helpers that
exists in xprtrdma and rds for CMA events, IB events and WC statuses.

Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/cma.c   |   26 ++++++++++++++++
 drivers/infiniband/core/verbs.c |   61 +++++++++++++++++++++++++++++++++++++++
 include/rdma/ib_verbs.h         |    4 ++
 include/rdma/rdma_cm.h          |    2 +
 4 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index d570030..1438dde 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -65,6 +65,32 @@ MODULE_LICENSE("Dual BSD/GPL");
 #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
 #define CMA_IBOE_PACKET_LIFETIME 18
 
+static const char *cma_events[] = {
+	[RDMA_CM_EVENT_ADDR_RESOLVED]	= "ADDR_RESOLVED",
+	[RDMA_CM_EVENT_ADDR_ERROR]	= "ADDR_ERROR",
+	[RDMA_CM_EVENT_ROUTE_RESOLVED]	= "ROUTE_RESOLVED",
+	[RDMA_CM_EVENT_ROUTE_ERROR]	= "ROUTE_ERROR",
+	[RDMA_CM_EVENT_CONNECT_REQUEST]	= "CONNECT_REQUEST",
+	[RDMA_CM_EVENT_CONNECT_RESPONSE]= "CONNECT_RESPONSE",
+	[RDMA_CM_EVENT_CONNECT_ERROR]	= "CONNECT_ERROR",
+	[RDMA_CM_EVENT_UNREACHABLE]	= "UNREACHABLE",
+	[RDMA_CM_EVENT_REJECTED]	= "REJECTED",
+	[RDMA_CM_EVENT_ESTABLISHED]	= "ESTABLISHED",
+	[RDMA_CM_EVENT_DISCONNECTED]	= "DISCONNECTED",
+	[RDMA_CM_EVENT_DEVICE_REMOVAL]	= "DEVICE_REMOVAL",
+	[RDMA_CM_EVENT_MULTICAST_JOIN]	= "MULTICAST_JOIN",
+	[RDMA_CM_EVENT_MULTICAST_ERROR]	= "MULTICAST_ERROR",
+	[RDMA_CM_EVENT_ADDR_CHANGE]	= "ADDR_CHANGE",
+	[RDMA_CM_EVENT_TIMEWAIT_EXIT]	= "TIMEWAIT_EXIT",
+};
+
+__attribute_const__ const char *cma_event_msg(enum rdma_cm_event_type event)
+{
+	return event < ARRAY_SIZE(cma_events) ?
+			cma_events[event] : "UNRECOGNIZED_EVENT";
+}
+EXPORT_SYMBOL(cma_event_msg);
+
 static void cma_add_one(struct ib_device *device);
 static void cma_remove_one(struct ib_device *device);
 
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index f93eb8d..0cdf1b6 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -48,6 +48,67 @@
 
 #include "core_priv.h"
 
+static const char *ib_events[] = {
+	[IB_EVENT_CQ_ERR]		= "CQ_ERR",
+	[IB_EVENT_QP_FATAL]		= "QP_FATAL",
+	[IB_EVENT_QP_REQ_ERR]		= "QP_REQ_ERR",
+	[IB_EVENT_QP_ACCESS_ERR]	= "QP_ACCESS_ERR",
+	[IB_EVENT_COMM_EST]		= "COMM_EST",
+	[IB_EVENT_SQ_DRAINED]		= "SQ_DRAINED",
+	[IB_EVENT_PATH_MIG]		= "PATH_MIG",
+	[IB_EVENT_PATH_MIG_ERR]		= "PATH_MIG_ERR",
+	[IB_EVENT_DEVICE_FATAL]		= "DEVICE_FATAL",
+	[IB_EVENT_PORT_ACTIVE]		= "PORT_ACTIVE",
+	[IB_EVENT_PORT_ERR]		= "PORT_ERR",
+	[IB_EVENT_LID_CHANGE]		= "LID_CHANGE",
+	[IB_EVENT_PKEY_CHANGE]		= "PKEY_CHANGE",
+	[IB_EVENT_SM_CHANGE]		= "SM_CHANGE",
+	[IB_EVENT_SRQ_ERR]		= "SRQ_ERR",
+	[IB_EVENT_SRQ_LIMIT_REACHED]	= "SRQ_LIMIT_REACHED",
+	[IB_EVENT_QP_LAST_WQE_REACHED]	= "QP_LAST_WQE_REACHED",
+	[IB_EVENT_CLIENT_REREGISTER]	= "CLIENT_REREGISTER",
+	[IB_EVENT_GID_CHANGE]		= "GID_CHANGE",
+};
+
+__attribute_const__ const char *ib_event_msg(enum ib_event_type event)
+{
+	return event < ARRAY_SIZE(ib_events) ?
+			ib_events[event] : "UNRECOGNIZED_EVENT";
+}
+EXPORT_SYMBOL(ib_event_msg);
+
+static const char *wc_statuses[] = {
+	[IB_WC_SUCCESS]			= "SUCCESS",
+	[IB_WC_LOC_LEN_ERR]		= "LOC_LEN_ERR",
+	[IB_WC_LOC_QP_OP_ERR]		= "LOC_QP_OP_ERR",
+	[IB_WC_LOC_EEC_OP_ERR]		= "LOC_EEC_OP_ERR",
+	[IB_WC_LOC_PROT_ERR]		= "LOC_PROT_ERR",
+	[IB_WC_WR_FLUSH_ERR]		= "WR_FLUSH_ERR",
+	[IB_WC_MW_BIND_ERR]		= "MW_BIND_ERR",
+	[IB_WC_BAD_RESP_ERR]		= "BAD_RESP_ERR",
+	[IB_WC_LOC_ACCESS_ERR]		= "LOC_ACCESS_ERR",
+	[IB_WC_REM_INV_REQ_ERR]		= "REM_INV_REQ_ERR",
+	[IB_WC_REM_ACCESS_ERR]		= "REM_ACCESS_ERR",
+	[IB_WC_REM_OP_ERR]		= "REM_OP_ERR",
+	[IB_WC_RETRY_EXC_ERR]		= "RETRY_EXC_ERR",
+	[IB_WC_RNR_RETRY_EXC_ERR]	= "RNR_RETRY_EXC_ERR",
+	[IB_WC_LOC_RDD_VIOL_ERR]	= "LOC_RDD_VIOL_ERR",
+	[IB_WC_REM_INV_RD_REQ_ERR]	= "REM_INV_RD_REQ_ERR",
+	[IB_WC_REM_ABORT_ERR]		= "REM_ABORT_ERR",
+	[IB_WC_INV_EECN_ERR]		= "INV_EECN_ERR",
+	[IB_WC_INV_EEC_STATE_ERR]	= "INV_EEC_STATE_ERR",
+	[IB_WC_FATAL_ERR]		= "FATAL_ERR",
+	[IB_WC_RESP_TIMEOUT_ERR]	= "RESP_TIMEOUT_ERR",
+	[IB_WC_GENERAL_ERR]		= "GENERAL_ERR",
+};
+
+__attribute_const__ const char *wc_status_msg(enum ib_wc_status status)
+{
+	return status < ARRAY_SIZE(wc_statuses) ?
+			wc_statuses[status] : "UNRECOGNIZED_STATUS";
+}
+EXPORT_SYMBOL(wc_status_msg);
+
 __attribute_const__ int ib_rate_to_mult(enum ib_rate rate)
 {
 	switch (rate) {
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 65994a1..ad12935 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -412,6 +412,8 @@ enum ib_event_type {
 	IB_EVENT_GID_CHANGE,
 };
 
+__attribute_const__ const char *ib_event_msg(enum ib_event_type event);
+
 struct ib_event {
 	struct ib_device	*device;
 	union {
@@ -663,6 +665,8 @@ enum ib_wc_status {
 	IB_WC_GENERAL_ERR
 };
 
+__attribute_const__ const char *wc_status_msg(enum ib_wc_status status);
+
 enum ib_wc_opcode {
 	IB_WC_SEND,
 	IB_WC_RDMA_WRITE,
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 1ed2088..00cd398 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -62,6 +62,8 @@ enum rdma_cm_event_type {
 	RDMA_CM_EVENT_TIMEWAIT_EXIT
 };
 
+__attribute_const__ const char *cma_event_msg(enum rdma_cm_event_type event);
+
 enum rdma_port_space {
 	RDMA_PS_SDP   = 0x0001,
 	RDMA_PS_IPOIB = 0x0002,
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1 2/2] ulps: Align several ULPs to use core/rdma_cm new logging helpers
       [not found] ` <1431338443-13216-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2015-05-11 10:00   ` [PATCH v1 1/2] IB/core, cma: Nice log-friendly string helpers Sagi Grimberg
@ 2015-05-11 10:00   ` Sagi Grimberg
       [not found]     ` <1431338443-13216-3-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2015-05-11 10:00 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Chuck Lever, Bart Van Assche, Doug Ledford, Or Gerlitz,
	Chien Yen, Sagi Grimberg

Remove rds & xprtrdma specific helpers and have them and
srp, iser, isert use the generic helpers.

Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/ulp/iser/iser_verbs.c |   26 +++++---
 drivers/infiniband/ulp/isert/ib_isert.c  |   19 ++++--
 drivers/infiniband/ulp/srp/ib_srp.c      |   15 +++--
 net/rds/af_rds.c                         |    9 ---
 net/rds/ib.h                             |    1 -
 net/rds/ib_cm.c                          |   36 +-----------
 net/rds/ib_recv.c                        |    4 +-
 net/rds/ib_send.c                        |   38 +------------
 net/rds/rdma_transport.c                 |   34 +----------
 net/rds/rds.h                            |    1 -
 net/sunrpc/xprtrdma/verbs.c              |   90 ++----------------------------
 11 files changed, 52 insertions(+), 221 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index cc2dd35..eb3d7ca 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -51,19 +51,20 @@ static void iser_cq_callback(struct ib_cq *cq, void *cq_context);
 
 static void iser_cq_event_callback(struct ib_event *cause, void *context)
 {
-	iser_err("got cq event %d \n", cause->event);
+	iser_err("cq event %s(%d)\n", ib_event_msg(cause->event), cause->event);
 }
 
 static void iser_qp_event_callback(struct ib_event *cause, void *context)
 {
-	iser_err("got qp event %d\n",cause->event);
+	iser_err("qp event %s(%d)\n", ib_event_msg(cause->event), cause->event);
 }
 
 static void iser_event_handler(struct ib_event_handler *handler,
 				struct ib_event *event)
 {
-	iser_err("async event %d on device %s port %d\n", event->event,
-		event->device->name, event->element.port_num);
+	iser_err("async event %s(%d) on device %s port %d\n",
+		 ib_event_msg(event->event), event->event,
+		 event->device->name, event->element.port_num);
 }
 
 /**
@@ -873,8 +874,9 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
 	int ret = 0;
 
 	iser_conn = (struct iser_conn *)cma_id->context;
-	iser_info("event %d status %d conn %p id %p\n",
-		  event->event, event->status, cma_id->context, cma_id);
+	iser_info("event %s(%d) status %d conn %p id %p\n",
+		  cma_event_msg(event->event), event->event,
+		  event->status, cma_id->context, cma_id);
 
 	mutex_lock(&iser_conn->state_mutex);
 	switch (event->event) {
@@ -913,7 +915,8 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
 		}
 		break;
 	default:
-		iser_err("Unexpected RDMA CM event (%d)\n", event->event);
+		iser_err("Unexpected RDMA CM event %s(%d)\n",
+			 cma_event_msg(event->event), event->event);
 		break;
 	}
 	mutex_unlock(&iser_conn->state_mutex);
@@ -1173,10 +1176,13 @@ static void iser_handle_wc(struct ib_wc *wc)
 		}
 	} else {
 		if (wc->status != IB_WC_WR_FLUSH_ERR)
-			iser_err("wr id %llx status %d vend_err %x\n",
-				 wc->wr_id, wc->status, wc->vendor_err);
+			iser_err("%s(%d): wr id %llx vend_err %x\n",
+				 wc_status_msg(wc->status), wc->status,
+				 wc->wr_id, wc->vendor_err);
 		else
-			iser_dbg("flush error: wr id %llx\n", wc->wr_id);
+			iser_dbg("%s(%d): wr id %llx\n",
+				 wc_status_msg(wc->status), wc->status,
+				 wc->wr_id);
 
 		if (wc->wr_id == ISER_BEACON_WRID)
 			/* all flush errors were consumed */
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 327529e..48446d9 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -78,7 +78,9 @@ isert_qp_event_callback(struct ib_event *e, void *context)
 {
 	struct isert_conn *isert_conn = context;
 
-	isert_err("conn %p event: %d\n", isert_conn, e->event);
+	isert_err("conn %p event: %s(%d)\n", isert_conn,
+		  ib_event_msg(e->event), e->event);
+
 	switch (e->event) {
 	case IB_EVENT_COMM_EST:
 		rdma_notify(isert_conn->cm_id, IB_EVENT_COMM_EST);
@@ -897,7 +899,8 @@ static int
 isert_np_cma_handler(struct isert_np *isert_np,
 		     enum rdma_cm_event_type event)
 {
-	isert_dbg("isert np %p, handling event %d\n", isert_np, event);
+	isert_dbg("isert np %p, handling event %s(%d)\n",
+		  isert_np, cma_event_msg(event), event);
 
 	switch (event) {
 	case RDMA_CM_EVENT_DEVICE_REMOVAL:
@@ -957,7 +960,8 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 {
 	int ret = 0;
 
-	isert_info("event %d status %d id %p np %p\n", event->event,
+	isert_info("event %s(%d) status %d id %p np %p\n",
+		   cma_event_msg(event->event), event->event,
 		   event->status, cma_id, cma_id->context);
 
 	switch (event->event) {
@@ -2091,10 +2095,13 @@ isert_handle_wc(struct ib_wc *wc)
 		}
 	} else {
 		if (wc->status != IB_WC_WR_FLUSH_ERR)
-			isert_err("wr id %llx status %d vend_err %x\n",
-				  wc->wr_id, wc->status, wc->vendor_err);
+			isert_err("%s(%d): wr id %llx vend_err %x\n",
+				  wc_status_msg(wc->status), wc->status,
+				  wc->wr_id, wc->vendor_err);
 		else
-			isert_dbg("flush error: wr id %llx\n", wc->wr_id);
+			isert_dbg("%s(%d): wr id %llx\n",
+				  wc_status_msg(wc->status), wc->status,
+				  wc->wr_id);
 
 		if (wc->wr_id != ISER_FASTREG_LI_WRID)
 			isert_cq_comp_err(isert_conn, wc);
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 918814c..56e2241 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -253,7 +253,7 @@ static void srp_free_iu(struct srp_host *host, struct srp_iu *iu)
 
 static void srp_qp_event(struct ib_event *event, void *context)
 {
-	pr_debug("QP event %d\n", event->event);
+	pr_debug("QP event %s(%d)\n", ib_event_msg(event->event), event->event);
 }
 
 static int srp_init_qp(struct srp_target_port *target,
@@ -1932,17 +1932,18 @@ static void srp_handle_qp_err(u64 wr_id, enum ib_wc_status wc_status,
 	if (target->connected && !target->qp_in_error) {
 		if (wr_id & LOCAL_INV_WR_ID_MASK) {
 			shost_printk(KERN_ERR, target->scsi_host, PFX
-				     "LOCAL_INV failed with status %d\n",
-				     wc_status);
+				     "LOCAL_INV failed with status %s(%d)\n",
+				     wc_status_msg(wc_status), wc_status);
 		} else if (wr_id & FAST_REG_WR_ID_MASK) {
 			shost_printk(KERN_ERR, target->scsi_host, PFX
-				     "FAST_REG_MR failed status %d\n",
-				     wc_status);
+				     "FAST_REG_MR failed status %s(%d)\n",
+				     wc_status_msg(wc_status), wc_status);
 		} else {
 			shost_printk(KERN_ERR, target->scsi_host,
-				     PFX "failed %s status %d for iu %p\n",
+				     PFX "failed %s status %s(%d) for iu %p\n",
 				     send_err ? "send" : "receive",
-				     wc_status, (void *)(uintptr_t)wr_id);
+				     wc_status_msg(wc_status), wc_status,
+				     (void *)(uintptr_t)wr_id);
 		}
 		queue_work(system_long_wq, &target->tl_err_work);
 	}
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index 1044337..11b623c 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -40,15 +40,6 @@
 
 #include "rds.h"
 
-char *rds_str_array(char **array, size_t elements, size_t index)
-{
-	if ((index < elements) && array[index])
-		return array[index];
-	else
-		return "unknown";
-}
-EXPORT_SYMBOL(rds_str_array);
-
 /* this is just used for stats gathering :/ */
 static DEFINE_SPINLOCK(rds_sock_lock);
 static unsigned long rds_sock_count;
diff --git a/net/rds/ib.h b/net/rds/ib.h
index c36d713..333611d 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -339,7 +339,6 @@ u32 rds_ib_ring_completed(struct rds_ib_work_ring *ring, u32 wr_id, u32 oldest);
 extern wait_queue_head_t rds_ib_ring_empty_wait;
 
 /* ib_send.c */
-char *rds_ib_wc_status_str(enum ib_wc_status status);
 void rds_ib_xmit_complete(struct rds_connection *conn);
 int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
 		unsigned int hdr_off, unsigned int sg, unsigned int off);
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 31b74f5..6e33061 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -39,36 +39,6 @@
 #include "rds.h"
 #include "ib.h"
 
-static char *rds_ib_event_type_strings[] = {
-#define RDS_IB_EVENT_STRING(foo) \
-		[IB_EVENT_##foo] = __stringify(IB_EVENT_##foo)
-	RDS_IB_EVENT_STRING(CQ_ERR),
-	RDS_IB_EVENT_STRING(QP_FATAL),
-	RDS_IB_EVENT_STRING(QP_REQ_ERR),
-	RDS_IB_EVENT_STRING(QP_ACCESS_ERR),
-	RDS_IB_EVENT_STRING(COMM_EST),
-	RDS_IB_EVENT_STRING(SQ_DRAINED),
-	RDS_IB_EVENT_STRING(PATH_MIG),
-	RDS_IB_EVENT_STRING(PATH_MIG_ERR),
-	RDS_IB_EVENT_STRING(DEVICE_FATAL),
-	RDS_IB_EVENT_STRING(PORT_ACTIVE),
-	RDS_IB_EVENT_STRING(PORT_ERR),
-	RDS_IB_EVENT_STRING(LID_CHANGE),
-	RDS_IB_EVENT_STRING(PKEY_CHANGE),
-	RDS_IB_EVENT_STRING(SM_CHANGE),
-	RDS_IB_EVENT_STRING(SRQ_ERR),
-	RDS_IB_EVENT_STRING(SRQ_LIMIT_REACHED),
-	RDS_IB_EVENT_STRING(QP_LAST_WQE_REACHED),
-	RDS_IB_EVENT_STRING(CLIENT_REREGISTER),
-#undef RDS_IB_EVENT_STRING
-};
-
-static char *rds_ib_event_str(enum ib_event_type type)
-{
-	return rds_str_array(rds_ib_event_type_strings,
-			     ARRAY_SIZE(rds_ib_event_type_strings), type);
-};
-
 /*
  * Set the selected protocol version
  */
@@ -234,7 +204,7 @@ static void rds_ib_cm_fill_conn_param(struct rds_connection *conn,
 static void rds_ib_cq_event_handler(struct ib_event *event, void *data)
 {
 	rdsdebug("event %u (%s) data %p\n",
-		 event->event, rds_ib_event_str(event->event), data);
+		 event->event, ib_event_msg(event->event), data);
 }
 
 static void rds_ib_qp_event_handler(struct ib_event *event, void *data)
@@ -243,7 +213,7 @@ static void rds_ib_qp_event_handler(struct ib_event *event, void *data)
 	struct rds_ib_connection *ic = conn->c_transport_data;
 
 	rdsdebug("conn %p ic %p event %u (%s)\n", conn, ic, event->event,
-		 rds_ib_event_str(event->event));
+		 ib_event_msg(event->event));
 
 	switch (event->event) {
 	case IB_EVENT_COMM_EST:
@@ -252,7 +222,7 @@ static void rds_ib_qp_event_handler(struct ib_event *event, void *data)
 	default:
 		rdsdebug("Fatal QP Event %u (%s) "
 			"- connection %pI4->%pI4, reconnecting\n",
-			event->event, rds_ib_event_str(event->event),
+			event->event, ib_event_msg(event->event),
 			&conn->c_laddr, &conn->c_faddr);
 		rds_conn_drop(conn);
 		break;
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 1b981a4..038962b 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -956,7 +956,7 @@ static inline void rds_poll_cq(struct rds_ib_connection *ic,
 	while (ib_poll_cq(ic->i_recv_cq, 1, &wc) > 0) {
 		rdsdebug("wc wr_id 0x%llx status %u (%s) byte_len %u imm_data %u\n",
 			 (unsigned long long)wc.wr_id, wc.status,
-			 rds_ib_wc_status_str(wc.status), wc.byte_len,
+			 wc_status_msg(wc.status), wc.byte_len,
 			 be32_to_cpu(wc.ex.imm_data));
 		rds_ib_stats_inc(s_ib_rx_cq_event);
 
@@ -978,7 +978,7 @@ static inline void rds_poll_cq(struct rds_ib_connection *ic,
 						  "status %u (%s), disconnecting and "
 						  "reconnecting\n", &conn->c_faddr,
 						  wc.status,
-						  rds_ib_wc_status_str(wc.status));
+						  wc_status_msg(wc.status));
 		}
 
 		/*
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c
index bd3825d..014f972 100644
--- a/net/rds/ib_send.c
+++ b/net/rds/ib_send.c
@@ -39,40 +39,6 @@
 #include "rds.h"
 #include "ib.h"
 
-static char *rds_ib_wc_status_strings[] = {
-#define RDS_IB_WC_STATUS_STR(foo) \
-		[IB_WC_##foo] = __stringify(IB_WC_##foo)
-	RDS_IB_WC_STATUS_STR(SUCCESS),
-	RDS_IB_WC_STATUS_STR(LOC_LEN_ERR),
-	RDS_IB_WC_STATUS_STR(LOC_QP_OP_ERR),
-	RDS_IB_WC_STATUS_STR(LOC_EEC_OP_ERR),
-	RDS_IB_WC_STATUS_STR(LOC_PROT_ERR),
-	RDS_IB_WC_STATUS_STR(WR_FLUSH_ERR),
-	RDS_IB_WC_STATUS_STR(MW_BIND_ERR),
-	RDS_IB_WC_STATUS_STR(BAD_RESP_ERR),
-	RDS_IB_WC_STATUS_STR(LOC_ACCESS_ERR),
-	RDS_IB_WC_STATUS_STR(REM_INV_REQ_ERR),
-	RDS_IB_WC_STATUS_STR(REM_ACCESS_ERR),
-	RDS_IB_WC_STATUS_STR(REM_OP_ERR),
-	RDS_IB_WC_STATUS_STR(RETRY_EXC_ERR),
-	RDS_IB_WC_STATUS_STR(RNR_RETRY_EXC_ERR),
-	RDS_IB_WC_STATUS_STR(LOC_RDD_VIOL_ERR),
-	RDS_IB_WC_STATUS_STR(REM_INV_RD_REQ_ERR),
-	RDS_IB_WC_STATUS_STR(REM_ABORT_ERR),
-	RDS_IB_WC_STATUS_STR(INV_EECN_ERR),
-	RDS_IB_WC_STATUS_STR(INV_EEC_STATE_ERR),
-	RDS_IB_WC_STATUS_STR(FATAL_ERR),
-	RDS_IB_WC_STATUS_STR(RESP_TIMEOUT_ERR),
-	RDS_IB_WC_STATUS_STR(GENERAL_ERR),
-#undef RDS_IB_WC_STATUS_STR
-};
-
-char *rds_ib_wc_status_str(enum ib_wc_status status)
-{
-	return rds_str_array(rds_ib_wc_status_strings,
-			     ARRAY_SIZE(rds_ib_wc_status_strings), status);
-}
-
 /*
  * Convert IB-specific error message to RDS error message and call core
  * completion handler.
@@ -293,7 +259,7 @@ void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context)
 	while (ib_poll_cq(cq, 1, &wc) > 0) {
 		rdsdebug("wc wr_id 0x%llx status %u (%s) byte_len %u imm_data %u\n",
 			 (unsigned long long)wc.wr_id, wc.status,
-			 rds_ib_wc_status_str(wc.status), wc.byte_len,
+			 wc_status_msg(wc.status), wc.byte_len,
 			 be32_to_cpu(wc.ex.imm_data));
 		rds_ib_stats_inc(s_ib_tx_cq_event);
 
@@ -344,7 +310,7 @@ void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context)
 			rds_ib_conn_error(conn, "send completion on %pI4 had status "
 					  "%u (%s), disconnecting and reconnecting\n",
 					  &conn->c_faddr, wc.status,
-					  rds_ib_wc_status_str(wc.status));
+					  wc_status_msg(wc.status));
 		}
 	}
 }
diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index 6cd9d1d..643ea92 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -37,34 +37,6 @@
 
 static struct rdma_cm_id *rds_rdma_listen_id;
 
-static char *rds_cm_event_strings[] = {
-#define RDS_CM_EVENT_STRING(foo) \
-		[RDMA_CM_EVENT_##foo] = __stringify(RDMA_CM_EVENT_##foo)
-	RDS_CM_EVENT_STRING(ADDR_RESOLVED),
-	RDS_CM_EVENT_STRING(ADDR_ERROR),
-	RDS_CM_EVENT_STRING(ROUTE_RESOLVED),
-	RDS_CM_EVENT_STRING(ROUTE_ERROR),
-	RDS_CM_EVENT_STRING(CONNECT_REQUEST),
-	RDS_CM_EVENT_STRING(CONNECT_RESPONSE),
-	RDS_CM_EVENT_STRING(CONNECT_ERROR),
-	RDS_CM_EVENT_STRING(UNREACHABLE),
-	RDS_CM_EVENT_STRING(REJECTED),
-	RDS_CM_EVENT_STRING(ESTABLISHED),
-	RDS_CM_EVENT_STRING(DISCONNECTED),
-	RDS_CM_EVENT_STRING(DEVICE_REMOVAL),
-	RDS_CM_EVENT_STRING(MULTICAST_JOIN),
-	RDS_CM_EVENT_STRING(MULTICAST_ERROR),
-	RDS_CM_EVENT_STRING(ADDR_CHANGE),
-	RDS_CM_EVENT_STRING(TIMEWAIT_EXIT),
-#undef RDS_CM_EVENT_STRING
-};
-
-static char *rds_cm_event_str(enum rdma_cm_event_type type)
-{
-	return rds_str_array(rds_cm_event_strings,
-			     ARRAY_SIZE(rds_cm_event_strings), type);
-};
-
 int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 			      struct rdma_cm_event *event)
 {
@@ -74,7 +46,7 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 	int ret = 0;
 
 	rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id,
-		 event->event, rds_cm_event_str(event->event));
+		 event->event, cma_event_msg(event->event));
 
 	if (cm_id->device->node_type == RDMA_NODE_RNIC)
 		trans = &rds_iw_transport;
@@ -139,7 +111,7 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 	default:
 		/* things like device disconnect? */
 		printk(KERN_ERR "RDS: unknown event %u (%s)!\n",
-		       event->event, rds_cm_event_str(event->event));
+		       event->event, cma_event_msg(event->event));
 		break;
 	}
 
@@ -148,7 +120,7 @@ out:
 		mutex_unlock(&conn->c_cm_lock);
 
 	rdsdebug("id %p event %u (%s) handling ret %d\n", cm_id, event->event,
-		 rds_cm_event_str(event->event), ret);
+		 cma_event_msg(event->event), ret);
 
 	return ret;
 }
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 0d41155..099754c 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -575,7 +575,6 @@ struct rds_statistics {
 };
 
 /* af_rds.c */
-char *rds_str_array(char **array, size_t elements, size_t index);
 void rds_sock_addref(struct rds_sock *rs);
 void rds_sock_put(struct rds_sock *rs);
 void rds_wake_sk_sleep(struct rds_sock *rs);
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 4870d27..f801799 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -105,32 +105,6 @@ rpcrdma_run_tasklet(unsigned long data)
 
 static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL);
 
-static const char * const async_event[] = {
-	"CQ error",
-	"QP fatal error",
-	"QP request error",
-	"QP access error",
-	"communication established",
-	"send queue drained",
-	"path migration successful",
-	"path mig error",
-	"device fatal error",
-	"port active",
-	"port error",
-	"LID change",
-	"P_key change",
-	"SM change",
-	"SRQ error",
-	"SRQ limit reached",
-	"last WQE reached",
-	"client reregister",
-	"GID change",
-};
-
-#define ASYNC_MSG(status)					\
-	((status) < ARRAY_SIZE(async_event) ?			\
-		async_event[(status)] : "unknown async error")
-
 static void
 rpcrdma_schedule_tasklet(struct list_head *sched_list)
 {
@@ -148,7 +122,7 @@ rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context)
 	struct rpcrdma_ep *ep = context;
 
 	pr_err("RPC:       %s: %s on device %s ep %p\n",
-	       __func__, ASYNC_MSG(event->event),
+	       __func__, ib_event_msg(event->event),
 		event->device->name, context);
 	if (ep->rep_connected == 1) {
 		ep->rep_connected = -EIO;
@@ -163,7 +137,7 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
 	struct rpcrdma_ep *ep = context;
 
 	pr_err("RPC:       %s: %s on device %s ep %p\n",
-	       __func__, ASYNC_MSG(event->event),
+	       __func__, ib_event_msg(event->event),
 		event->device->name, context);
 	if (ep->rep_connected == 1) {
 		ep->rep_connected = -EIO;
@@ -172,35 +146,6 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
 	}
 }
 
-static const char * const wc_status[] = {
-	"success",
-	"local length error",
-	"local QP operation error",
-	"local EE context operation error",
-	"local protection error",
-	"WR flushed",
-	"memory management operation error",
-	"bad response error",
-	"local access error",
-	"remote invalid request error",
-	"remote access error",
-	"remote operation error",
-	"transport retry counter exceeded",
-	"RNR retry counter exceeded",
-	"local RDD violation error",
-	"remove invalid RD request",
-	"operation aborted",
-	"invalid EE context number",
-	"invalid EE context state",
-	"fatal error",
-	"response timeout error",
-	"general error",
-};
-
-#define COMPLETION_MSG(status)					\
-	((status) < ARRAY_SIZE(wc_status) ?			\
-		wc_status[(status)] : "unexpected completion error")
-
 static void
 rpcrdma_sendcq_process_wc(struct ib_wc *wc)
 {
@@ -209,7 +154,7 @@ rpcrdma_sendcq_process_wc(struct ib_wc *wc)
 		if (wc->status != IB_WC_SUCCESS &&
 		    wc->status != IB_WC_WR_FLUSH_ERR)
 			pr_err("RPC:       %s: SEND: %s\n",
-			       __func__, COMPLETION_MSG(wc->status));
+			       __func__, wc_status_msg(wc->status));
 	} else {
 		struct rpcrdma_mw *r;
 
@@ -302,7 +247,7 @@ out_schedule:
 out_fail:
 	if (wc->status != IB_WC_WR_FLUSH_ERR)
 		pr_err("RPC:       %s: rep %p: %s\n",
-		       __func__, rep, COMPLETION_MSG(wc->status));
+		       __func__, rep, wc_status_msg(wc->status));
 	rep->rr_len = ~0U;
 	goto out_schedule;
 }
@@ -386,31 +331,6 @@ rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
 		rpcrdma_sendcq_process_wc(&wc);
 }
 
-#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
-static const char * const conn[] = {
-	"address resolved",
-	"address error",
-	"route resolved",
-	"route error",
-	"connect request",
-	"connect response",
-	"connect error",
-	"unreachable",
-	"rejected",
-	"established",
-	"disconnected",
-	"device removal",
-	"multicast join",
-	"multicast error",
-	"address change",
-	"timewait exit",
-};
-
-#define CONNECTION_MSG(status)						\
-	((status) < ARRAY_SIZE(conn) ?					\
-		conn[(status)] : "unrecognized connection error")
-#endif
-
 static int
 rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
 {
@@ -476,7 +396,7 @@ connected:
 	default:
 		dprintk("RPC:       %s: %pIS:%u (ep 0x%p): %s\n",
 			__func__, sap, rpc_get_port(sap), ep,
-			CONNECTION_MSG(event->event));
+			cma_event_msg(event->event));
 		break;
 	}
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] IB/core, cma: Nice log-friendly string helpers
       [not found]     ` <1431338443-13216-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-05-11 10:32       ` Or Gerlitz
  2015-05-11 11:24       ` Bart Van Assche
  1 sibling, 0 replies; 6+ messages in thread
From: Or Gerlitz @ 2015-05-11 10:32 UTC (permalink / raw)
  To: Sagi Grimberg
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chuck Lever, Bart Van Assche,
	Doug Ledford, Or Gerlitz, Chien Yen, Sagi Grimberg

On Mon, May 11, 2015 at 1:00 PM, Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> Some of us keep revisiting the code to decode enumerations that
> appear in our logs. Let's borrow the nice logging helpers that
> exists in xprtrdma and rds for CMA events, IB events and WC statuses.
>
> Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/core/cma.c   |   26 ++++++++++++++++
>  drivers/infiniband/core/verbs.c |   61 +++++++++++++++++++++++++++++++++++++++
>  include/rdma/ib_verbs.h         |    4 ++
>  include/rdma/rdma_cm.h          |    2 +
>  4 files changed, 93 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index d570030..1438dde 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -65,6 +65,32 @@ MODULE_LICENSE("Dual BSD/GPL");
>  #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
>  #define CMA_IBOE_PACKET_LIFETIME 18
>
> +static const char *cma_events[] = {
> +       [RDMA_CM_EVENT_ADDR_RESOLVED]   = "ADDR_RESOLVED",
> +       [RDMA_CM_EVENT_ADDR_ERROR]      = "ADDR_ERROR",
> +       [RDMA_CM_EVENT_ROUTE_RESOLVED]  = "ROUTE_RESOLVED",
> +       [RDMA_CM_EVENT_ROUTE_ERROR]     = "ROUTE_ERROR",
> +       [RDMA_CM_EVENT_CONNECT_REQUEST] = "CONNECT_REQUEST",
> +       [RDMA_CM_EVENT_CONNECT_RESPONSE]= "CONNECT_RESPONSE",
> +       [RDMA_CM_EVENT_CONNECT_ERROR]   = "CONNECT_ERROR",
> +       [RDMA_CM_EVENT_UNREACHABLE]     = "UNREACHABLE",
> +       [RDMA_CM_EVENT_REJECTED]        = "REJECTED",
> +       [RDMA_CM_EVENT_ESTABLISHED]     = "ESTABLISHED",
> +       [RDMA_CM_EVENT_DISCONNECTED]    = "DISCONNECTED",
> +       [RDMA_CM_EVENT_DEVICE_REMOVAL]  = "DEVICE_REMOVAL",
> +       [RDMA_CM_EVENT_MULTICAST_JOIN]  = "MULTICAST_JOIN",
> +       [RDMA_CM_EVENT_MULTICAST_ERROR] = "MULTICAST_ERROR",
> +       [RDMA_CM_EVENT_ADDR_CHANGE]     = "ADDR_CHANGE",
> +       [RDMA_CM_EVENT_TIMEWAIT_EXIT]   = "TIMEWAIT_EXIT",
> +};
> +
> +__attribute_const__ const char *cma_event_msg(enum rdma_cm_event_type event)
> +{
> +       return event < ARRAY_SIZE(cma_events) ?
> +                       cma_events[event] : "UNRECOGNIZED_EVENT";
> +}
> +EXPORT_SYMBOL(cma_event_msg);

I think rdma_ prefix has better fit here, e.g aligns with the rest of
the rdma_cm API
so rdma_event_msg

> +
>  static void cma_add_one(struct ib_device *device);
>  static void cma_remove_one(struct ib_device *device);
>
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index f93eb8d..0cdf1b6 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -48,6 +48,67 @@
>
>  #include "core_priv.h"
>
> +static const char *ib_events[] = {
> +       [IB_EVENT_CQ_ERR]               = "CQ_ERR",
> +       [IB_EVENT_QP_FATAL]             = "QP_FATAL",
> +       [IB_EVENT_QP_REQ_ERR]           = "QP_REQ_ERR",
> +       [IB_EVENT_QP_ACCESS_ERR]        = "QP_ACCESS_ERR",
> +       [IB_EVENT_COMM_EST]             = "COMM_EST",
> +       [IB_EVENT_SQ_DRAINED]           = "SQ_DRAINED",
> +       [IB_EVENT_PATH_MIG]             = "PATH_MIG",
> +       [IB_EVENT_PATH_MIG_ERR]         = "PATH_MIG_ERR",
> +       [IB_EVENT_DEVICE_FATAL]         = "DEVICE_FATAL",
> +       [IB_EVENT_PORT_ACTIVE]          = "PORT_ACTIVE",
> +       [IB_EVENT_PORT_ERR]             = "PORT_ERR",
> +       [IB_EVENT_LID_CHANGE]           = "LID_CHANGE",
> +       [IB_EVENT_PKEY_CHANGE]          = "PKEY_CHANGE",
> +       [IB_EVENT_SM_CHANGE]            = "SM_CHANGE",
> +       [IB_EVENT_SRQ_ERR]              = "SRQ_ERR",
> +       [IB_EVENT_SRQ_LIMIT_REACHED]    = "SRQ_LIMIT_REACHED",
> +       [IB_EVENT_QP_LAST_WQE_REACHED]  = "QP_LAST_WQE_REACHED",
> +       [IB_EVENT_CLIENT_REREGISTER]    = "CLIENT_REREGISTER",
> +       [IB_EVENT_GID_CHANGE]           = "GID_CHANGE",
> +};
> +
> +__attribute_const__ const char *ib_event_msg(enum ib_event_type event)
> +{
> +       return event < ARRAY_SIZE(ib_events) ?
> +                       ib_events[event] : "UNRECOGNIZED_EVENT";
> +}
> +EXPORT_SYMBOL(ib_event_msg);


> +
> +static const char *wc_statuses[] = {
> +       [IB_WC_SUCCESS]                 = "SUCCESS",
> +       [IB_WC_LOC_LEN_ERR]             = "LOC_LEN_ERR",
> +       [IB_WC_LOC_QP_OP_ERR]           = "LOC_QP_OP_ERR",
> +       [IB_WC_LOC_EEC_OP_ERR]          = "LOC_EEC_OP_ERR",
> +       [IB_WC_LOC_PROT_ERR]            = "LOC_PROT_ERR",
> +       [IB_WC_WR_FLUSH_ERR]            = "WR_FLUSH_ERR",
> +       [IB_WC_MW_BIND_ERR]             = "MW_BIND_ERR",
> +       [IB_WC_BAD_RESP_ERR]            = "BAD_RESP_ERR",
> +       [IB_WC_LOC_ACCESS_ERR]          = "LOC_ACCESS_ERR",
> +       [IB_WC_REM_INV_REQ_ERR]         = "REM_INV_REQ_ERR",
> +       [IB_WC_REM_ACCESS_ERR]          = "REM_ACCESS_ERR",
> +       [IB_WC_REM_OP_ERR]              = "REM_OP_ERR",
> +       [IB_WC_RETRY_EXC_ERR]           = "RETRY_EXC_ERR",
> +       [IB_WC_RNR_RETRY_EXC_ERR]       = "RNR_RETRY_EXC_ERR",
> +       [IB_WC_LOC_RDD_VIOL_ERR]        = "LOC_RDD_VIOL_ERR",
> +       [IB_WC_REM_INV_RD_REQ_ERR]      = "REM_INV_RD_REQ_ERR",
> +       [IB_WC_REM_ABORT_ERR]           = "REM_ABORT_ERR",
> +       [IB_WC_INV_EECN_ERR]            = "INV_EECN_ERR",
> +       [IB_WC_INV_EEC_STATE_ERR]       = "INV_EEC_STATE_ERR",
> +       [IB_WC_FATAL_ERR]               = "FATAL_ERR",
> +       [IB_WC_RESP_TIMEOUT_ERR]        = "RESP_TIMEOUT_ERR",
> +       [IB_WC_GENERAL_ERR]             = "GENERAL_ERR",
> +};
> +
> +__attribute_const__ const char *wc_status_msg(enum ib_wc_status status)
> +{
> +       return status < ARRAY_SIZE(wc_statuses) ?
> +                       wc_statuses[status] : "UNRECOGNIZED_STATUS";
> +}
> +EXPORT_SYMBOL(wc_status_msg);

same here, ib_ prefix has nice fit here, e.g aligns with the rest of
the verbs API
so ib_wc_status_msg
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] IB/core, cma: Nice log-friendly string helpers
       [not found]     ` <1431338443-13216-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2015-05-11 10:32       ` Or Gerlitz
@ 2015-05-11 11:24       ` Bart Van Assche
  1 sibling, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2015-05-11 11:24 UTC (permalink / raw)
  To: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Chuck Lever, Doug Ledford, Or Gerlitz, Chien Yen, Sagi Grimberg

On 05/11/15 12:00, Sagi Grimberg wrote:
> +__attribute_const__ const char *cma_event_msg(enum rdma_cm_event_type event)
> +{
> +	return event < ARRAY_SIZE(cma_events) ?
> +			cma_events[event] : "UNRECOGNIZED_EVENT";
> +}

Please cast "event" to an unsigned type before comparing it with the 
array size such that passing a negative value to this function or any 
similar function doesn't cause havoc.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] ulps: Align several ULPs to use core/rdma_cm new logging helpers
       [not found]     ` <1431338443-13216-3-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-05-11 11:26       ` Bart Van Assche
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2015-05-11 11:26 UTC (permalink / raw)
  To: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Chuck Lever, Doug Ledford, Or Gerlitz, Chien Yen, Sagi Grimberg

On 05/11/15 12:00, Sagi Grimberg wrote:
> Remove rds & xprtrdma specific helpers and have them and
> srp, iser, isert use the generic helpers.

The SRP changes in this patch look fine to me (with or without the 
renaming proposed by Or) so if you want you can add:

Reviewed-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-11 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 10:00 Generic logging helpers Sagi Grimberg
     [not found] ` <1431338443-13216-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-11 10:00   ` [PATCH v1 1/2] IB/core, cma: Nice log-friendly string helpers Sagi Grimberg
     [not found]     ` <1431338443-13216-2-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-11 10:32       ` Or Gerlitz
2015-05-11 11:24       ` Bart Van Assche
2015-05-11 10:00   ` [PATCH v1 2/2] ulps: Align several ULPs to use core/rdma_cm new logging helpers Sagi Grimberg
     [not found]     ` <1431338443-13216-3-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-11 11:26       ` Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.