Przeglądaj źródła

[infiniband] Add notion of a queue pair type

tags/v0.9.8
Michael Brown 15 lat temu
rodzic
commit
80c41b90d2

+ 2
- 1
src/drivers/net/ipoib.c Wyświetl plik

519
 	}
519
 	}
520
 
520
 
521
 	/* Allocate queue pair */
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
 				   IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
524
 				   IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
524
 	if ( ! ipoib->qp ) {
525
 	if ( ! ipoib->qp ) {
525
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
526
 		DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",

+ 2
- 1
src/include/gpxe/ib_gma.h Wyświetl plik

18
 struct ib_queue_pair;
18
 struct ib_queue_pair;
19
 union ib_mad;
19
 union ib_mad;
20
 struct ib_gma;
20
 struct ib_gma;
21
+enum ib_queue_pair_type;
21
 
22
 
22
 /** A GMA attribute handler */
23
 /** A GMA attribute handler */
23
 struct ib_gma_handler {
24
 struct ib_gma_handler {
68
 extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
69
 extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
69
 			    struct ib_address_vector *av, int retry );
70
 			    struct ib_address_vector *av, int retry );
70
 extern int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
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
 extern void ib_destroy_gma ( struct ib_gma *gma );
73
 extern void ib_destroy_gma ( struct ib_gma *gma );
73
 
74
 
74
 #endif /* _GPXE_IB_GMA_H */
75
 #endif /* _GPXE_IB_GMA_H */

+ 13
- 3
src/include/gpxe/infiniband.h Wyświetl plik

83
 	struct ib_gid gid;
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
 /** An Infiniband Queue Pair */
93
 /** An Infiniband Queue Pair */
87
 struct ib_queue_pair {
94
 struct ib_queue_pair {
88
 	/** Containing Infiniband device */
95
 	/** Containing Infiniband device */
91
 	struct list_head list;
98
 	struct list_head list;
92
 	/** Queue Pair Number */
99
 	/** Queue Pair Number */
93
 	unsigned long qpn;
100
 	unsigned long qpn;
101
+	/** Queue pair type */
102
+	enum ib_queue_pair_type type;
94
 	/** Queue key */
103
 	/** Queue key */
95
 	unsigned long qkey;
104
 	unsigned long qkey;
96
 	/** Send queue */
105
 	/** Send queue */
395
 extern void ib_poll_cq ( struct ib_device *ibdev,
404
 extern void ib_poll_cq ( struct ib_device *ibdev,
396
 			 struct ib_completion_queue *cq );
405
 			 struct ib_completion_queue *cq );
397
 extern struct ib_queue_pair *
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
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
411
 extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
402
 			  unsigned long mod_list, unsigned long qkey );
412
 			  unsigned long mod_list, unsigned long qkey );
403
 extern void ib_destroy_qp ( struct ib_device *ibdev,
413
 extern void ib_destroy_qp ( struct ib_device *ibdev,

+ 4
- 1
src/net/infiniband.c Wyświetl plik

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

+ 5
- 3
src/net/infiniband/ib_gma.c Wyświetl plik

343
  *
343
  *
344
  * @v gma		General management agent
344
  * @v gma		General management agent
345
  * @v ibdev		Infiniband device
345
  * @v ibdev		Infiniband device
346
- * @v qkey		Queue key
346
+ * @v type		Queue pair type
347
  * @ret rc		Return status code
347
  * @ret rc		Return status code
348
  */
348
  */
349
 int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
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
 	int rc;
352
 	int rc;
352
 
353
 
353
 	/* Initialise fields */
354
 	/* Initialise fields */
366
 	}
367
 	}
367
 
368
 
368
 	/* Create queue pair */
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
 				 IB_GMA_NUM_RECV_WQES, gma->cq, qkey );
372
 				 IB_GMA_NUM_RECV_WQES, gma->cq, qkey );
371
 	if ( ! gma->qp ) {
373
 	if ( ! gma->qp ) {
372
 		DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );
374
 		DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );

+ 1
- 1
src/net/infiniband/ib_sma.c Wyświetl plik

286
 	int rc;
286
 	int rc;
287
 
287
 
288
 	/* Initialise GMA */
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
 		DBGC ( sma, "SMA %p could not create GMA: %s\n",
290
 		DBGC ( sma, "SMA %p could not create GMA: %s\n",
291
 		       sma, strerror ( rc ) );
291
 		       sma, strerror ( rc ) );
292
 		goto err_create_gma;
292
 		goto err_create_gma;

Ładowanie…
Anuluj
Zapisz