Bläddra i källkod

[infiniband] Allow completion queue operations to be optional

The send completion handler typically will just free the I/O buffer,
so allow this common case to be handled by the Infiniband core.
tags/v0.9.8
Michael Brown 15 år sedan
förälder
incheckning
3f4972db9a
2 ändrade filer med 12 tillägg och 24 borttagningar
  1. 12
    2
      src/net/infiniband.c
  2. 0
    22
      src/net/infiniband/ib_gma.c

+ 12
- 2
src/net/infiniband.c Visa fil

424
  */
424
  */
425
 void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
425
 void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
426
 			struct io_buffer *iobuf, int rc ) {
426
 			struct io_buffer *iobuf, int rc ) {
427
-	qp->send.cq->op->complete_send ( ibdev, qp, iobuf, rc );
427
+
428
+	if ( qp->send.cq->op->complete_send ) {
429
+		qp->send.cq->op->complete_send ( ibdev, qp, iobuf, rc );
430
+	} else {
431
+		free_iob ( iobuf );
432
+	}
428
 	qp->send.fill--;
433
 	qp->send.fill--;
429
 }
434
 }
430
 
435
 
440
 void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
445
 void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
441
 			struct ib_address_vector *av,
446
 			struct ib_address_vector *av,
442
 			struct io_buffer *iobuf, int rc ) {
447
 			struct io_buffer *iobuf, int rc ) {
443
-	qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
448
+
449
+	if ( qp->recv.cq->op->complete_recv ) {
450
+		qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
451
+	} else {
452
+		free_iob ( iobuf );
453
+	}
444
 	qp->recv.fill--;
454
 	qp->recv.fill--;
445
 }
455
 }
446
 
456
 

+ 0
- 22
src/net/infiniband/ib_gma.c Visa fil

207
 	free_iob ( iobuf );
207
 	free_iob ( iobuf );
208
 }
208
 }
209
 
209
 
210
-/**
211
- * Complete GMA send
212
- *
213
- *
214
- * @v ibdev		Infiniband device
215
- * @v qp		Queue pair
216
- * @v iobuf		I/O buffer
217
- * @v rc		Completion status code
218
- */
219
-static void ib_gma_complete_send ( struct ib_device *ibdev __unused,
220
-				   struct ib_queue_pair *qp,
221
-				   struct io_buffer *iobuf, int rc ) {
222
-	struct ib_gma *gma = ib_qp_get_ownerdata ( qp );
223
-
224
-	if ( rc != 0 ) {
225
-		DBGC ( gma, "GMA %p send completion error: %s\n",
226
-		       gma, strerror ( rc ) );
227
-	}
228
-	free_iob ( iobuf );
229
-}
230
-
231
 /** GMA completion operations */
210
 /** GMA completion operations */
232
 static struct ib_completion_queue_operations ib_gma_completion_ops = {
211
 static struct ib_completion_queue_operations ib_gma_completion_ops = {
233
-	.complete_send = ib_gma_complete_send,
234
 	.complete_recv = ib_gma_complete_recv,
212
 	.complete_recv = ib_gma_complete_recv,
235
 };
213
 };
236
 
214
 

Laddar…
Avbryt
Spara