Browse Source

[infiniband] Use connection's local ID as debug message identifier

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
8336186564
2 changed files with 33 additions and 25 deletions
  1. 31
    25
      src/net/infiniband/ib_cm.c
  2. 2
    0
      src/net/infiniband/ib_cmrc.c

+ 31
- 25
src/net/infiniband/ib_cm.c View File

86
 	mad.hdr.attr_id = htons ( IB_CM_ATTR_READY_TO_USE );
86
 	mad.hdr.attr_id = htons ( IB_CM_ATTR_READY_TO_USE );
87
 	rtu->local_id = htonl ( local_id );
87
 	rtu->local_id = htonl ( local_id );
88
 	rtu->remote_id = htonl ( remote_id );
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
 		return rc;
92
 		return rc;
92
 	}
93
 	}
93
 
94
 
125
 			/* Ignore errors; the remote end will retry */
126
 			/* Ignore errors; the remote end will retry */
126
 		}
127
 		}
127
 	} else {
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
 	mad.hdr.attr_id = htons ( IB_CM_ATTR_DISCONNECT_REPLY );
156
 	mad.hdr.attr_id = htons ( IB_CM_ATTR_DISCONNECT_REPLY );
156
 	drep->local_id = htonl ( local_id );
157
 	drep->local_id = htonl ( local_id );
157
 	drep->remote_id = htonl ( remote_id );
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
 		return rc;
162
 		return rc;
161
 	}
163
 	}
162
 
164
 
191
 				    &dreq->private_data,
193
 				    &dreq->private_data,
192
 				    sizeof ( dreq->private_data ) );
194
 				    sizeof ( dreq->private_data ) );
193
 	} else {
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
 	/* Send reply */
199
 	/* Send reply */
256
 	struct ib_cm_common *common = &mad->cm.cm_data.common;
258
 	struct ib_cm_common *common = &mad->cm.cm_data.common;
257
 	struct ib_cm_connect_reply *rep = &mad->cm.cm_data.connect_reply;
259
 	struct ib_cm_connect_reply *rep = &mad->cm.cm_data.connect_reply;
258
 	struct ib_cm_connect_reject *rej = &mad->cm.cm_data.connect_reject;
260
 	struct ib_cm_connect_reject *rej = &mad->cm.cm_data.connect_reject;
261
+	uint32_t local_id = conn->local_id;
259
 	void *private_data = NULL;
262
 	void *private_data = NULL;
260
 	size_t private_data_len = 0;
263
 	size_t private_data_len = 0;
261
 
264
 
263
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
266
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
264
 		rc = -EIO;
267
 		rc = -EIO;
265
 	if ( rc != 0 ) {
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
 		goto out;
271
 		goto out;
269
 	}
272
 	}
270
 
273
 
280
 		qp->send.psn = ( ntohl ( rep->starting_psn ) >> 8 );
283
 		qp->send.psn = ( ntohl ( rep->starting_psn ) >> 8 );
281
 		private_data = &rep->private_data;
284
 		private_data = &rep->private_data;
282
 		private_data_len = sizeof ( rep->private_data );
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
 		/* Modify queue pair */
289
 		/* Modify queue pair */
287
 		if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
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
 			goto out;
293
 			goto out;
291
 		}
294
 		}
292
 
295
 
300
 
303
 
301
 	case htons ( IB_CM_ATTR_CONNECT_REJECT ) :
304
 	case htons ( IB_CM_ATTR_CONNECT_REJECT ) :
302
 		/* Extract fields */
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
 		/* Private data is valid only for a Consumer Reject */
308
 		/* Private data is valid only for a Consumer Reject */
306
 		if ( rej->reason == htons ( IB_CM_REJECT_CONSUMER ) ) {
309
 		if ( rej->reason == htons ( IB_CM_REJECT_CONSUMER ) ) {
307
 			private_data = &rej->private_data;
310
 			private_data = &rej->private_data;
311
 		break;
314
 		break;
312
 
315
 
313
 	default:
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
 		rc = -ENOTSUP;
319
 		rc = -ENOTSUP;
317
 		break;
320
 		break;
318
 	}
321
 	}
347
 	struct ib_queue_pair *qp = conn->qp;
350
 	struct ib_queue_pair *qp = conn->qp;
348
 	union ib_mad mad;
351
 	union ib_mad mad;
349
 	struct ib_cm_connect_request *req = &mad.cm.cm_data.connect_request;
352
 	struct ib_cm_connect_request *req = &mad.cm.cm_data.connect_request;
353
+	uint32_t local_id = conn->local_id;
350
 	size_t private_data_len;
354
 	size_t private_data_len;
351
 
355
 
352
 	/* Report failures */
356
 	/* Report failures */
353
 	if ( rc != 0 ) {
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
 		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
360
 		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
357
 		goto out;
361
 		goto out;
358
 	}
362
 	}
405
 	conn->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, av,
409
 	conn->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, av,
406
 				      &ib_cm_req_op );
410
 				      &ib_cm_req_op );
407
 	if ( ! conn->madx ) {
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
 		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
414
 		conn->op->changed ( ibdev, qp, conn, rc, NULL, 0 );
411
 		goto out;
415
 		goto out;
412
 	}
416
 	}
441
 		 void *private_data, size_t private_data_len,
445
 		 void *private_data, size_t private_data_len,
442
 		 struct ib_connection_operations *op ) {
446
 		 struct ib_connection_operations *op ) {
443
 	struct ib_connection *conn;
447
 	struct ib_connection *conn;
448
+	uint32_t local_id;
444
 
449
 
445
 	/* Allocate and initialise request */
450
 	/* Allocate and initialise request */
446
 	conn = zalloc ( sizeof ( *conn ) + private_data_len );
451
 	conn = zalloc ( sizeof ( *conn ) + private_data_len );
451
 	memset ( &qp->av, 0, sizeof ( qp->av ) );
456
 	memset ( &qp->av, 0, sizeof ( qp->av ) );
452
 	qp->av.gid_present = 1;
457
 	qp->av.gid_present = 1;
453
 	memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
458
 	memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
454
-	conn->local_id = random();
459
+	conn->local_id = local_id = random();
455
 	memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
460
 	memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
456
 	conn->op = op;
461
 	conn->op = op;
457
 	conn->private_data_len = private_data_len;
462
 	conn->private_data_len = private_data_len;
466
 	/* Add to list of connections */
471
 	/* Add to list of connections */
467
 	list_add ( &conn->list, &ib_cm_conns );
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
 	return conn;
480
 	return conn;
475
 
481
 

+ 2
- 0
src/net/infiniband/ib_cmrc.c View File

303
 			rc = -ENOMEM;
303
 			rc = -ENOMEM;
304
 			goto out;
304
 			goto out;
305
 		}
305
 		}
306
+		DBGC ( cmrc, "CMRC %p using CM %08x\n",
307
+		       cmrc, cmrc->conn->local_id );
306
 
308
 
307
 	} else {
309
 	} else {
308
 
310
 

Loading…
Cancel
Save