diff options
author | Zach Brown <zach.brown@oracle.com> | 2010-08-03 16:52:47 -0400 |
---|---|---|
committer | Andy Grover <andy.grover@oracle.com> | 2010-09-08 21:16:50 -0400 |
commit | 59f740a6aeb2cde2f79fe0df38262d4c1ef35cd8 (patch) | |
tree | e05c12cc5c8892bcca3928deb62121b1ee4cedd0 /net/rds/rdma_transport.c | |
parent | 4518071ac1bcb76c64a55a3fddb39fb3d39add41 (diff) |
RDS/IB: print string constants in more places
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.
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Diffstat (limited to 'net/rds/rdma_transport.c')
-rw-r--r-- | net/rds/rdma_transport.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c index 550d34837fe7..e6ed10aee190 100644 --- a/net/rds/rdma_transport.c +++ b/net/rds/rdma_transport.c | |||
@@ -36,6 +36,34 @@ | |||
36 | 36 | ||
37 | static struct rdma_cm_id *rds_rdma_listen_id; | 37 | static struct rdma_cm_id *rds_rdma_listen_id; |
38 | 38 | ||
39 | static char *rds_cm_event_strings[] = { | ||
40 | #define RDS_CM_EVENT_STRING(foo) \ | ||
41 | [RDMA_CM_EVENT_##foo] = __stringify(RDMA_CM_EVENT_##foo) | ||
42 | RDS_CM_EVENT_STRING(ADDR_RESOLVED), | ||
43 | RDS_CM_EVENT_STRING(ADDR_ERROR), | ||
44 | RDS_CM_EVENT_STRING(ROUTE_RESOLVED), | ||
45 | RDS_CM_EVENT_STRING(ROUTE_ERROR), | ||
46 | RDS_CM_EVENT_STRING(CONNECT_REQUEST), | ||
47 | RDS_CM_EVENT_STRING(CONNECT_RESPONSE), | ||
48 | RDS_CM_EVENT_STRING(CONNECT_ERROR), | ||
49 | RDS_CM_EVENT_STRING(UNREACHABLE), | ||
50 | RDS_CM_EVENT_STRING(REJECTED), | ||
51 | RDS_CM_EVENT_STRING(ESTABLISHED), | ||
52 | RDS_CM_EVENT_STRING(DISCONNECTED), | ||
53 | RDS_CM_EVENT_STRING(DEVICE_REMOVAL), | ||
54 | RDS_CM_EVENT_STRING(MULTICAST_JOIN), | ||
55 | RDS_CM_EVENT_STRING(MULTICAST_ERROR), | ||
56 | RDS_CM_EVENT_STRING(ADDR_CHANGE), | ||
57 | RDS_CM_EVENT_STRING(TIMEWAIT_EXIT), | ||
58 | #undef RDS_CM_EVENT_STRING | ||
59 | }; | ||
60 | |||
61 | static char *rds_cm_event_str(enum rdma_cm_event_type type) | ||
62 | { | ||
63 | return rds_str_array(rds_cm_event_strings, | ||
64 | ARRAY_SIZE(rds_cm_event_strings), type); | ||
65 | }; | ||
66 | |||
39 | int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, | 67 | int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, |
40 | struct rdma_cm_event *event) | 68 | struct rdma_cm_event *event) |
41 | { | 69 | { |
@@ -44,8 +72,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, | |||
44 | struct rds_transport *trans; | 72 | struct rds_transport *trans; |
45 | int ret = 0; | 73 | int ret = 0; |
46 | 74 | ||
47 | rdsdebug("conn %p id %p handling event %u\n", conn, cm_id, | 75 | rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id, |
48 | event->event); | 76 | event->event, rds_cm_event_str(event->event)); |
49 | 77 | ||
50 | if (cm_id->device->node_type == RDMA_NODE_RNIC) | 78 | if (cm_id->device->node_type == RDMA_NODE_RNIC) |
51 | trans = &rds_iw_transport; | 79 | trans = &rds_iw_transport; |
@@ -109,7 +137,8 @@ int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id, | |||
109 | 137 | ||
110 | default: | 138 | default: |
111 | /* things like device disconnect? */ | 139 | /* things like device disconnect? */ |
112 | printk(KERN_ERR "RDS: unknown event %u!\n", event->event); | 140 | printk(KERN_ERR "RDS: unknown event %u (%s)!\n", |
141 | event->event, rds_cm_event_str(event->event)); | ||
113 | break; | 142 | break; |
114 | } | 143 | } |
115 | 144 | ||
@@ -117,7 +146,8 @@ out: | |||
117 | if (conn) | 146 | if (conn) |
118 | mutex_unlock(&conn->c_cm_lock); | 147 | mutex_unlock(&conn->c_cm_lock); |
119 | 148 | ||
120 | rdsdebug("id %p event %u handling ret %d\n", cm_id, event->event, ret); | 149 | rdsdebug("id %p event %u (%s) handling ret %d\n", cm_id, event->event, |
150 | rds_cm_event_str(event->event), ret); | ||
121 | 151 | ||
122 | return ret; | 152 | return ret; |
123 | } | 153 | } |