Skip to content

Commit 498683c

Browse files
monis410dledford
authored andcommitted
IB/cma: Add debug messages to error flows
Print debug messages to the kernel log to add more information about RDMA_CM events that indicate an error. Signed-off-by: Moni Shoua <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent f7534f4 commit 498683c

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

drivers/infiniband/core/cm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,6 +3409,8 @@ static void cm_process_send_error(struct ib_mad_send_buf *msg,
34093409
if (msg != cm_id_priv->msg || state != cm_id_priv->id.state)
34103410
goto discard;
34113411

3412+
pr_debug_ratelimited("CM: failed sending MAD in state %d. (%s)\n",
3413+
state, ib_wc_status_msg(wc_status));
34123414
switch (state) {
34133415
case IB_CM_REQ_SENT:
34143416
case IB_CM_MRA_REQ_RCVD:

drivers/infiniband/core/cma.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,6 +1693,7 @@ static int cma_rep_recv(struct rdma_id_private *id_priv)
16931693

16941694
return 0;
16951695
reject:
1696+
pr_debug_ratelimited("RDMA CM: CONNECT_ERROR: failed to handle reply. status %d\n", ret);
16961697
cma_modify_qp_err(id_priv);
16971698
ib_send_cm_rej(id_priv->cm_id.ib, IB_CM_REJ_CONSUMER_DEFINED,
16981699
NULL, 0, NULL, 0);
@@ -1764,6 +1765,8 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
17641765
/* ignore event */
17651766
goto out;
17661767
case IB_CM_REJ_RECEIVED:
1768+
pr_debug_ratelimited("RDMA CM: REJECTED: %s\n", rdma_reject_msg(&id_priv->id,
1769+
ib_event->param.rej_rcvd.reason));
17671770
cma_modify_qp_err(id_priv);
17681771
event.status = ib_event->param.rej_rcvd.reason;
17691772
event.event = RDMA_CM_EVENT_REJECTED;
@@ -2289,6 +2292,8 @@ static void cma_query_handler(int status, struct ib_sa_path_rec *path_rec,
22892292
work->new_state = RDMA_CM_ADDR_RESOLVED;
22902293
work->event.event = RDMA_CM_EVENT_ROUTE_ERROR;
22912294
work->event.status = status;
2295+
pr_debug_ratelimited("RDMA CM: ROUTE_ERROR: failed to query path. status %d\n",
2296+
status);
22922297
}
22932298

22942299
queue_work(cma_wq, &work->work);
@@ -2724,8 +2729,14 @@ static void addr_handler(int status, struct sockaddr *src_addr,
27242729
goto out;
27252730

27262731
memcpy(cma_src_addr(id_priv), src_addr, rdma_addr_size(src_addr));
2727-
if (!status && !id_priv->cma_dev)
2732+
if (!status && !id_priv->cma_dev) {
27282733
status = cma_acquire_dev(id_priv, NULL);
2734+
if (status)
2735+
pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to acquire device. status %d\n",
2736+
status);
2737+
} else {
2738+
pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to resolve IP. status %d\n", status);
2739+
}
27292740

27302741
if (status) {
27312742
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED,
@@ -3311,10 +3322,13 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id,
33113322
if (rep->status != IB_SIDR_SUCCESS) {
33123323
event.event = RDMA_CM_EVENT_UNREACHABLE;
33133324
event.status = ib_event->param.sidr_rep_rcvd.status;
3325+
pr_debug_ratelimited("RDMA CM: UNREACHABLE: bad SIDR reply. status %d\n",
3326+
event.status);
33143327
break;
33153328
}
33163329
ret = cma_set_qkey(id_priv, rep->qkey);
33173330
if (ret) {
3331+
pr_debug_ratelimited("RDMA CM: ADDR_ERROR: failed to set qkey. status %d\n", ret);
33183332
event.event = RDMA_CM_EVENT_ADDR_ERROR;
33193333
event.status = ret;
33203334
break;
@@ -3763,10 +3777,17 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
37633777

37643778
if (!status)
37653779
status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey));
3780+
else
3781+
pr_debug_ratelimited("RDMA CM: MULTICAST_ERROR: failed to join multicast. status %d\n",
3782+
status);
37663783
mutex_lock(&id_priv->qp_mutex);
3767-
if (!status && id_priv->id.qp)
3784+
if (!status && id_priv->id.qp) {
37683785
status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid,
37693786
be16_to_cpu(multicast->rec.mlid));
3787+
if (!status)
3788+
pr_debug_ratelimited("RDMA CM: MULTICAST_ERROR: failed to attach QP. status %d\n",
3789+
status);
3790+
}
37703791
mutex_unlock(&id_priv->qp_mutex);
37713792

37723793
memset(&event, 0, sizeof event);

0 commit comments

Comments
 (0)