mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	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 <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
		
							parent
							
								
									8b00914654
								
							
						
					
					
						commit
						119bf81793
					
				
					 1 changed files with 51 additions and 0 deletions
				
			
		|  | @ -1875,6 +1875,8 @@ static int cm_req_handler(struct cm_work *work) | |||
| 
 | ||||
| 	listen_cm_id_priv = cm_match_req(work, cm_id_priv); | ||||
| 	if (!listen_cm_id_priv) { | ||||
| 		pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__, | ||||
| 			 be32_to_cpu(cm_id->local_id)); | ||||
| 		ret = -EINVAL; | ||||
| 		goto free_timeinfo; | ||||
| 	} | ||||
|  | @ -2032,6 +2034,8 @@ int ib_send_cm_rep(struct ib_cm_id *cm_id, | |||
| 	spin_lock_irqsave(&cm_id_priv->lock, flags); | ||||
| 	if (cm_id->state != IB_CM_REQ_RCVD && | ||||
| 	    cm_id->state != IB_CM_MRA_REQ_SENT) { | ||||
| 		pr_debug("%s: local_comm_id %d, cm_id->state: %d\n", __func__, | ||||
| 			 be32_to_cpu(cm_id_priv->id.local_id), cm_id->state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto out; | ||||
| 	} | ||||
|  | @ -2098,6 +2102,8 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_id, | |||
| 	spin_lock_irqsave(&cm_id_priv->lock, flags); | ||||
| 	if (cm_id->state != IB_CM_REP_RCVD && | ||||
| 	    cm_id->state != IB_CM_MRA_REP_SENT) { | ||||
| 		pr_debug("%s: local_id %d, cm_id->state %d\n", __func__, | ||||
| 			 be32_to_cpu(cm_id->local_id), cm_id->state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto error; | ||||
| 	} | ||||
|  | @ -2205,6 +2211,8 @@ static int cm_rep_handler(struct cm_work *work) | |||
| 	cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0); | ||||
| 	if (!cm_id_priv) { | ||||
| 		cm_dup_rep_handler(work); | ||||
| 		pr_debug("%s: remote_comm_id %d, no cm_id_priv\n", __func__, | ||||
| 			 be32_to_cpu(rep_msg->remote_comm_id)); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -2218,6 +2226,10 @@ static int cm_rep_handler(struct cm_work *work) | |||
| 	default: | ||||
| 		spin_unlock_irq(&cm_id_priv->lock); | ||||
| 		ret = -EINVAL; | ||||
| 		pr_debug("%s: cm_id_priv->id.state: %d, local_comm_id %d, remote_comm_id %d\n", | ||||
| 			 __func__, cm_id_priv->id.state, | ||||
| 			 be32_to_cpu(rep_msg->local_comm_id), | ||||
| 			 be32_to_cpu(rep_msg->remote_comm_id)); | ||||
| 		goto error; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -2231,6 +2243,8 @@ static int cm_rep_handler(struct cm_work *work) | |||
| 		spin_unlock(&cm.lock); | ||||
| 		spin_unlock_irq(&cm_id_priv->lock); | ||||
| 		ret = -EINVAL; | ||||
| 		pr_debug("%s: Failed to insert remote id %d\n", __func__, | ||||
| 			 be32_to_cpu(rep_msg->remote_comm_id)); | ||||
| 		goto error; | ||||
| 	} | ||||
| 	/* Check for a stale connection. */ | ||||
|  | @ -2248,6 +2262,10 @@ static int cm_rep_handler(struct cm_work *work) | |||
| 			     IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP, | ||||
| 			     NULL, 0); | ||||
| 		ret = -EINVAL; | ||||
| 		pr_debug("%s: Stale connection. local_comm_id %d, remote_comm_id %d\n", | ||||
| 			 __func__, be32_to_cpu(rep_msg->local_comm_id), | ||||
| 			 be32_to_cpu(rep_msg->remote_comm_id)); | ||||
| 
 | ||||
| 		if (cur_cm_id_priv) { | ||||
| 			cm_id = &cur_cm_id_priv->id; | ||||
| 			ib_send_cm_dreq(cm_id, NULL, 0); | ||||
|  | @ -2394,6 +2412,8 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_id, | |||
| 	cm_id_priv = container_of(cm_id, struct cm_id_private, id); | ||||
| 	spin_lock_irqsave(&cm_id_priv->lock, flags); | ||||
| 	if (cm_id->state != IB_CM_ESTABLISHED) { | ||||
| 		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__, | ||||
| 			 be32_to_cpu(cm_id->local_id), cm_id->state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto out; | ||||
| 	} | ||||
|  | @ -2463,6 +2483,8 @@ int ib_send_cm_drep(struct ib_cm_id *cm_id, | |||
| 	if (cm_id->state != IB_CM_DREQ_RCVD) { | ||||
| 		spin_unlock_irqrestore(&cm_id_priv->lock, flags); | ||||
| 		kfree(data); | ||||
| 		pr_debug("%s: local_id %d, cm_idcm_id->state(%d) != IB_CM_DREQ_RCVD\n", | ||||
| 			 __func__, be32_to_cpu(cm_id->local_id), cm_id->state); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -2528,6 +2550,9 @@ static int cm_dreq_handler(struct cm_work *work) | |||
| 		atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES]. | ||||
| 				counter[CM_DREQ_COUNTER]); | ||||
| 		cm_issue_drep(work->port, work->mad_recv_wc); | ||||
| 		pr_debug("%s: no cm_id_priv, local_comm_id %d, remote_comm_id %d\n", | ||||
| 			 __func__, be32_to_cpu(dreq_msg->local_comm_id), | ||||
| 			 be32_to_cpu(dreq_msg->remote_comm_id)); | ||||
| 		return -EINVAL; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -2570,6 +2595,9 @@ static int cm_dreq_handler(struct cm_work *work) | |||
| 				counter[CM_DREQ_COUNTER]); | ||||
| 		goto unlock; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		goto unlock; | ||||
| 	} | ||||
| 	cm_id_priv->id.state = IB_CM_DREQ_RCVD; | ||||
|  | @ -2673,6 +2701,8 @@ int ib_send_cm_rej(struct ib_cm_id *cm_id, | |||
| 		cm_enter_timewait(cm_id_priv); | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__, | ||||
| 			 be32_to_cpu(cm_id_priv->id.local_id), cm_id->state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto out; | ||||
| 	} | ||||
|  | @ -2783,6 +2813,9 @@ static int cm_rej_handler(struct cm_work *work) | |||
| 		/* fall through */ | ||||
| 	default: | ||||
| 		spin_unlock_irq(&cm_id_priv->lock); | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto out; | ||||
| 	} | ||||
|  | @ -2846,6 +2879,9 @@ int ib_send_cm_mra(struct ib_cm_id *cm_id, | |||
| 		} | ||||
| 		/* fall through */ | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		ret = -EINVAL; | ||||
| 		goto error1; | ||||
| 	} | ||||
|  | @ -2947,6 +2983,9 @@ static int cm_mra_handler(struct cm_work *work) | |||
| 				counter[CM_MRA_COUNTER]); | ||||
| 		/* fall through */ | ||||
| 	default: | ||||
| 		pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		goto out; | ||||
| 	} | ||||
| 
 | ||||
|  | @ -3727,6 +3766,7 @@ static void cm_work_handler(struct work_struct *_work) | |||
| 		ret = cm_timewait_handler(work); | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("cm_event.event: 0x%x\n", work->cm_event.event); | ||||
| 		ret = -EINVAL; | ||||
| 		break; | ||||
| 	} | ||||
|  | @ -3762,6 +3802,8 @@ static int cm_establish(struct ib_cm_id *cm_id) | |||
| 		ret = -EISCONN; | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__, | ||||
| 			 be32_to_cpu(cm_id->local_id), cm_id->state); | ||||
| 		ret = -EINVAL; | ||||
| 		break; | ||||
| 	} | ||||
|  | @ -3959,6 +4001,9 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, | |||
| 		ret = 0; | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		ret = -EINVAL; | ||||
| 		break; | ||||
| 	} | ||||
|  | @ -4006,6 +4051,9 @@ static int cm_init_qp_rtr_attr(struct cm_id_private *cm_id_priv, | |||
| 		ret = 0; | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		ret = -EINVAL; | ||||
| 		break; | ||||
| 	} | ||||
|  | @ -4065,6 +4113,9 @@ static int cm_init_qp_rts_attr(struct cm_id_private *cm_id_priv, | |||
| 		ret = 0; | ||||
| 		break; | ||||
| 	default: | ||||
| 		pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n", | ||||
| 			 __func__, be32_to_cpu(cm_id_priv->id.local_id), | ||||
| 			 cm_id_priv->id.state); | ||||
| 		ret = -EINVAL; | ||||
| 		break; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Daniel Jurgens
						Daniel Jurgens