Browse Source

[infiniband] Assign names to queue pairs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
6a3ffa0114

+ 1
- 1
src/drivers/infiniband/hermon.c View File

3242
 	port->eth_qp = ib_create_qp ( ibdev, IB_QPT_ETH,
3242
 	port->eth_qp = ib_create_qp ( ibdev, IB_QPT_ETH,
3243
 				      HERMON_ETH_NUM_SEND_WQES, port->eth_cq,
3243
 				      HERMON_ETH_NUM_SEND_WQES, port->eth_cq,
3244
 				      HERMON_ETH_NUM_RECV_WQES, port->eth_cq,
3244
 				      HERMON_ETH_NUM_RECV_WQES, port->eth_cq,
3245
-				      &hermon_eth_qp_op );
3245
+				      &hermon_eth_qp_op, netdev->name );
3246
 	if ( ! port->eth_qp ) {
3246
 	if ( ! port->eth_qp ) {
3247
 		DBGC ( hermon, "Hermon %p port %d could not create queue "
3247
 		DBGC ( hermon, "Hermon %p port %d could not create queue "
3248
 		       "pair\n", hermon, ibdev->port );
3248
 		       "pair\n", hermon, ibdev->port );

+ 1
- 1
src/drivers/net/ipoib.c View File

865
 	/* Allocate queue pair */
865
 	/* Allocate queue pair */
866
 	ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, IPOIB_NUM_SEND_WQES,
866
 	ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, IPOIB_NUM_SEND_WQES,
867
 				   ipoib->cq, IPOIB_NUM_RECV_WQES, ipoib->cq,
867
 				   ipoib->cq, IPOIB_NUM_RECV_WQES, ipoib->cq,
868
-				   &ipoib_qp_op );
868
+				   &ipoib_qp_op, netdev->name );
869
 	if ( ! ipoib->qp ) {
869
 	if ( ! ipoib->qp ) {
870
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
870
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
871
 		       ipoib );
871
 		       ipoib );

+ 3
- 1
src/include/ipxe/infiniband.h View File

158
 	struct ib_device *ibdev;
158
 	struct ib_device *ibdev;
159
 	/** List of queue pairs on this Infiniband device */
159
 	/** List of queue pairs on this Infiniband device */
160
 	struct list_head list;
160
 	struct list_head list;
161
+	/** Queue pair name */
162
+	const char *name;
161
 	/** Queue pair number */
163
 	/** Queue pair number */
162
 	unsigned long qpn;
164
 	unsigned long qpn;
163
 	/** Externally-visible queue pair number
165
 	/** Externally-visible queue pair number
498
 ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
500
 ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
499
 	       unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
501
 	       unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
500
 	       unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
502
 	       unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
501
-	       struct ib_queue_pair_operations *op );
503
+	       struct ib_queue_pair_operations *op, const char *name );
502
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
504
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
503
 extern void ib_destroy_qp ( struct ib_device *ibdev,
505
 extern void ib_destroy_qp ( struct ib_device *ibdev,
504
 			    struct ib_queue_pair *qp );
506
 			    struct ib_queue_pair *qp );

+ 9
- 6
src/net/infiniband.c View File

107
 	if ( ! cq )
107
 	if ( ! cq )
108
 		goto err_alloc_cq;
108
 		goto err_alloc_cq;
109
 	cq->ibdev = ibdev;
109
 	cq->ibdev = ibdev;
110
-	list_add ( &cq->list, &ibdev->cqs );
110
+	list_add_tail ( &cq->list, &ibdev->cqs );
111
 	cq->num_cqes = num_cqes;
111
 	cq->num_cqes = num_cqes;
112
 	INIT_LIST_HEAD ( &cq->work_queues );
112
 	INIT_LIST_HEAD ( &cq->work_queues );
113
 	cq->op = op;
113
 	cq->op = op;
185
  * @v num_recv_wqes	Number of receive work queue entries
185
  * @v num_recv_wqes	Number of receive work queue entries
186
  * @v recv_cq		Receive completion queue
186
  * @v recv_cq		Receive completion queue
187
  * @v op		Queue pair operations
187
  * @v op		Queue pair operations
188
+ * @v name		Queue pair name
188
  * @ret qp		Queue pair
189
  * @ret qp		Queue pair
189
  *
190
  *
190
  * The queue pair will be left in the INIT state; you must call
191
  * The queue pair will be left in the INIT state; you must call
196
 				      struct ib_completion_queue *send_cq,
197
 				      struct ib_completion_queue *send_cq,
197
 				      unsigned int num_recv_wqes,
198
 				      unsigned int num_recv_wqes,
198
 				      struct ib_completion_queue *recv_cq,
199
 				      struct ib_completion_queue *recv_cq,
199
-				      struct ib_queue_pair_operations *op ) {
200
+				      struct ib_queue_pair_operations *op,
201
+				      const char *name ) {
200
 	struct ib_queue_pair *qp;
202
 	struct ib_queue_pair *qp;
201
 	size_t total_size;
203
 	size_t total_size;
202
 	int rc;
204
 	int rc;
211
 	if ( ! qp )
213
 	if ( ! qp )
212
 		goto err_alloc_qp;
214
 		goto err_alloc_qp;
213
 	qp->ibdev = ibdev;
215
 	qp->ibdev = ibdev;
214
-	list_add ( &qp->list, &ibdev->qps );
216
+	list_add_tail ( &qp->list, &ibdev->qps );
215
 	qp->type = type;
217
 	qp->type = type;
216
 	qp->send.qp = qp;
218
 	qp->send.qp = qp;
217
 	qp->send.is_send = 1;
219
 	qp->send.is_send = 1;
218
 	qp->send.cq = send_cq;
220
 	qp->send.cq = send_cq;
219
-	list_add ( &qp->send.list, &send_cq->work_queues );
221
+	list_add_tail ( &qp->send.list, &send_cq->work_queues );
220
 	qp->send.psn = ( random() & 0xffffffUL );
222
 	qp->send.psn = ( random() & 0xffffffUL );
221
 	qp->send.num_wqes = num_send_wqes;
223
 	qp->send.num_wqes = num_send_wqes;
222
 	qp->send.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) );
224
 	qp->send.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) );
223
 	qp->recv.qp = qp;
225
 	qp->recv.qp = qp;
224
 	qp->recv.cq = recv_cq;
226
 	qp->recv.cq = recv_cq;
225
-	list_add ( &qp->recv.list, &recv_cq->work_queues );
227
+	list_add_tail ( &qp->recv.list, &recv_cq->work_queues );
226
 	qp->recv.psn = ( random() & 0xffffffUL );
228
 	qp->recv.psn = ( random() & 0xffffffUL );
227
 	qp->recv.num_wqes = num_recv_wqes;
229
 	qp->recv.num_wqes = num_recv_wqes;
228
 	qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) +
230
 	qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) +
229
 			    ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ));
231
 			    ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) ));
230
 	INIT_LIST_HEAD ( &qp->mgids );
232
 	INIT_LIST_HEAD ( &qp->mgids );
231
 	qp->op = op;
233
 	qp->op = op;
234
+	qp->name = name;
232
 
235
 
233
 	/* Perform device-specific initialisation and get QPN */
236
 	/* Perform device-specific initialisation and get QPN */
234
 	if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
237
 	if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) {
756
 		goto err_alloc_mgid;
759
 		goto err_alloc_mgid;
757
 	}
760
 	}
758
 	memcpy ( &mgid->gid, gid, sizeof ( mgid->gid ) );
761
 	memcpy ( &mgid->gid, gid, sizeof ( mgid->gid ) );
759
-	list_add ( &mgid->list, &qp->mgids );
762
+	list_add_tail ( &mgid->list, &qp->mgids );
760
 
763
 
761
 	/* Add to hardware multicast GID list */
764
 	/* Add to hardware multicast GID list */
762
 	if ( ( rc = ibdev->op->mcast_attach ( ibdev, qp, gid ) ) != 0 )
765
 	if ( ( rc = ibdev->op->mcast_attach ( ibdev, qp, gid ) ) != 0 )

+ 1
- 1
src/net/infiniband/ib_cmrc.c View File

435
 	/* Create queue pair */
435
 	/* Create queue pair */
436
 	cmrc->qp = ib_create_qp ( ibdev, IB_QPT_RC, IB_CMRC_NUM_SEND_WQES,
436
 	cmrc->qp = ib_create_qp ( ibdev, IB_QPT_RC, IB_CMRC_NUM_SEND_WQES,
437
 				  cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq,
437
 				  cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq,
438
-				  &ib_cmrc_queue_pair_ops );
438
+				  &ib_cmrc_queue_pair_ops, name );
439
 	if ( ! cmrc->qp ) {
439
 	if ( ! cmrc->qp ) {
440
 		DBGC ( cmrc, "CMRC %s %s could not create queue pair\n",
440
 		DBGC ( cmrc, "CMRC %s %s could not create queue pair\n",
441
 		       ibdev->name, cmrc->name );
441
 		       ibdev->name, cmrc->name );

+ 4
- 2
src/net/infiniband/ib_mi.c View File

346
 struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev,
346
 struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev,
347
 					 enum ib_queue_pair_type type ) {
347
 					 enum ib_queue_pair_type type ) {
348
 	struct ib_mad_interface *mi;
348
 	struct ib_mad_interface *mi;
349
+	const char *name;
349
 	int rc;
350
 	int rc;
350
 
351
 
351
 	/* Allocate and initialise fields */
352
 	/* Allocate and initialise fields */
363
 	}
364
 	}
364
 
365
 
365
 	/* Create queue pair */
366
 	/* Create queue pair */
367
+	name = ( ( type == IB_QPT_SMI ) ? "SMI" : "GSI" );
366
 	mi->qp = ib_create_qp ( ibdev, type, IB_MI_NUM_SEND_WQES, mi->cq,
368
 	mi->qp = ib_create_qp ( ibdev, type, IB_MI_NUM_SEND_WQES, mi->cq,
367
 				IB_MI_NUM_RECV_WQES, mi->cq,
369
 				IB_MI_NUM_RECV_WQES, mi->cq,
368
-				&ib_mi_queue_pair_ops );
370
+				&ib_mi_queue_pair_ops, name );
369
 	if ( ! mi->qp ) {
371
 	if ( ! mi->qp ) {
370
 		DBGC ( mi, "MI %p could not allocate queue pair\n", mi );
372
 		DBGC ( mi, "MI %p could not allocate queue pair\n", mi );
371
 		goto err_create_qp;
373
 		goto err_create_qp;
372
 	}
374
 	}
373
 	ib_qp_set_ownerdata ( mi->qp, mi );
375
 	ib_qp_set_ownerdata ( mi->qp, mi );
374
 	DBGC ( mi, "MI %p (%s) running on QPN %#lx\n",
376
 	DBGC ( mi, "MI %p (%s) running on QPN %#lx\n",
375
-	       mi, ( ( type == IB_QPT_SMI ) ? "SMI" : "GSI" ), mi->qp->qpn );
377
+	       mi, mi->qp->name, mi->qp->qpn );
376
 
378
 
377
 	/* Set queue key */
379
 	/* Set queue key */
378
 	mi->qp->qkey = ( ( type == IB_QPT_SMI ) ? IB_QKEY_SMI : IB_QKEY_GSI );
380
 	mi->qp->qkey = ( ( type == IB_QPT_SMI ) ? IB_QKEY_SMI : IB_QKEY_GSI );

Loading…
Cancel
Save