Преглед изворни кода

[infiniband] Assign names to Infiniband devices for debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown пре 8 година
родитељ
комит
d7794dcac7

+ 7
- 0
src/include/ipxe/infiniband.h Прегледај датотеку

388
 				   union ib_mad *mad );
388
 				   union ib_mad *mad );
389
 };
389
 };
390
 
390
 
391
+/** Maximum length of an Infiniband device name */
392
+#define IBDEV_NAME_LEN 8
393
+
391
 /** An Infiniband device */
394
 /** An Infiniband device */
392
 struct ib_device {
395
 struct ib_device {
393
 	/** Reference counter */
396
 	/** Reference counter */
396
 	struct list_head list;
399
 	struct list_head list;
397
 	/** List of open Infiniband devices */
400
 	/** List of open Infiniband devices */
398
 	struct list_head open_list;
401
 	struct list_head open_list;
402
+	/** Index of this Infiniband device */
403
+	unsigned int index;
404
+	/** Name of this Infiniband device */
405
+	char name[IBDEV_NAME_LEN];
399
 	/** Underlying device */
406
 	/** Underlying device */
400
 	struct device *dev;
407
 	struct device *dev;
401
 	/** List of completion queues */
408
 	/** List of completion queues */

+ 69
- 55
src/net/infiniband.c Прегледај датотеку

54
 /** List of open Infiniband devices, in reverse order of opening */
54
 /** List of open Infiniband devices, in reverse order of opening */
55
 static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices );
55
 static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices );
56
 
56
 
57
+/** Infiniband device index */
58
+static unsigned int ibdev_index = 0;
59
+
57
 /** Post send work queue entry profiler */
60
 /** Post send work queue entry profiler */
58
 static struct profiler ib_post_send_profiler __profiler =
61
 static struct profiler ib_post_send_profiler __profiler =
59
 	{ .name = "ib.post_send" };
62
 	{ .name = "ib.post_send" };
97
 	struct ib_completion_queue *cq;
100
 	struct ib_completion_queue *cq;
98
 	int rc;
101
 	int rc;
99
 
102
 
100
-	DBGC ( ibdev, "IBDEV %p creating completion queue\n", ibdev );
103
+	DBGC ( ibdev, "IBDEV %s creating completion queue\n", ibdev->name );
101
 
104
 
102
 	/* Allocate and initialise data structure */
105
 	/* Allocate and initialise data structure */
103
 	cq = zalloc ( sizeof ( *cq ) );
106
 	cq = zalloc ( sizeof ( *cq ) );
111
 
114
 
112
 	/* Perform device-specific initialisation and get CQN */
115
 	/* Perform device-specific initialisation and get CQN */
113
 	if ( ( rc = ibdev->op->create_cq ( ibdev, cq ) ) != 0 ) {
116
 	if ( ( rc = ibdev->op->create_cq ( ibdev, cq ) ) != 0 ) {
114
-		DBGC ( ibdev, "IBDEV %p could not initialise completion "
115
-		       "queue: %s\n", ibdev, strerror ( rc ) );
117
+		DBGC ( ibdev, "IBDEV %s could not initialise completion "
118
+		       "queue: %s\n", ibdev->name, strerror ( rc ) );
116
 		goto err_dev_create_cq;
119
 		goto err_dev_create_cq;
117
 	}
120
 	}
118
 
121
 
119
-	DBGC ( ibdev, "IBDEV %p created %d-entry completion queue %p (%p) "
120
-	       "with CQN %#lx\n", ibdev, num_cqes, cq,
122
+	DBGC ( ibdev, "IBDEV %s created %d-entry completion queue %p (%p) "
123
+	       "with CQN %#lx\n", ibdev->name, num_cqes, cq,
121
 	       ib_cq_get_drvdata ( cq ), cq->cqn );
124
 	       ib_cq_get_drvdata ( cq ), cq->cqn );
122
 	return cq;
125
 	return cq;
123
 
126
 
137
  */
140
  */
138
 void ib_destroy_cq ( struct ib_device *ibdev,
141
 void ib_destroy_cq ( struct ib_device *ibdev,
139
 		     struct ib_completion_queue *cq ) {
142
 		     struct ib_completion_queue *cq ) {
140
-	DBGC ( ibdev, "IBDEV %p destroying completion queue %#lx\n",
141
-	       ibdev, cq->cqn );
143
+	DBGC ( ibdev, "IBDEV %s destroying completion queue %#lx\n",
144
+	       ibdev->name, cq->cqn );
142
 	assert ( list_empty ( &cq->work_queues ) );
145
 	assert ( list_empty ( &cq->work_queues ) );
143
 	ibdev->op->destroy_cq ( ibdev, cq );
146
 	ibdev->op->destroy_cq ( ibdev, cq );
144
 	list_del ( &cq->list );
147
 	list_del ( &cq->list );
198
 	size_t total_size;
201
 	size_t total_size;
199
 	int rc;
202
 	int rc;
200
 
203
 
201
-	DBGC ( ibdev, "IBDEV %p creating queue pair\n", ibdev );
204
+	DBGC ( ibdev, "IBDEV %s creating queue pair\n", ibdev->name );
202
 
205
 
203
 	/* Allocate and initialise data structure */
206
 	/* Allocate and initialise data structure */
204
 	total_size = ( sizeof ( *qp ) +
207
 	total_size = ( sizeof ( *qp ) +
229
 
232
 
230
 	/* Perform device-specific initialisation and get QPN */
233
 	/* Perform device-specific initialisation and get QPN */
231
 	if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
234
 	if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
232
-		DBGC ( ibdev, "IBDEV %p could not initialise queue pair: "
233
-		       "%s\n", ibdev, strerror ( rc ) );
235
+		DBGC ( ibdev, "IBDEV %s could not initialise queue pair: "
236
+		       "%s\n", ibdev->name, strerror ( rc ) );
234
 		goto err_dev_create_qp;
237
 		goto err_dev_create_qp;
235
 	}
238
 	}
236
-	DBGC ( ibdev, "IBDEV %p created queue pair %p (%p) with QPN %#lx\n",
237
-	       ibdev, qp, ib_qp_get_drvdata ( qp ), qp->qpn );
238
-	DBGC ( ibdev, "IBDEV %p QPN %#lx has %d send entries at [%p,%p)\n",
239
-	       ibdev, qp->qpn, num_send_wqes, qp->send.iobufs,
239
+	DBGC ( ibdev, "IBDEV %s created queue pair %p (%p) with QPN %#lx\n",
240
+	       ibdev->name, qp, ib_qp_get_drvdata ( qp ), qp->qpn );
241
+	DBGC ( ibdev, "IBDEV %s QPN %#lx has %d send entries at [%p,%p)\n",
242
+	       ibdev->name, qp->qpn, num_send_wqes, qp->send.iobufs,
240
 	       qp->recv.iobufs );
243
 	       qp->recv.iobufs );
241
-	DBGC ( ibdev, "IBDEV %p QPN %#lx has %d receive entries at [%p,%p)\n",
242
-	       ibdev, qp->qpn, num_recv_wqes, qp->recv.iobufs,
244
+	DBGC ( ibdev, "IBDEV %s QPN %#lx has %d receive entries at [%p,%p)\n",
245
+	       ibdev->name, qp->qpn, num_recv_wqes, qp->recv.iobufs,
243
 	       ( ( ( void * ) qp ) + total_size ) );
246
 	       ( ( ( void * ) qp ) + total_size ) );
244
 
247
 
245
 	/* Calculate externally-visible QPN */
248
 	/* Calculate externally-visible QPN */
255
 		break;
258
 		break;
256
 	}
259
 	}
257
 	if ( qp->ext_qpn != qp->qpn ) {
260
 	if ( qp->ext_qpn != qp->qpn ) {
258
-		DBGC ( ibdev, "IBDEV %p QPN %#lx has external QPN %#lx\n",
259
-		       ibdev, qp->qpn, qp->ext_qpn );
261
+		DBGC ( ibdev, "IBDEV %s QPN %#lx has external QPN %#lx\n",
262
+		       ibdev->name, qp->qpn, qp->ext_qpn );
260
 	}
263
 	}
261
 
264
 
262
 	return qp;
265
 	return qp;
281
 int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
284
 int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp ) {
282
 	int rc;
285
 	int rc;
283
 
286
 
284
-	DBGC ( ibdev, "IBDEV %p modifying QPN %#lx\n", ibdev, qp->qpn );
287
+	DBGC ( ibdev, "IBDEV %s modifying QPN %#lx\n", ibdev->name, qp->qpn );
285
 
288
 
286
 	if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) {
289
 	if ( ( rc = ibdev->op->modify_qp ( ibdev, qp ) ) != 0 ) {
287
-		DBGC ( ibdev, "IBDEV %p could not modify QPN %#lx: %s\n",
288
-		       ibdev, qp->qpn, strerror ( rc ) );
290
+		DBGC ( ibdev, "IBDEV %s could not modify QPN %#lx: %s\n",
291
+		       ibdev->name, qp->qpn, strerror ( rc ) );
289
 		return rc;
292
 		return rc;
290
 	}
293
 	}
291
 
294
 
302
 	struct io_buffer *iobuf;
305
 	struct io_buffer *iobuf;
303
 	unsigned int i;
306
 	unsigned int i;
304
 
307
 
305
-	DBGC ( ibdev, "IBDEV %p destroying QPN %#lx\n",
306
-	       ibdev, qp->qpn );
308
+	DBGC ( ibdev, "IBDEV %s destroying QPN %#lx\n",
309
+	       ibdev->name, qp->qpn );
307
 
310
 
308
 	assert ( list_empty ( &qp->mgids ) );
311
 	assert ( list_empty ( &qp->mgids ) );
309
 
312
 
411
 
414
 
412
 	/* Check queue fill level */
415
 	/* Check queue fill level */
413
 	if ( qp->send.fill >= qp->send.num_wqes ) {
416
 	if ( qp->send.fill >= qp->send.num_wqes ) {
414
-		DBGC ( ibdev, "IBDEV %p QPN %#lx send queue full\n",
415
-		       ibdev, qp->qpn );
417
+		DBGC ( ibdev, "IBDEV %s QPN %#lx send queue full\n",
418
+		       ibdev->name, qp->qpn );
416
 		return -ENOBUFS;
419
 		return -ENOBUFS;
417
 	}
420
 	}
418
 
421
 
432
 
435
 
433
 	/* Post to hardware */
436
 	/* Post to hardware */
434
 	if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
437
 	if ( ( rc = ibdev->op->post_send ( ibdev, qp, dest, iobuf ) ) != 0 ) {
435
-		DBGC ( ibdev, "IBDEV %p QPN %#lx could not post send WQE: "
436
-		       "%s\n", ibdev, qp->qpn, strerror ( rc ) );
438
+		DBGC ( ibdev, "IBDEV %s QPN %#lx could not post send WQE: "
439
+		       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
437
 		return rc;
440
 		return rc;
438
 	}
441
 	}
439
 
442
 
463
 
466
 
464
 	/* Check packet length */
467
 	/* Check packet length */
465
 	if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
468
 	if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
466
-		DBGC ( ibdev, "IBDEV %p QPN %#lx wrong RX buffer size (%zd)\n",
467
-		       ibdev, qp->qpn, iob_tailroom ( iobuf ) );
469
+		DBGC ( ibdev, "IBDEV %s QPN %#lx wrong RX buffer size (%zd)\n",
470
+		       ibdev->name, qp->qpn, iob_tailroom ( iobuf ) );
468
 		return -EINVAL;
471
 		return -EINVAL;
469
 	}
472
 	}
470
 
473
 
471
 	/* Check queue fill level */
474
 	/* Check queue fill level */
472
 	if ( qp->recv.fill >= qp->recv.num_wqes ) {
475
 	if ( qp->recv.fill >= qp->recv.num_wqes ) {
473
-		DBGC ( ibdev, "IBDEV %p QPN %#lx receive queue full\n",
474
-		       ibdev, qp->qpn );
476
+		DBGC ( ibdev, "IBDEV %s QPN %#lx receive queue full\n",
477
+		       ibdev->name, qp->qpn );
475
 		return -ENOBUFS;
478
 		return -ENOBUFS;
476
 	}
479
 	}
477
 
480
 
478
 	/* Post to hardware */
481
 	/* Post to hardware */
479
 	if ( ( rc = ibdev->op->post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
482
 	if ( ( rc = ibdev->op->post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
480
-		DBGC ( ibdev, "IBDEV %p QPN %#lx could not post receive WQE: "
481
-		       "%s\n", ibdev, qp->qpn, strerror ( rc ) );
483
+		DBGC ( ibdev, "IBDEV %s QPN %#lx could not post receive WQE: "
484
+		       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
482
 		return rc;
485
 		return rc;
483
 	}
486
 	}
484
 
487
 
556
 
559
 
557
 		/* Post I/O buffer */
560
 		/* Post I/O buffer */
558
 		if ( ( rc = ib_post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
561
 		if ( ( rc = ib_post_recv ( ibdev, qp, iobuf ) ) != 0 ) {
559
-			DBGC ( ibdev, "IBDEV %p could not refill: %s\n",
560
-			       ibdev, strerror ( rc ) );
562
+			DBGC ( ibdev, "IBDEV %s could not refill: %s\n",
563
+			       ibdev->name, strerror ( rc ) );
561
 			free_iob ( iobuf );
564
 			free_iob ( iobuf );
562
 			/* Give up */
565
 			/* Give up */
563
 			return;
566
 			return;
623
  */
626
  */
624
 void ib_link_state_changed ( struct ib_device *ibdev ) {
627
 void ib_link_state_changed ( struct ib_device *ibdev ) {
625
 
628
 
626
-	DBGC ( ibdev, "IBDEV %p link state is %s\n",
627
-	       ibdev, ib_link_state_text ( ibdev ) );
629
+	DBGC ( ibdev, "IBDEV %s link state is %s\n",
630
+	       ibdev->name, ib_link_state_text ( ibdev ) );
628
 
631
 
629
 	/* Notify drivers of link state change */
632
 	/* Notify drivers of link state change */
630
 	ib_notify ( ibdev );
633
 	ib_notify ( ibdev );
647
 
650
 
648
 	/* Open device */
651
 	/* Open device */
649
 	if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) {
652
 	if ( ( rc = ibdev->op->open ( ibdev ) ) != 0 ) {
650
-		DBGC ( ibdev, "IBDEV %p could not open: %s\n",
651
-		       ibdev, strerror ( rc ) );
653
+		DBGC ( ibdev, "IBDEV %s could not open: %s\n",
654
+		       ibdev->name, strerror ( rc ) );
652
 		goto err_open;
655
 		goto err_open;
653
 	}
656
 	}
654
 
657
 
655
 	/* Create subnet management interface */
658
 	/* Create subnet management interface */
656
 	ibdev->smi = ib_create_mi ( ibdev, IB_QPT_SMI );
659
 	ibdev->smi = ib_create_mi ( ibdev, IB_QPT_SMI );
657
 	if ( ! ibdev->smi ) {
660
 	if ( ! ibdev->smi ) {
658
-		DBGC ( ibdev, "IBDEV %p could not create SMI\n", ibdev );
661
+		DBGC ( ibdev, "IBDEV %s could not create SMI\n", ibdev->name );
659
 		rc = -ENOMEM;
662
 		rc = -ENOMEM;
660
 		goto err_create_smi;
663
 		goto err_create_smi;
661
 	}
664
 	}
662
 
665
 
663
 	/* Create subnet management agent */
666
 	/* Create subnet management agent */
664
 	if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) {
667
 	if ( ( rc = ib_create_sma ( ibdev, ibdev->smi ) ) != 0 ) {
665
-		DBGC ( ibdev, "IBDEV %p could not create SMA: %s\n",
666
-		       ibdev, strerror ( rc ) );
668
+		DBGC ( ibdev, "IBDEV %s could not create SMA: %s\n",
669
+		       ibdev->name, strerror ( rc ) );
667
 		goto err_create_sma;
670
 		goto err_create_sma;
668
 	}
671
 	}
669
 
672
 
670
 	/* Create general services interface */
673
 	/* Create general services interface */
671
 	ibdev->gsi = ib_create_mi ( ibdev, IB_QPT_GSI );
674
 	ibdev->gsi = ib_create_mi ( ibdev, IB_QPT_GSI );
672
 	if ( ! ibdev->gsi ) {
675
 	if ( ! ibdev->gsi ) {
673
-		DBGC ( ibdev, "IBDEV %p could not create GSI\n", ibdev );
676
+		DBGC ( ibdev, "IBDEV %s could not create GSI\n", ibdev->name );
674
 		rc = -ENOMEM;
677
 		rc = -ENOMEM;
675
 		goto err_create_gsi;
678
 		goto err_create_gsi;
676
 	}
679
 	}
833
 
836
 
834
 	/* Adapters with embedded SMAs do not need to support this method */
837
 	/* Adapters with embedded SMAs do not need to support this method */
835
 	if ( ! ibdev->op->set_port_info ) {
838
 	if ( ! ibdev->op->set_port_info ) {
836
-		DBGC ( ibdev, "IBDEV %p does not support setting port "
837
-		       "information\n", ibdev );
839
+		DBGC ( ibdev, "IBDEV %s does not support setting port "
840
+		       "information\n", ibdev->name );
838
 		return -ENOTSUP;
841
 		return -ENOTSUP;
839
 	}
842
 	}
840
 
843
 
841
 	if ( ( rc = ibdev->op->set_port_info ( ibdev, mad ) ) != 0 ) {
844
 	if ( ( rc = ibdev->op->set_port_info ( ibdev, mad ) ) != 0 ) {
842
-		DBGC ( ibdev, "IBDEV %p could not set port information: %s\n",
843
-		       ibdev, strerror ( rc ) );
845
+		DBGC ( ibdev, "IBDEV %s could not set port information: %s\n",
846
+		       ibdev->name, strerror ( rc ) );
844
 		return rc;
847
 		return rc;
845
 	}
848
 	}
846
 
849
 
858
 
861
 
859
 	/* Adapters with embedded SMAs do not need to support this method */
862
 	/* Adapters with embedded SMAs do not need to support this method */
860
 	if ( ! ibdev->op->set_pkey_table ) {
863
 	if ( ! ibdev->op->set_pkey_table ) {
861
-		DBGC ( ibdev, "IBDEV %p does not support setting partition "
862
-		       "key table\n", ibdev );
864
+		DBGC ( ibdev, "IBDEV %s does not support setting partition "
865
+		       "key table\n", ibdev->name );
863
 		return -ENOTSUP;
866
 		return -ENOTSUP;
864
 	}
867
 	}
865
 
868
 
866
 	if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) {
869
 	if ( ( rc = ibdev->op->set_pkey_table ( ibdev, mad ) ) != 0 ) {
867
-		DBGC ( ibdev, "IBDEV %p could not set partition key table: "
868
-		       "%s\n", ibdev, strerror ( rc ) );
870
+		DBGC ( ibdev, "IBDEV %s could not set partition key table: "
871
+		       "%s\n", ibdev->name, strerror ( rc ) );
869
 		return rc;
872
 		return rc;
870
 	}
873
 	}
871
 
874
 
954
 	struct ib_driver *driver;
957
 	struct ib_driver *driver;
955
 	int rc;
958
 	int rc;
956
 
959
 
960
+	/* Record device index and create device name */
961
+	if ( ibdev->name[0] == '\0' ) {
962
+		snprintf ( ibdev->name, sizeof ( ibdev->name ), "inf%d",
963
+			   ibdev_index );
964
+	}
965
+	ibdev->index = ++ibdev_index;
966
+
957
 	/* Add to device list */
967
 	/* Add to device list */
958
 	ibdev_get ( ibdev );
968
 	ibdev_get ( ibdev );
959
 	list_add_tail ( &ibdev->list, &ib_devices );
969
 	list_add_tail ( &ibdev->list, &ib_devices );
960
-	DBGC ( ibdev, "IBDEV %p registered (phys %s)\n", ibdev,
970
+	DBGC ( ibdev, "IBDEV %s registered (phys %s)\n", ibdev->name,
961
 	       ibdev->dev->name );
971
 	       ibdev->dev->name );
962
 
972
 
963
 	/* Probe device */
973
 	/* Probe device */
964
 	for_each_table_entry ( driver, IB_DRIVERS ) {
974
 	for_each_table_entry ( driver, IB_DRIVERS ) {
965
 		if ( ( rc = driver->probe ( ibdev ) ) != 0 ) {
975
 		if ( ( rc = driver->probe ( ibdev ) ) != 0 ) {
966
-			DBGC ( ibdev, "IBDEV %p could not add %s device: %s\n",
967
-			       ibdev, driver->name, strerror ( rc ) );
976
+			DBGC ( ibdev, "IBDEV %s could not add %s device: %s\n",
977
+			       ibdev->name, driver->name, strerror ( rc ) );
968
 			goto err_probe;
978
 			goto err_probe;
969
 		}
979
 		}
970
 	}
980
 	}
994
 	/* Remove from device list */
1004
 	/* Remove from device list */
995
 	list_del ( &ibdev->list );
1005
 	list_del ( &ibdev->list );
996
 	ibdev_put ( ibdev );
1006
 	ibdev_put ( ibdev );
997
-	DBGC ( ibdev, "IBDEV %p unregistered\n", ibdev );
1007
+	DBGC ( ibdev, "IBDEV %s unregistered\n", ibdev->name );
1008
+
1009
+	/* Reset device index if no devices remain */
1010
+	if ( list_empty ( &ib_devices ) )
1011
+		ibdev_index = 0;
998
 }
1012
 }
999
 
1013
 
1000
 /**
1014
 /**

+ 2
- 2
src/net/infiniband/ib_cm.c Прегледај датотеку

466
 	/* Add to list of connections */
466
 	/* Add to list of connections */
467
 	list_add ( &conn->list, &ib_cm_conns );
467
 	list_add ( &conn->list, &ib_cm_conns );
468
 
468
 
469
-	DBGC ( conn, "CM %p created for IBDEV %p QPN %lx\n",
470
-	       conn, ibdev, qp->qpn );
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",
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 ) );
472
 	       conn, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );
473
 
473
 

+ 16
- 16
src/net/infiniband/ib_mcast.c Прегледај датотеку

94
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
94
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
95
 		rc = -ENOTCONN;
95
 		rc = -ENOTCONN;
96
 	if ( rc != 0 ) {
96
 	if ( rc != 0 ) {
97
-		DBGC ( ibdev, "IBDEV %p QPN %lx join failed: %s\n",
98
-		       ibdev, qp->qpn, strerror ( rc ) );
97
+		DBGC ( ibdev, "IBDEV %s QPN %lx join failed: %s\n",
98
+		       ibdev->name, qp->qpn, strerror ( rc ) );
99
 		goto out;
99
 		goto out;
100
 	}
100
 	}
101
 
101
 
102
 	/* Extract values from MAD */
102
 	/* Extract values from MAD */
103
 	joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
103
 	joined = ( mad->hdr.method == IB_MGMT_METHOD_GET_RESP );
104
 	qkey = ntohl ( mc_member_record->qkey );
104
 	qkey = ntohl ( mc_member_record->qkey );
105
-	DBGC ( ibdev, "IBDEV %p QPN %lx %s " IB_GID_FMT " qkey %lx\n",
106
-	       ibdev, qp->qpn, ( joined ? "joined" : "left" ),
105
+	DBGC ( ibdev, "IBDEV %s QPN %lx %s " IB_GID_FMT " qkey %lx\n",
106
+	       ibdev->name, qp->qpn, ( joined ? "joined" : "left" ),
107
 	       IB_GID_ARGS ( gid ), qkey );
107
 	       IB_GID_ARGS ( gid ), qkey );
108
 
108
 
109
 	/* Set queue key */
109
 	/* Set queue key */
110
 	qp->qkey = qkey;
110
 	qp->qkey = qkey;
111
 	if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
111
 	if ( ( rc = ib_modify_qp ( ibdev, qp ) ) != 0 ) {
112
-		DBGC ( ibdev, "IBDEV %p QPN %lx could not modify qkey: %s\n",
113
-		       ibdev, qp->qpn, strerror ( rc ) );
112
+		DBGC ( ibdev, "IBDEV %s QPN %lx could not modify qkey: %s\n",
113
+		       ibdev->name, qp->qpn, strerror ( rc ) );
114
 		goto out;
114
 		goto out;
115
 	}
115
 	}
116
 
116
 
147
 	union ib_mad mad;
147
 	union ib_mad mad;
148
 	int rc;
148
 	int rc;
149
 
149
 
150
-	DBGC ( ibdev, "IBDEV %p QPN %lx joining " IB_GID_FMT "\n",
151
-	       ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
150
+	DBGC ( ibdev, "IBDEV %s QPN %lx joining " IB_GID_FMT "\n",
151
+	       ibdev->name, qp->qpn, IB_GID_ARGS ( gid ) );
152
 
152
 
153
 	/* Sanity check */
153
 	/* Sanity check */
154
 	assert ( qp != NULL );
154
 	assert ( qp != NULL );
160
 
160
 
161
 	/* Attach queue pair to multicast GID */
161
 	/* Attach queue pair to multicast GID */
162
 	if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) {
162
 	if ( ( rc = ib_mcast_attach ( ibdev, qp, gid ) ) != 0 ) {
163
-		DBGC ( ibdev, "IBDEV %p QPN %lx could not attach: %s\n",
164
-		       ibdev, qp->qpn, strerror ( rc ) );
163
+		DBGC ( ibdev, "IBDEV %s QPN %lx could not attach: %s\n",
164
+		       ibdev->name, qp->qpn, strerror ( rc ) );
165
 		goto err_mcast_attach;
165
 		goto err_mcast_attach;
166
 	}
166
 	}
167
 
167
 
170
 	membership->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, NULL,
170
 	membership->madx = ib_create_madx ( ibdev, ibdev->gsi, &mad, NULL,
171
 					    &ib_mcast_op );
171
 					    &ib_mcast_op );
172
 	if ( ! membership->madx ) {
172
 	if ( ! membership->madx ) {
173
-		DBGC ( ibdev, "IBDEV %p QPN %lx could not create join "
174
-		       "transaction\n", ibdev, qp->qpn );
173
+		DBGC ( ibdev, "IBDEV %s QPN %lx could not create join "
174
+		       "transaction\n", ibdev->name, qp->qpn );
175
 		rc = -ENOMEM;
175
 		rc = -ENOMEM;
176
 		goto err_create_madx;
176
 		goto err_create_madx;
177
 	}
177
 	}
199
 	union ib_mad mad;
199
 	union ib_mad mad;
200
 	int rc;
200
 	int rc;
201
 
201
 
202
-	DBGC ( ibdev, "IBDEV %p QPN %lx leaving " IB_GID_FMT "\n",
203
-	       ibdev, qp->qpn, IB_GID_ARGS ( gid ) );
202
+	DBGC ( ibdev, "IBDEV %s QPN %lx leaving " IB_GID_FMT "\n",
203
+	       ibdev->name, qp->qpn, IB_GID_ARGS ( gid ) );
204
 
204
 
205
 	/* Sanity check */
205
 	/* Sanity check */
206
 	assert ( qp != NULL );
206
 	assert ( qp != NULL );
217
 	/* Send a single group leave MAD */
217
 	/* Send a single group leave MAD */
218
 	ib_mcast_mad ( ibdev, &membership->gid, 0, &mad );
218
 	ib_mcast_mad ( ibdev, &membership->gid, 0, &mad );
219
 	if ( ( rc = ib_mi_send ( ibdev, ibdev->gsi, &mad, NULL ) ) != 0 ) {
219
 	if ( ( rc = ib_mi_send ( ibdev, ibdev->gsi, &mad, NULL ) ) != 0 ) {
220
-		DBGC ( ibdev, "IBDEV %p QPN %lx could not send leave request: "
221
-		       "%s\n", ibdev, qp->qpn, strerror ( rc ) );
220
+		DBGC ( ibdev, "IBDEV %s QPN %lx could not send leave request: "
221
+		       "%s\n", ibdev->name, qp->qpn, strerror ( rc ) );
222
 	}
222
 	}
223
 }
223
 }

+ 23
- 22
src/net/infiniband/ib_packet.c Прегледај датотеку

63
 	unsigned int vl;
63
 	unsigned int vl;
64
 	unsigned int lnh;
64
 	unsigned int lnh;
65
 
65
 
66
-	DBGC2 ( ibdev, "IBDEV %p TX %04x:%08lx => %04x:%08lx (key %08lx)\n",
67
-		ibdev, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn,
66
+	DBGC2 ( ibdev, "IBDEV %s TX %04x:%08lx => %04x:%08lx (key %08lx)\n",
67
+		ibdev->name, ibdev->lid, qp->ext_qpn, dest->lid, dest->qpn,
68
 		dest->qkey );
68
 		dest->qkey );
69
 
69
 
70
 	/* Calculate packet length */
70
 	/* Calculate packet length */
152
 
152
 
153
 	/* Extract LRH */
153
 	/* Extract LRH */
154
 	if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) {
154
 	if ( iob_len ( iobuf ) < sizeof ( *lrh ) ) {
155
-		DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for LRH\n",
156
-		       ibdev, iob_len ( iobuf ) );
155
+		DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for LRH\n",
156
+		       ibdev->name, iob_len ( iobuf ) );
157
 		return -EINVAL;
157
 		return -EINVAL;
158
 	}
158
 	}
159
 	lrh = iobuf->data;
159
 	lrh = iobuf->data;
166
 
166
 
167
 	/* Reject unsupported packets */
167
 	/* Reject unsupported packets */
168
 	if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) {
168
 	if ( ! ( ( lnh == IB_LNH_BTH ) || ( lnh == IB_LNH_GRH ) ) ) {
169
-		DBGC ( ibdev, "IBDEV %p RX unsupported LNH %x\n",
170
-		       ibdev, lnh );
169
+		DBGC ( ibdev, "IBDEV %s RX unsupported LNH %x\n",
170
+		       ibdev->name, lnh );
171
 		return -ENOTSUP;
171
 		return -ENOTSUP;
172
 	}
172
 	}
173
 
173
 
174
 	/* Extract GRH, if present */
174
 	/* Extract GRH, if present */
175
 	if ( lnh == IB_LNH_GRH ) {
175
 	if ( lnh == IB_LNH_GRH ) {
176
 		if ( iob_len ( iobuf ) < sizeof ( *grh ) ) {
176
 		if ( iob_len ( iobuf ) < sizeof ( *grh ) ) {
177
-			DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) "
178
-			       "for GRH\n", ibdev, iob_len ( iobuf ) );
177
+			DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) "
178
+			       "for GRH\n", ibdev->name, iob_len ( iobuf ) );
179
 			return -EINVAL;
179
 			return -EINVAL;
180
 		}
180
 		}
181
 		grh = iobuf->data;
181
 		grh = iobuf->data;
190
 
190
 
191
 	/* Extract BTH */
191
 	/* Extract BTH */
192
 	if ( iob_len ( iobuf ) < sizeof ( *bth ) ) {
192
 	if ( iob_len ( iobuf ) < sizeof ( *bth ) ) {
193
-		DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for BTH\n",
194
-		       ibdev, iob_len ( iobuf ) );
193
+		DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for BTH\n",
194
+		       ibdev->name, iob_len ( iobuf ) );
195
 		return -EINVAL;
195
 		return -EINVAL;
196
 	}
196
 	}
197
 	bth = iobuf->data;
197
 	bth = iobuf->data;
198
 	iob_pull ( iobuf, sizeof ( *bth ) );
198
 	iob_pull ( iobuf, sizeof ( *bth ) );
199
 	if ( bth->opcode != BTH_OPCODE_UD_SEND ) {
199
 	if ( bth->opcode != BTH_OPCODE_UD_SEND ) {
200
-		DBGC ( ibdev, "IBDEV %p unsupported BTH opcode %x\n",
201
-		       ibdev, bth->opcode );
200
+		DBGC ( ibdev, "IBDEV %s unsupported BTH opcode %x\n",
201
+		       ibdev->name, bth->opcode );
202
 		return -ENOTSUP;
202
 		return -ENOTSUP;
203
 	}
203
 	}
204
 	dest->qpn = ntohl ( bth->dest_qp );
204
 	dest->qpn = ntohl ( bth->dest_qp );
205
 
205
 
206
 	/* Extract DETH */
206
 	/* Extract DETH */
207
 	if ( iob_len ( iobuf ) < sizeof ( *deth ) ) {
207
 	if ( iob_len ( iobuf ) < sizeof ( *deth ) ) {
208
-		DBGC ( ibdev, "IBDEV %p RX too short (%zd bytes) for DETH\n",
209
-		       ibdev, iob_len ( iobuf ) );
208
+		DBGC ( ibdev, "IBDEV %s RX too short (%zd bytes) for DETH\n",
209
+		       ibdev->name, iob_len ( iobuf ) );
210
 		return -EINVAL;
210
 		return -EINVAL;
211
 	}
211
 	}
212
 	deth = iobuf->data;
212
 	deth = iobuf->data;
226
 	if ( qp ) {
226
 	if ( qp ) {
227
 		if ( IB_LID_MULTICAST ( dest->lid ) && grh ) {
227
 		if ( IB_LID_MULTICAST ( dest->lid ) && grh ) {
228
 			if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
228
 			if ( ! ( *qp = ib_find_qp_mgid ( ibdev, &grh->dgid ))){
229
-				DBGC ( ibdev, "IBDEV %p RX for unknown MGID "
230
-				       IB_GID_FMT "\n",
231
-				       ibdev, IB_GID_ARGS ( &grh->dgid ) );
229
+				DBGC ( ibdev, "IBDEV %s RX for unknown MGID "
230
+				       IB_GID_FMT "\n", ibdev->name,
231
+				       IB_GID_ARGS ( &grh->dgid ) );
232
 				return -ENODEV;
232
 				return -ENODEV;
233
 			}
233
 			}
234
 		} else {
234
 		} else {
235
 			if ( ! ( *qp = ib_find_qp_qpn ( ibdev, dest->qpn ) ) ) {
235
 			if ( ! ( *qp = ib_find_qp_qpn ( ibdev, dest->qpn ) ) ) {
236
-				DBGC ( ibdev, "IBDEV %p RX for nonexistent "
237
-				       "QPN %lx\n", ibdev, dest->qpn );
236
+				DBGC ( ibdev, "IBDEV %s RX for nonexistent "
237
+				       "QPN %lx\n", ibdev->name, dest->qpn );
238
 				return -ENODEV;
238
 				return -ENODEV;
239
 			}
239
 			}
240
 		}
240
 		}
241
 		assert ( *qp );
241
 		assert ( *qp );
242
 	}
242
 	}
243
 
243
 
244
-	DBGC2 ( ibdev, "IBDEV %p RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
245
-		ibdev, dest->lid, ( IB_LID_MULTICAST ( dest->lid ) ?
246
-			      ( qp ? (*qp)->ext_qpn : -1UL ) : dest->qpn ),
244
+	DBGC2 ( ibdev, "IBDEV %s RX %04x:%08lx <= %04x:%08lx (key %08x)\n",
245
+		ibdev->name, dest->lid,
246
+		( IB_LID_MULTICAST ( dest->lid ) ?
247
+		  ( qp ? (*qp)->ext_qpn : -1UL ) : dest->qpn ),
247
 		source->lid, source->qpn, ntohl ( deth->qkey ) );
248
 		source->lid, source->qpn, ntohl ( deth->qkey ) );
248
 	DBGCP_HDA ( ibdev, 0,
249
 	DBGCP_HDA ( ibdev, 0,
249
 		    ( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),
250
 		    ( iobuf->data - ( orig_iob_len - iob_len ( iobuf ) ) ),

+ 12
- 12
src/net/infiniband/ib_pathrec.c Прегледај датотеку

61
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
61
 	if ( ( rc == 0 ) && ( mad->hdr.status != htons ( IB_MGMT_STATUS_OK ) ))
62
 		rc = -ENETUNREACH;
62
 		rc = -ENETUNREACH;
63
 	if ( rc != 0 ) {
63
 	if ( rc != 0 ) {
64
-		DBGC ( ibdev, "IBDEV %p path lookup for " IB_GID_FMT
64
+		DBGC ( ibdev, "IBDEV %s path lookup for " IB_GID_FMT
65
 		       " failed: %s\n",
65
 		       " failed: %s\n",
66
-		       ibdev, IB_GID_ARGS ( dgid ), strerror ( rc ) );
66
+		       ibdev->name, IB_GID_ARGS ( dgid ), strerror ( rc ) );
67
 		goto out;
67
 		goto out;
68
 	}
68
 	}
69
 
69
 
71
 	path->av.lid = ntohs ( pathrec->dlid );
71
 	path->av.lid = ntohs ( pathrec->dlid );
72
 	path->av.sl = ( pathrec->reserved__sl & 0x0f );
72
 	path->av.sl = ( pathrec->reserved__sl & 0x0f );
73
 	path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
73
 	path->av.rate = ( pathrec->rate_selector__rate & 0x3f );
74
-	DBGC ( ibdev, "IBDEV %p path to " IB_GID_FMT " is %04x sl %d rate "
75
-	       "%d\n", ibdev, IB_GID_ARGS ( dgid ), path->av.lid, path->av.sl,
76
-	       path->av.rate );
74
+	DBGC ( ibdev, "IBDEV %s path to " IB_GID_FMT " is %04x sl %d rate "
75
+	       "%d\n", ibdev->name, IB_GID_ARGS ( dgid ), path->av.lid,
76
+	       path->av.sl, path->av.rate );
77
 
77
 
78
  out:
78
  out:
79
 	/* Destroy the completed transaction */
79
 	/* Destroy the completed transaction */
247
 
247
 
248
 	/* Sanity check */
248
 	/* Sanity check */
249
 	if ( ! av->gid_present ) {
249
 	if ( ! av->gid_present ) {
250
-		DBGC ( ibdev, "IBDEV %p attempt to look up path without GID\n",
251
-		       ibdev );
250
+		DBGC ( ibdev, "IBDEV %s attempt to look up path without GID\n",
251
+		       ibdev->name );
252
 		return -EINVAL;
252
 		return -EINVAL;
253
 	}
253
 	}
254
 
254
 
259
 		av->lid = cached->path->av.lid;
259
 		av->lid = cached->path->av.lid;
260
 		av->rate = cached->path->av.rate;
260
 		av->rate = cached->path->av.rate;
261
 		av->sl = cached->path->av.sl;
261
 		av->sl = cached->path->av.sl;
262
-		DBGC2 ( ibdev, "IBDEV %p cache hit for " IB_GID_FMT "\n",
263
-			ibdev, IB_GID_ARGS ( gid ) );
262
+		DBGC2 ( ibdev, "IBDEV %s cache hit for " IB_GID_FMT "\n",
263
+			ibdev->name, IB_GID_ARGS ( gid ) );
264
 		return 0;
264
 		return 0;
265
 	}
265
 	}
266
-	DBGC ( ibdev, "IBDEV %p cache miss for " IB_GID_FMT "%s\n", ibdev,
266
+	DBGC ( ibdev, "IBDEV %s cache miss for " IB_GID_FMT "%s\n", ibdev->name,
267
 	       IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
267
 	       IB_GID_ARGS ( gid ), ( cached ? " (in progress)" : "" ) );
268
 
268
 
269
 	/* If lookup is already in progress, do nothing */
269
 	/* If lookup is already in progress, do nothing */
282
 	/* Create new path */
282
 	/* Create new path */
283
 	cached->path = ib_create_path ( ibdev, av, &ib_cached_path_op );
283
 	cached->path = ib_create_path ( ibdev, av, &ib_cached_path_op );
284
 	if ( ! cached->path ) {
284
 	if ( ! cached->path ) {
285
-		DBGC ( ibdev, "IBDEV %p could not create path\n",
286
-		       ibdev );
285
+		DBGC ( ibdev, "IBDEV %s could not create path\n",
286
+		       ibdev->name );
287
 		return -ENOMEM;
287
 		return -ENOMEM;
288
 	}
288
 	}
289
 	ib_path_set_ownerdata ( cached->path, cached );
289
 	ib_path_set_ownerdata ( cached->path, cached );

+ 1
- 1
src/net/infiniband/ib_sma.c Прегледај датотеку

358
 int ib_create_sma ( struct ib_device *ibdev, struct ib_mad_interface *mi ) {
358
 int ib_create_sma ( struct ib_device *ibdev, struct ib_mad_interface *mi ) {
359
 
359
 
360
 	/* Nothing to do */
360
 	/* Nothing to do */
361
-	DBGC ( ibdev, "IBDEV %p SMA using SMI %p\n", ibdev, mi );
361
+	DBGC ( ibdev, "IBDEV %s SMA using SMI %p\n", ibdev->name, mi );
362
 
362
 
363
 	return 0;
363
 	return 0;
364
 }
364
 }

+ 10
- 10
src/net/infiniband/ib_smc.c Прегледај датотеку

86
 	/* Issue MAD */
86
 	/* Issue MAD */
87
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_NODE_INFO ), 0,
87
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_NODE_INFO ), 0,
88
 				 local_mad, mad ) ) != 0 ) {
88
 				 local_mad, mad ) ) != 0 ) {
89
-		DBGC ( ibdev, "IBDEV %p could not get node info: %s\n",
90
-		       ibdev, strerror ( rc ) );
89
+		DBGC ( ibdev, "IBDEV %s could not get node info: %s\n",
90
+		       ibdev->name, strerror ( rc ) );
91
 		return rc;
91
 		return rc;
92
 	}
92
 	}
93
 	return 0;
93
 	return 0;
109
 	/* Issue MAD */
109
 	/* Issue MAD */
110
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PORT_INFO ),
110
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PORT_INFO ),
111
 				 htonl ( ibdev->port ), local_mad, mad )) !=0){
111
 				 htonl ( ibdev->port ), local_mad, mad )) !=0){
112
-		DBGC ( ibdev, "IBDEV %p could not get port info: %s\n",
113
-		       ibdev, strerror ( rc ) );
112
+		DBGC ( ibdev, "IBDEV %s could not get port info: %s\n",
113
+		       ibdev->name, strerror ( rc ) );
114
 		return rc;
114
 		return rc;
115
 	}
115
 	}
116
 	return 0;
116
 	return 0;
132
 	/* Issue MAD */
132
 	/* Issue MAD */
133
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_GUID_INFO ), 0,
133
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_GUID_INFO ), 0,
134
 				 local_mad, mad ) ) != 0 ) {
134
 				 local_mad, mad ) ) != 0 ) {
135
-		DBGC ( ibdev, "IBDEV %p could not get GUID info: %s\n",
136
-		       ibdev, strerror ( rc ) );
135
+		DBGC ( ibdev, "IBDEV %s could not get GUID info: %s\n",
136
+		       ibdev->name, strerror ( rc ) );
137
 		return rc;
137
 		return rc;
138
 	}
138
 	}
139
 	return 0;
139
 	return 0;
155
 	/* Issue MAD */
155
 	/* Issue MAD */
156
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PKEY_TABLE ), 0,
156
 	if ( ( rc = ib_smc_mad ( ibdev, htons ( IB_SMP_ATTR_PKEY_TABLE ), 0,
157
 				 local_mad, mad ) ) != 0 ) {
157
 				 local_mad, mad ) ) != 0 ) {
158
-		DBGC ( ibdev, "IBDEV %p could not get pkey table: %s\n",
159
-		       ibdev, strerror ( rc ) );
158
+		DBGC ( ibdev, "IBDEV %s could not get pkey table: %s\n",
159
+		       ibdev->name, strerror ( rc ) );
160
 		return rc;
160
 		return rc;
161
 	}
161
 	}
162
 	return 0;
162
 	return 0;
216
 		return rc;
216
 		return rc;
217
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
217
 	ibdev->pkey = ntohs ( pkey_table->pkey[0] );
218
 
218
 
219
-	DBGC ( ibdev, "IBDEV %p port GID is " IB_GID_FMT "\n",
220
-	       ibdev, IB_GID_ARGS ( &ibdev->gid ) );
219
+	DBGC ( ibdev, "IBDEV %s port GID is " IB_GID_FMT "\n",
220
+	       ibdev->name, IB_GID_ARGS ( &ibdev->gid ) );
221
 
221
 
222
 	return 0;
222
 	return 0;
223
 }
223
 }

Loading…
Откажи
Сачувај