Skip to content

Commit 119bf81

Browse files
Daniel Jurgensjgunthorpe
authored andcommitted
IB/cm: Add debug prints to ib_cm
Add debug prints to the error paths in the connection manager control flows, to help debug connection management problems. Signed-off-by: Daniel Jurgens <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 8b00914 commit 119bf81

File tree

1 file changed

+51
-0
lines changed
  • drivers/infiniband/core

1 file changed

+51
-0
lines changed

drivers/infiniband/core/cm.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,6 +1875,8 @@ static int cm_req_handler(struct cm_work *work)
18751875

18761876
listen_cm_id_priv = cm_match_req(work, cm_id_priv);
18771877
if (!listen_cm_id_priv) {
1878+
pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__,
1879+
be32_to_cpu(cm_id->local_id));
18781880
ret = -EINVAL;
18791881
goto free_timeinfo;
18801882
}
@@ -2032,6 +2034,8 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id,
20322034
spin_lock_irqsave(&cm_id_priv->lock, flags);
20332035
if (cm_id->state != IB_CM_REQ_RCVD &&
20342036
cm_id->state != IB_CM_MRA_REQ_SENT) {
2037+
pr_debug("%s: local_comm_id %d, cm_id->state: %d\n", __func__,
2038+
be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
20352039
ret = -EINVAL;
20362040
goto out;
20372041
}
@@ -2098,6 +2102,8 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_id,
20982102
spin_lock_irqsave(&cm_id_priv->lock, flags);
20992103
if (cm_id->state != IB_CM_REP_RCVD &&
21002104
cm_id->state != IB_CM_MRA_REP_SENT) {
2105+
pr_debug("%s: local_id %d, cm_id->state %d\n", __func__,
2106+
be32_to_cpu(cm_id->local_id), cm_id->state);
21012107
ret = -EINVAL;
21022108
goto error;
21032109
}
@@ -2205,6 +2211,8 @@ static int cm_rep_handler(struct cm_work *work)
22052211
cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0);
22062212
if (!cm_id_priv) {
22072213
cm_dup_rep_handler(work);
2214+
pr_debug("%s: remote_comm_id %d, no cm_id_priv\n", __func__,
2215+
be32_to_cpu(rep_msg->remote_comm_id));
22082216
return -EINVAL;
22092217
}
22102218

@@ -2218,6 +2226,10 @@ static int cm_rep_handler(struct cm_work *work)
22182226
default:
22192227
spin_unlock_irq(&cm_id_priv->lock);
22202228
ret = -EINVAL;
2229+
pr_debug("%s: cm_id_priv->id.state: %d, local_comm_id %d, remote_comm_id %d\n",
2230+
__func__, cm_id_priv->id.state,
2231+
be32_to_cpu(rep_msg->local_comm_id),
2232+
be32_to_cpu(rep_msg->remote_comm_id));
22212233
goto error;
22222234
}
22232235

@@ -2231,6 +2243,8 @@ static int cm_rep_handler(struct cm_work *work)
22312243
spin_unlock(&cm.lock);
22322244
spin_unlock_irq(&cm_id_priv->lock);
22332245
ret = -EINVAL;
2246+
pr_debug("%s: Failed to insert remote id %d\n", __func__,
2247+
be32_to_cpu(rep_msg->remote_comm_id));
22342248
goto error;
22352249
}
22362250
/* Check for a stale connection. */
@@ -2248,6 +2262,10 @@ static int cm_rep_handler(struct cm_work *work)
22482262
IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP,
22492263
NULL, 0);
22502264
ret = -EINVAL;
2265+
pr_debug("%s: Stale connection. local_comm_id %d, remote_comm_id %d\n",
2266+
__func__, be32_to_cpu(rep_msg->local_comm_id),
2267+
be32_to_cpu(rep_msg->remote_comm_id));
2268+
22512269
if (cur_cm_id_priv) {
22522270
cm_id = &cur_cm_id_priv->id;
22532271
ib_send_cm_dreq(cm_id, NULL, 0);
@@ -2394,6 +2412,8 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_id,
23942412
cm_id_priv = container_of(cm_id, struct cm_id_private, id);
23952413
spin_lock_irqsave(&cm_id_priv->lock, flags);
23962414
if (cm_id->state != IB_CM_ESTABLISHED) {
2415+
pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
2416+
be32_to_cpu(cm_id->local_id), cm_id->state);
23972417
ret = -EINVAL;
23982418
goto out;
23992419
}
@@ -2463,6 +2483,8 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id,
24632483
if (cm_id->state != IB_CM_DREQ_RCVD) {
24642484
spin_unlock_irqrestore(&cm_id_priv->lock, flags);
24652485
kfree(data);
2486+
pr_debug("%s: local_id %d, cm_idcm_id->state(%d) != IB_CM_DREQ_RCVD\n",
2487+
__func__, be32_to_cpu(cm_id->local_id), cm_id->state);
24662488
return -EINVAL;
24672489
}
24682490

@@ -2528,6 +2550,9 @@ static int cm_dreq_handler(struct cm_work *work)
25282550
atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
25292551
counter[CM_DREQ_COUNTER]);
25302552
cm_issue_drep(work->port, work->mad_recv_wc);
2553+
pr_debug("%s: no cm_id_priv, local_comm_id %d, remote_comm_id %d\n",
2554+
__func__, be32_to_cpu(dreq_msg->local_comm_id),
2555+
be32_to_cpu(dreq_msg->remote_comm_id));
25312556
return -EINVAL;
25322557
}
25332558

@@ -2570,6 +2595,9 @@ static int cm_dreq_handler(struct cm_work *work)
25702595
counter[CM_DREQ_COUNTER]);
25712596
goto unlock;
25722597
default:
2598+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
2599+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
2600+
cm_id_priv->id.state);
25732601
goto unlock;
25742602
}
25752603
cm_id_priv->id.state = IB_CM_DREQ_RCVD;
@@ -2673,6 +2701,8 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id,
26732701
cm_enter_timewait(cm_id_priv);
26742702
break;
26752703
default:
2704+
pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
2705+
be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
26762706
ret = -EINVAL;
26772707
goto out;
26782708
}
@@ -2783,6 +2813,9 @@ static int cm_rej_handler(struct cm_work *work)
27832813
/* fall through */
27842814
default:
27852815
spin_unlock_irq(&cm_id_priv->lock);
2816+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
2817+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
2818+
cm_id_priv->id.state);
27862819
ret = -EINVAL;
27872820
goto out;
27882821
}
@@ -2846,6 +2879,9 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id,
28462879
}
28472880
/* fall through */
28482881
default:
2882+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
2883+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
2884+
cm_id_priv->id.state);
28492885
ret = -EINVAL;
28502886
goto error1;
28512887
}
@@ -2947,6 +2983,9 @@ static int cm_mra_handler(struct cm_work *work)
29472983
counter[CM_MRA_COUNTER]);
29482984
/* fall through */
29492985
default:
2986+
pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
2987+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
2988+
cm_id_priv->id.state);
29502989
goto out;
29512990
}
29522991

@@ -3727,6 +3766,7 @@ static void cm_work_handler(struct work_struct *_work)
37273766
ret = cm_timewait_handler(work);
37283767
break;
37293768
default:
3769+
pr_debug("cm_event.event: 0x%x\n", work->cm_event.event);
37303770
ret = -EINVAL;
37313771
break;
37323772
}
@@ -3762,6 +3802,8 @@ static int cm_establish(struct ib_cm_id *cm_id)
37623802
ret = -EISCONN;
37633803
break;
37643804
default:
3805+
pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
3806+
be32_to_cpu(cm_id->local_id), cm_id->state);
37653807
ret = -EINVAL;
37663808
break;
37673809
}
@@ -3959,6 +4001,9 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
39594001
ret = 0;
39604002
break;
39614003
default:
4004+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
4005+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
4006+
cm_id_priv->id.state);
39624007
ret = -EINVAL;
39634008
break;
39644009
}
@@ -4006,6 +4051,9 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv,
40064051
ret = 0;
40074052
break;
40084053
default:
4054+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
4055+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
4056+
cm_id_priv->id.state);
40094057
ret = -EINVAL;
40104058
break;
40114059
}
@@ -4065,6 +4113,9 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv,
40654113
ret = 0;
40664114
break;
40674115
default:
4116+
pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
4117+
__func__, be32_to_cpu(cm_id_priv->id.local_id),
4118+
cm_id_priv->id.state);
40684119
ret = -EINVAL;
40694120
break;
40704121
}

0 commit comments

Comments
 (0)