瀏覽代碼

[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 年之前
父節點
當前提交
3f4972db9a
共有 2 個檔案被更改,包括 12 行新增24 行删除
  1. 12
    2
      src/net/infiniband.c
  2. 0
    22
      src/net/infiniband/ib_gma.c

+ 12
- 2
src/net/infiniband.c 查看文件

@@ -424,7 +424,12 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
424 424
  */
425 425
 void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
426 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 433
 	qp->send.fill--;
429 434
 }
430 435
 
@@ -440,7 +445,12 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
440 445
 void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
441 446
 			struct ib_address_vector *av,
442 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 454
 	qp->recv.fill--;
445 455
 }
446 456
 

+ 0
- 22
src/net/infiniband/ib_gma.c 查看文件

@@ -207,30 +207,8 @@ static void ib_gma_complete_recv ( struct ib_device *ibdev,
207 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 210
 /** GMA completion operations */
232 211
 static struct ib_completion_queue_operations ib_gma_completion_ops = {
233
-	.complete_send = ib_gma_complete_send,
234 212
 	.complete_recv = ib_gma_complete_recv,
235 213
 };
236 214
 

Loading…
取消
儲存