summaryrefslogtreecommitdiffstats
path: root/src/net/infiniband.c
diff options
context:
space:
mode:
authorMichael Brown2009-07-08 12:50:47 +0200
committerMichael Brown2009-07-18 00:06:34 +0200
commit3f4972db9abd8f5f0099685a112ef859a61a8cce (patch)
tree75f2ccd776133682f35c0ba7b53acaf7eff7260b /src/net/infiniband.c
parent[infiniband] Improve ib_packet debugging messages (diff)
downloadipxe-3f4972db9abd8f5f0099685a112ef859a61a8cce.tar.gz
ipxe-3f4972db9abd8f5f0099685a112ef859a61a8cce.tar.xz
ipxe-3f4972db9abd8f5f0099685a112ef859a61a8cce.zip
[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.
Diffstat (limited to 'src/net/infiniband.c')
-rw-r--r--src/net/infiniband.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c
index 38aaf9fc..f7f86cab 100644
--- a/src/net/infiniband.c
+++ b/src/net/infiniband.c
@@ -424,7 +424,12 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
*/
void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct io_buffer *iobuf, int rc ) {
- qp->send.cq->op->complete_send ( ibdev, qp, iobuf, rc );
+
+ if ( qp->send.cq->op->complete_send ) {
+ qp->send.cq->op->complete_send ( ibdev, qp, iobuf, rc );
+ } else {
+ free_iob ( iobuf );
+ }
qp->send.fill--;
}
@@ -440,7 +445,12 @@ void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
struct ib_address_vector *av,
struct io_buffer *iobuf, int rc ) {
- qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
+
+ if ( qp->recv.cq->op->complete_recv ) {
+ qp->recv.cq->op->complete_recv ( ibdev, qp, av, iobuf, rc );
+ } else {
+ free_iob ( iobuf );
+ }
qp->recv.fill--;
}