]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
RDS/IB: print string constants in more places
authorZach Brown <zach.brown@oracle.com>
Tue, 3 Aug 2010 20:52:47 +0000 (13:52 -0700)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 13 Oct 2015 15:44:09 +0000 (08:44 -0700)
This prints the constant identifier for work completion status and rdma
cm event types, like we already do for IB event types.

A core string array helper is added that each string type uses.

Note: The following is the original commit in uek prior to the big uek2
ofed blob patch.

    commit 59f740a6aeb2cde2f79fe0df38262d4c1ef35cd8

Orabug 21314268

Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Qing Huang <qing.huang@oracle.com>
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
net/rds/af_rds.c
net/rds/ib.h
net/rds/ib_cm.c
net/rds/ib_recv.c
net/rds/ib_send.c
net/rds/rdma_transport.c
net/rds/rds.h

index 85342de1c8336761ebb048a657cbb4e340ccbf50..bf307eadee0bce7a455c767544de85ef9905a9d1 100644 (file)
@@ -57,6 +57,15 @@ MODULE_PARM_DESC(rds_qos_threshold_action,
 
 static unsigned long rds_qos_threshold_tbl[256];
 
+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;
index 476efc726eea21989a56781e81978a69a17e40f9..bbbff80ee9afc9250b24b8718379b3ad0e4b88b4 100644 (file)
@@ -648,6 +648,7 @@ 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);
index 153d603447308ac7899bc91f2b1164fd614dbc7b..46bdb5cf670028f1db76259e75dfb54d2c3e3741 100644 (file)
@@ -41,7 +41,8 @@
 #include "tcp.h"
 
 static char *rds_ib_event_type_strings[] = {
-#define RDS_IB_EVENT_STRING(foo)[IB_EVENT_##foo] = __stringify(foo)
+#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),
@@ -60,16 +61,14 @@ static char *rds_ib_event_type_strings[] = {
        RDS_IB_EVENT_STRING(SRQ_LIMIT_REACHED),
        RDS_IB_EVENT_STRING(QP_LAST_WQE_REACHED),
        RDS_IB_EVENT_STRING(CLIENT_REREGISTER),
+       RDS_IB_EVENT_STRING(GID_CHANGE),
 #undef RDS_IB_EVENT_STRING
 };
 
 static char *rds_ib_event_str(enum ib_event_type type)
 {
-       if (type < ARRAY_SIZE(rds_ib_event_type_strings) &&
-           rds_ib_event_type_strings[type])
-               return rds_ib_event_type_strings[type];
-       else
-               return "unknown";
+       return rds_str_array(rds_ib_event_type_strings,
+                            ARRAY_SIZE(rds_ib_event_type_strings), type);
 };
 
 /*
index 5c87e7653d8b682cd06d5844451a6e4790141e51..9343810aeb06b03e9032235be080fa9884e0da4c 100644 (file)
@@ -1252,8 +1252,9 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic,
        struct rds_ib_recv_work *recv;
        struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
 
-       rdsdebug("wc wr_id 0x%llx status %u byte_len %u imm_data %u\n",
-                (unsigned long long)wc->wr_id, wc->status, wc->byte_len,
+       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,
                 be32_to_cpu(wc->ex.imm_data));
 
        rds_ib_stats_inc(s_ib_rx_cq_event);
@@ -1273,7 +1274,7 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic,
                        rds_ib_process_recv(conn, recv, wc->byte_len, state);
        } else {
                /* We expect errors as the qp is drained during shutdown */
-               if (rds_conn_up(conn) || rds_conn_connecting(conn))
+               if (rds_conn_up(conn) || rds_conn_connecting(conn)) {
                        rds_ib_conn_error(conn, "recv completion "
                                        "<%pI4,%pI4,%d> had "
                                        "status %u, disconnecting and "
@@ -1282,6 +1283,9 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic,
                                        &conn->c_faddr,
                                        conn->c_tos,
                                        wc->status);
+                       rds_rtd(RDS_RTD_ERR, "status %u => %s\n", wc->status,
+                               rds_ib_wc_status_str(wc->status));
+               }
        }
 
        /*
index b79e4581502edcd144183494e7dcf66070d64c8d..749e8d88ed993e52858e6ef1e04768191fa7831f 100644 (file)
 #include "ib.h"
 #include "tcp.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.
@@ -256,8 +290,9 @@ void rds_ib_send_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc)
        u32 i = 0;
        int nr_sig = 0;
 
-       rdsdebug("wc wr_id 0x%llx status %u byte_len %u imm_data %u\n",
-                (unsigned long long)wc->wr_id, wc->status, wc->byte_len,
+       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,
                 be32_to_cpu(wc->ex.imm_data));
 
        rds_ib_stats_inc(s_ib_tx_cq_event);
@@ -312,6 +347,8 @@ void rds_ib_send_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc)
                        NIPQUAD(conn->c_laddr),
                        NIPQUAD(conn->c_faddr),
                        conn->c_tos, wc->status, wc->vendor_err);
+               rds_rtd(RDS_RTD_ERR, "status %u => %s\n", wc->status,
+                       rds_ib_wc_status_str(wc->status));
        } else
                ic->i_last_migration = 0;
 }
index bd2cfba0765ec329887921a4f30e1cb104b67c23..e8c175d14d7eaabc9a2903c8098040b12fb8fd7e 100644 (file)
@@ -52,6 +52,40 @@ MODULE_PARM_DESC(module_unload_allowed, "Allow this module to be unloaded or not
 
 int rds_rdma_resolve_to_ms[] = {1000, 1000, 2000, 4000, 5000};
 
+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),
+#if RDMA_RDS_APM_SUPPORTED
+       RDS_CM_EVENT_STRING(ALT_ROUTE_RESOLVED),
+       RDS_CM_EVENT_STRING(ALT_ROUTE_ERROR),
+       RDS_CM_EVENT_STRING(LOAD_ALT_PATH),
+       RDS_CM_EVENT_STRING(ALT_PATH_LOADED),
+#endif
+#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)
 {
@@ -64,8 +98,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
        int ret = 0;
        int *err;
 
-       rdsdebug("conn %p id %p handling event %u\n", conn, cm_id,
-                event->event);
+       rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id,
+                event->event, rds_cm_event_str(event->event));
 
        if (cm_id->device->node_type == RDMA_NODE_RNIC)
                trans = &rds_iw_transport;
@@ -336,7 +370,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
 
        default:
                /* things like device disconnect? */
-               printk(KERN_ERR "RDS: unknown event %u!\n", event->event);
+               pr_err("RDS: unknown event %u (%s)!\n", event->event,
+                      rds_cm_event_str(event->event));
                break;
        }
 
@@ -344,7 +379,8 @@ out:
        if (conn)
                mutex_unlock(&conn->c_cm_lock);
 
-       rdsdebug("id %p event %u handling ret %d\n", cm_id, event->event, ret);
+       rdsdebug("id %p event %u (%s) handling ret %d\n", cm_id, event->event,
+                rds_cm_event_str(event->event), ret);
 
        return ret;
 }
index 348324f89cd04618e638af48d586357163fe7f38..78f628143bc643f00f668cca47e8640a3e7df2d8 100644 (file)
@@ -657,6 +657,7 @@ 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);