Pārlūkot izejas kodu

[infiniband] Assign names to queue pairs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 gadus atpakaļ
vecāks
revīzija
6a3ffa0114

+ 1
- 1
src/drivers/infiniband/hermon.c Parādīt failu

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

+ 1
- 1
src/drivers/net/ipoib.c Parādīt failu

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

+ 3
- 1
src/include/ipxe/infiniband.h Parādīt failu

@@ -158,6 +158,8 @@ struct ib_queue_pair {
158 158
 	struct ib_device *ibdev;
159 159
 	/** List of queue pairs on this Infiniband device */
160 160
 	struct list_head list;
161
+	/** Queue pair name */
162
+	const char *name;
161 163
 	/** Queue pair number */
162 164
 	unsigned long qpn;
163 165
 	/** Externally-visible queue pair number
@@ -498,7 +500,7 @@ extern struct ib_queue_pair *
498 500
 ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
499 501
 	       unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
500 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 504
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
503 505
 extern void ib_destroy_qp ( struct ib_device *ibdev,
504 506
 			    struct ib_queue_pair *qp );

+ 9
- 6
src/net/infiniband.c Parādīt failu

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

+ 1
- 1
src/net/infiniband/ib_cmrc.c Parādīt failu

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

+ 4
- 2
src/net/infiniband/ib_mi.c Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt