|  | @@ -86,8 +86,9 @@ static int ib_cm_send_rtu ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 86 | 86 |  	mad.hdr.attr_id = htons ( IB_CM_ATTR_READY_TO_USE );
 | 
		
	
		
			
			| 87 | 87 |  	rtu->local_id = htonl ( local_id );
 | 
		
	
		
			
			| 88 | 88 |  	rtu->remote_id = htonl ( remote_id );
 | 
		
	
		
			
			| 89 |  | -	if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ){
 | 
		
	
		
			
			| 90 |  | -		DBG ( "CM could not send RTU: %s\n", strerror ( rc ) );
 | 
		
	
		
			
			|  | 89 | +	if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ) {
 | 
		
	
		
			
			|  | 90 | +		DBGC ( local_id, "CM %08x could not send RTU: %s\n",
 | 
		
	
		
			
			|  | 91 | +		       local_id, strerror ( rc ) );
 | 
		
	
		
			
			| 91 | 92 |  		return rc;
 | 
		
	
		
			
			| 92 | 93 |  	}
 | 
		
	
		
			
			| 93 | 94 |  
 | 
		
	
	
		
			
			|  | @@ -125,7 +126,7 @@ static void ib_cm_recv_rep ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 125 | 126 |  			/* Ignore errors; the remote end will retry */
 | 
		
	
		
			
			| 126 | 127 |  		}
 | 
		
	
		
			
			| 127 | 128 |  	} else {
 | 
		
	
		
			
			| 128 |  | -		DBG ( "CM unidentified connection %08x\n", local_id );
 | 
		
	
		
			
			|  | 129 | +		DBGC ( local_id, "CM %08x unexpected REP\n", local_id );
 | 
		
	
		
			
			| 129 | 130 |  	}
 | 
		
	
		
			
			| 130 | 131 |  }
 | 
		
	
		
			
			| 131 | 132 |  
 | 
		
	
	
		
			
			|  | @@ -155,8 +156,9 @@ static int ib_cm_send_drep ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 155 | 156 |  	mad.hdr.attr_id = htons ( IB_CM_ATTR_DISCONNECT_REPLY );
 | 
		
	
		
			
			| 156 | 157 |  	drep->local_id = htonl ( local_id );
 | 
		
	
		
			
			| 157 | 158 |  	drep->remote_id = htonl ( remote_id );
 | 
		
	
		
			
			| 158 |  | -	if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ){
 | 
		
	
		
			
			| 159 |  | -		DBG ( "CM could not send DREP: %s\n", strerror ( rc ) );
 | 
		
	
		
			
			|  | 159 | +	if ( ( rc = ib_mi_send ( ibdev, mi, &mad, av ) ) != 0 ) {
 | 
		
	
		
			
			|  | 160 | +		DBGC ( local_id, "CM %08x could not send DREP: %s\n",
 | 
		
	
		
			
			|  | 161 | +		       local_id, strerror ( rc ) );
 | 
		
	
		
			
			| 160 | 162 |  		return rc;
 | 
		
	
		
			
			| 161 | 163 |  	}
 | 
		
	
		
			
			| 162 | 164 |  
 | 
		
	
	
		
			
			|  | @@ -191,7 +193,7 @@ static void ib_cm_recv_dreq ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 191 | 193 |  				    &dreq->private_data,
 | 
		
	
		
			
			| 192 | 194 |  				    sizeof ( dreq->private_data ) );
 | 
		
	
		
			
			| 193 | 195 |  	} else {
 | 
		
	
		
			
			| 194 |  | -		DBG ( "CM unidentified connection %08x\n", local_id );
 | 
		
	
		
			
			|  | 196 | +		DBGC ( local_id, "CM %08x unexpected DREQ\n", local_id );
 | 
		
	
		
			
			| 195 | 197 |  	}
 | 
		
	
		
			
			| 196 | 198 |  
 | 
		
	
		
			
			| 197 | 199 |  	/* Send reply */
 | 
		
	
	
		
			
			|  | @@ -256,6 +258,7 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 256 | 258 |  	struct ib_cm_common *common = &mad->cm.cm_data.common;
 | 
		
	
		
			
			| 257 | 259 |  	struct ib_cm_connect_reply *rep = &mad->cm.cm_data.connect_reply;
 | 
		
	
		
			
			| 258 | 260 |  	struct ib_cm_connect_reject *rej = &mad->cm.cm_data.connect_reject;
 | 
		
	
		
			
			|  | 261 | +	uint32_t local_id = conn->local_id;
 | 
		
	
		
			
			| 259 | 262 |  	void *private_data = NULL;
 | 
		
	
		
			
			| 260 | 263 |  	size_t private_data_len = 0;
 | 
		
	
		
			
			| 261 | 264 |  
 | 
		
	
	
		
			
			|  | @@ -263,8 +266,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 263 | 266 |  	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
 | 
		
	
		
			
			| 264 | 267 |  		rc = -EIO;
 | 
		
	
		
			
			| 265 | 268 |  	if ( rc != 0 ) {
 | 
		
	
		
			
			| 266 |  | -		DBGC ( conn, "CM %p connection request failed: %s\n",
 | 
		
	
		
			
			| 267 |  | -		       conn, strerror ( rc ) );
 | 
		
	
		
			
			|  | 269 | +		DBGC ( local_id, "CM %08x connection request failed: %s\n",
 | 
		
	
		
			
			|  | 270 | +		       local_id, strerror ( rc ) );
 | 
		
	
		
			
			| 268 | 271 |  		goto out;
 | 
		
	
		
			
			| 269 | 272 |  	}
 | 
		
	
		
			
			| 270 | 273 |  
 | 
		
	
	
		
			
			|  | @@ -280,13 +283,13 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 280 | 283 |  		qp->send.psn = ( ntohl ( rep->starting_psn ) >> 8 );
 | 
		
	
		
			
			| 281 | 284 |  		private_data = &rep->private_data;
 | 
		
	
		
			
			| 282 | 285 |  		private_data_len = sizeof ( rep->private_data );
 | 
		
	
		
			
			| 283 |  | -		DBGC ( conn, "CM %p connected to QPN %#lx PSN %#x\n",
 | 
		
	
		
			
			| 284 |  | -		       conn, qp->av.qpn, qp->send.psn );
 | 
		
	
		
			
			|  | 286 | +		DBGC ( local_id, "CM %08x connected to QPN %#lx PSN %#x\n",
 | 
		
	
		
			
			|  | 287 | +		       local_id, qp->av.qpn, qp->send.psn );
 | 
		
	
		
			
			| 285 | 288 |  
 | 
		
	
		
			
			| 286 | 289 |  		/* Modify queue pair */
 | 
		
	
		
			
			| 287 | 290 |  		if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
 | 
		
	
		
			
			| 288 |  | -			DBGC ( conn, "CM %p could not modify queue pair: %s\n",
 | 
		
	
		
			
			| 289 |  | -			       conn, strerror ( rc ) );
 | 
		
	
		
			
			|  | 291 | +			DBGC ( local_id, "CM %08x could not modify queue "
 | 
		
	
		
			
			|  | 292 | +			       "pair: %s\n", local_id, strerror ( rc ) );
 | 
		
	
		
			
			| 290 | 293 |  			goto out;
 | 
		
	
		
			
			| 291 | 294 |  		}
 | 
		
	
		
			
			| 292 | 295 |  
 | 
		
	
	
		
			
			|  | @@ -300,8 +303,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 300 | 303 |  
 | 
		
	
		
			
			| 301 | 304 |  	case htons ( IB_CM_ATTR_CONNECT_REJECT ) :
 | 
		
	
		
			
			| 302 | 305 |  		/* Extract fields */
 | 
		
	
		
			
			| 303 |  | -		DBGC ( conn, "CM %p connection rejected (reason %d)\n",
 | 
		
	
		
			
			| 304 |  | -		       conn, ntohs ( rej->reason ) );
 | 
		
	
		
			
			|  | 306 | +		DBGC ( local_id, "CM %08x connection rejected (reason %d)\n",
 | 
		
	
		
			
			|  | 307 | +		       local_id, ntohs ( rej->reason ) );
 | 
		
	
		
			
			| 305 | 308 |  		/* Private data is valid only for a Consumer Reject */
 | 
		
	
		
			
			| 306 | 309 |  		if ( rej->reason == htons ( IB_CM_REJECT_CONSUMER ) ) {
 | 
		
	
		
			
			| 307 | 310 |  			private_data = &rej->private_data;
 | 
		
	
	
		
			
			|  | @@ -311,8 +314,8 @@ static void ib_cm_req_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 311 | 314 |  		break;
 | 
		
	
		
			
			| 312 | 315 |  
 | 
		
	
		
			
			| 313 | 316 |  	default:
 | 
		
	
		
			
			| 314 |  | -		DBGC ( conn, "CM %p unexpected response (attribute %04x)\n",
 | 
		
	
		
			
			| 315 |  | -		       conn, ntohs ( mad->hdr.attr_id ) );
 | 
		
	
		
			
			|  | 317 | +		DBGC ( local_id, "CM %08x unexpected response (attribute "
 | 
		
	
		
			
			|  | 318 | +		       "%04x)\n", local_id, ntohs ( mad->hdr.attr_id ) );
 | 
		
	
		
			
			| 316 | 319 |  		rc = -ENOTSUP;
 | 
		
	
		
			
			| 317 | 320 |  		break;
 | 
		
	
		
			
			| 318 | 321 |  	}
 | 
		
	
	
		
			
			|  | @@ -347,12 +350,13 @@ static void ib_cm_path_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 347 | 350 |  	struct ib_queue_pair *qp = conn->qp;
 | 
		
	
		
			
			| 348 | 351 |  	union ib_mad mad;
 | 
		
	
		
			
			| 349 | 352 |  	struct ib_cm_connect_request *req = &mad.cm.cm_data.connect_request;
 | 
		
	
		
			
			|  | 353 | +	uint32_t local_id = conn->local_id;
 | 
		
	
		
			
			| 350 | 354 |  	size_t private_data_len;
 | 
		
	
		
			
			| 351 | 355 |  
 | 
		
	
		
			
			| 352 | 356 |  	/* Report failures */
 | 
		
	
		
			
			| 353 | 357 |  	if ( rc != 0 ) {
 | 
		
	
		
			
			| 354 |  | -		DBGC ( conn, "CM %p path lookup failed: %s\n",
 | 
		
	
		
			
			| 355 |  | -		       conn, strerror ( rc ) );
 | 
		
	
		
			
			|  | 358 | +		DBGC ( local_id, "CM %08x path lookup failed: %s\n",
 | 
		
	
		
			
			|  | 359 | +		       local_id, strerror ( rc ) );
 | 
		
	
		
			
			| 356 | 360 |  		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
 | 
		
	
		
			
			| 357 | 361 |  		goto out;
 | 
		
	
		
			
			| 358 | 362 |  	}
 | 
		
	
	
		
			
			|  | @@ -405,8 +409,8 @@ static void ib_cm_path_complete ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 405 | 409 |  	conn->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, av,
 | 
		
	
		
			
			| 406 | 410 |  				      &ib_cm_req_op );
 | 
		
	
		
			
			| 407 | 411 |  	if ( ! conn->madx ) {
 | 
		
	
		
			
			| 408 |  | -		DBGC ( conn, "CM %p could not create connection request\n",
 | 
		
	
		
			
			| 409 |  | -		       conn );
 | 
		
	
		
			
			|  | 412 | +		DBGC ( local_id, "CM %08x could not create connection "
 | 
		
	
		
			
			|  | 413 | +		       "request\n", local_id );
 | 
		
	
		
			
			| 410 | 414 |  		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
 | 
		
	
		
			
			| 411 | 415 |  		goto out;
 | 
		
	
		
			
			| 412 | 416 |  	}
 | 
		
	
	
		
			
			|  | @@ -441,6 +445,7 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
 | 
		
	
		
			
			| 441 | 445 |  		 void *private_data, size_t private_data_len,
 | 
		
	
		
			
			| 442 | 446 |  		 struct ib_connection_operations *op ) {
 | 
		
	
		
			
			| 443 | 447 |  	struct ib_connection *conn;
 | 
		
	
		
			
			|  | 448 | +	uint32_t local_id;
 | 
		
	
		
			
			| 444 | 449 |  
 | 
		
	
		
			
			| 445 | 450 |  	/* Allocate and initialise request */
 | 
		
	
		
			
			| 446 | 451 |  	conn = zalloc ( sizeof ( *conn ) + private_data_len );
 | 
		
	
	
		
			
			|  | @@ -451,7 +456,7 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
 | 
		
	
		
			
			| 451 | 456 |  	memset ( &qp->av, 0, sizeof ( qp->av ) );
 | 
		
	
		
			
			| 452 | 457 |  	qp->av.gid_present = 1;
 | 
		
	
		
			
			| 453 | 458 |  	memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
 | 
		
	
		
			
			| 454 |  | -	conn->local_id = random();
 | 
		
	
		
			
			|  | 459 | +	conn->local_id = local_id = random();
 | 
		
	
		
			
			| 455 | 460 |  	memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
 | 
		
	
		
			
			| 456 | 461 |  	conn->op = op;
 | 
		
	
		
			
			| 457 | 462 |  	conn->private_data_len = private_data_len;
 | 
		
	
	
		
			
			|  | @@ -466,10 +471,11 @@ ib_create_conn ( struct ib_device *ibdev, struct ib_queue_pair *qp,
 | 
		
	
		
			
			| 466 | 471 |  	/* Add to list of connections */
 | 
		
	
		
			
			| 467 | 472 |  	list_add ( &conn->list, &ib_cm_conns );
 | 
		
	
		
			
			| 468 | 473 |  
 | 
		
	
		
			
			| 469 |  | -	DBGC ( conn, "CM %p created for IBDEV %s QPN %#lx\n",
 | 
		
	
		
			
			| 470 |  | -	       conn, ibdev->name, qp->qpn );
 | 
		
	
		
			
			| 471 |  | -	DBGC ( conn, "CM %p connecting to " IB_GID_FMT " " IB_GUID_FMT "\n",
 | 
		
	
		
			
			| 472 |  | -	       conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
 | 
		
	
		
			
			|  | 474 | +	DBGC ( local_id, "CM %08x created for IBDEV %s QPN %#lx\n",
 | 
		
	
		
			
			|  | 475 | +	       local_id, ibdev->name, qp->qpn );
 | 
		
	
		
			
			|  | 476 | +	DBGC ( local_id, "CM %08x connecting to " IB_GID_FMT " "
 | 
		
	
		
			
			|  | 477 | +	       IB_GUID_FMT "\n", local_id, IB_GID_ARGS ( dgid ),
 | 
		
	
		
			
			|  | 478 | +	       IB_GUID_ARGS ( service_id ) );
 | 
		
	
		
			
			| 473 | 479 |  
 | 
		
	
		
			
			| 474 | 480 |  	return conn;
 | 
		
	
		
			
			| 475 | 481 |  
 |