Selaa lähdekoodia

[infiniband] Add notion of a queue pair type

tags/v0.9.8
Michael Brown 15 vuotta sitten
vanhempi
commit
80c41b90d2

+ 2
- 1
src/drivers/net/ipoib.c Näytä tiedosto

@@ -519,7 +519,8 @@ static int ipoib_open ( struct net_device *netdev ) {
519 519
 	}
520 520
 
521 521
 	/* Allocate queue pair */
522
-	ipoib->qp = ib_create_qp ( ibdev, IPOIB_NUM_SEND_WQES, ipoib->cq,
522
+	ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD,
523
+				   IPOIB_NUM_SEND_WQES, ipoib->cq,
523 524
 				   IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
524 525
 	if ( ! ipoib->qp ) {
525 526
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",

+ 2
- 1
src/include/gpxe/ib_gma.h Näytä tiedosto

@@ -18,6 +18,7 @@ struct ib_completion_queue;
18 18
 struct ib_queue_pair;
19 19
 union ib_mad;
20 20
 struct ib_gma;
21
+enum ib_queue_pair_type;
21 22
 
22 23
 /** A GMA attribute handler */
23 24
 struct ib_gma_handler {
@@ -68,7 +69,7 @@ struct ib_gma {
68 69
 extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
69 70
 			    struct ib_address_vector *av, int retry );
70 71
 extern int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
71
-			   unsigned long qkey );
72
+			   enum ib_queue_pair_type type );
72 73
 extern void ib_destroy_gma ( struct ib_gma *gma );
73 74
 
74 75
 #endif /* _GPXE_IB_GMA_H */

+ 13
- 3
src/include/gpxe/infiniband.h Näytä tiedosto

@@ -83,6 +83,13 @@ struct ib_multicast_gid {
83 83
 	struct ib_gid gid;
84 84
 };
85 85
 
86
+/** An Infiniband queue pair type */
87
+enum ib_queue_pair_type {
88
+	IB_QPT_SMA,
89
+	IB_QPT_GMA,
90
+	IB_QPT_UD,
91
+};
92
+
86 93
 /** An Infiniband Queue Pair */
87 94
 struct ib_queue_pair {
88 95
 	/** Containing Infiniband device */
@@ -91,6 +98,8 @@ struct ib_queue_pair {
91 98
 	struct list_head list;
92 99
 	/** Queue Pair Number */
93 100
 	unsigned long qpn;
101
+	/** Queue pair type */
102
+	enum ib_queue_pair_type type;
94 103
 	/** Queue key */
95 104
 	unsigned long qkey;
96 105
 	/** Send queue */
@@ -395,9 +404,10 @@ extern void ib_destroy_cq ( struct ib_device *ibdev,
395 404
 extern void ib_poll_cq ( struct ib_device *ibdev,
396 405
 			 struct ib_completion_queue *cq );
397 406
 extern struct ib_queue_pair *
398
-ib_create_qp ( struct ib_device *ibdev, unsigned int num_send_wqes,
399
-	       struct ib_completion_queue *send_cq, unsigned int num_recv_wqes,
400
-	       struct ib_completion_queue *recv_cq, unsigned long qkey );
407
+ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
408
+	       unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
409
+	       unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
410
+	       unsigned long qkey );
401 411
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
402 412
 			  unsigned long mod_list, unsigned long qkey );
403 413
 extern void ib_destroy_qp ( struct ib_device *ibdev,

+ 4
- 1
src/net/infiniband.c Näytä tiedosto

@@ -143,6 +143,7 @@ void ib_poll_cq ( struct ib_device *ibdev,
143 143
  * Create queue pair
144 144
  *
145 145
  * @v ibdev		Infiniband device
146
+ * @v type		Queue pair type
146 147
  * @v num_send_wqes	Number of send work queue entries
147 148
  * @v send_cq		Send completion queue
148 149
  * @v num_recv_wqes	Number of receive work queue entries
@@ -151,6 +152,7 @@ void ib_poll_cq ( struct ib_device *ibdev,
151 152
  * @ret qp		Queue pair
152 153
  */
153 154
 struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
155
+				      enum ib_queue_pair_type type,
154 156
 				      unsigned int num_send_wqes,
155 157
 				      struct ib_completion_queue *send_cq,
156 158
 				      unsigned int num_recv_wqes,
@@ -171,6 +173,7 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
171 173
 		goto err_alloc_qp;
172 174
 	qp->ibdev = ibdev;
173 175
 	list_add ( &qp->list, &ibdev->qps );
176
+	qp->type = type;
174 177
 	qp->qkey = qkey;
175 178
 	qp->send.qp = qp;
176 179
 	qp->send.is_send = 1;
@@ -515,7 +518,7 @@ int ib_open ( struct ib_device *ibdev ) {
515 518
 	}
516 519
 
517 520
 	/* Create general management agent */
518
-	if ( ( rc = ib_create_gma ( &ibdev->gma, ibdev, IB_QKEY_GMA ) ) != 0 ){
521
+	if ( ( rc = ib_create_gma ( &ibdev->gma, ibdev, IB_QPT_GMA ) ) != 0 ) {
519 522
 		DBGC ( ibdev, "IBDEV %p could not create GMA: %s\n",
520 523
 		       ibdev, strerror ( rc ) );
521 524
 		goto err_create_gma;

+ 5
- 3
src/net/infiniband/ib_gma.c Näytä tiedosto

@@ -343,11 +343,12 @@ int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
343 343
  *
344 344
  * @v gma		General management agent
345 345
  * @v ibdev		Infiniband device
346
- * @v qkey		Queue key
346
+ * @v type		Queue pair type
347 347
  * @ret rc		Return status code
348 348
  */
349 349
 int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
350
-		    unsigned long qkey ) {
350
+		    enum ib_queue_pair_type type ) {
351
+	unsigned long qkey;
351 352
 	int rc;
352 353
 
353 354
 	/* Initialise fields */
@@ -366,7 +367,8 @@ int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
366 367
 	}
367 368
 
368 369
 	/* Create queue pair */
369
-	gma->qp = ib_create_qp ( ibdev, IB_GMA_NUM_SEND_WQES, gma->cq,
370
+	qkey = ( ( type == IB_QPT_SMA ) ? IB_QKEY_SMA : IB_QKEY_GMA );
371
+	gma->qp = ib_create_qp ( ibdev, type, IB_GMA_NUM_SEND_WQES, gma->cq,
370 372
 				 IB_GMA_NUM_RECV_WQES, gma->cq, qkey );
371 373
 	if ( ! gma->qp ) {
372 374
 		DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );

+ 1
- 1
src/net/infiniband/ib_sma.c Näytä tiedosto

@@ -286,7 +286,7 @@ int ib_create_sma ( struct ib_sma *sma, struct ib_device *ibdev ) {
286 286
 	int rc;
287 287
 
288 288
 	/* Initialise GMA */
289
-	if ( ( rc = ib_create_gma ( &sma->gma, ibdev, 0 ) ) != 0 ) {
289
+	if ( ( rc = ib_create_gma ( &sma->gma, ibdev, IB_QPT_SMA ) ) != 0 ) {
290 290
 		DBGC ( sma, "SMA %p could not create GMA: %s\n",
291 291
 		       sma, strerror ( rc ) );
292 292
 		goto err_create_gma;

Loading…
Peruuta
Tallenna