mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 20:10:18 +03:00
[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.
This commit is contained in:
@@ -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,
|
void ib_complete_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
struct io_buffer *iobuf, int rc ) {
|
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--;
|
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,
|
void ib_complete_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
struct ib_address_vector *av,
|
struct ib_address_vector *av,
|
||||||
struct io_buffer *iobuf, int rc ) {
|
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--;
|
qp->recv.fill--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,30 +207,8 @@ static void ib_gma_complete_recv ( struct ib_device *ibdev,
|
|||||||
free_iob ( iobuf );
|
free_iob ( iobuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Complete GMA send
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @v ibdev Infiniband device
|
|
||||||
* @v qp Queue pair
|
|
||||||
* @v iobuf I/O buffer
|
|
||||||
* @v rc Completion status code
|
|
||||||
*/
|
|
||||||
static void ib_gma_complete_send ( struct ib_device *ibdev __unused,
|
|
||||||
struct ib_queue_pair *qp,
|
|
||||||
struct io_buffer *iobuf, int rc ) {
|
|
||||||
struct ib_gma *gma = ib_qp_get_ownerdata ( qp );
|
|
||||||
|
|
||||||
if ( rc != 0 ) {
|
|
||||||
DBGC ( gma, "GMA %p send completion error: %s\n",
|
|
||||||
gma, strerror ( rc ) );
|
|
||||||
}
|
|
||||||
free_iob ( iobuf );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** GMA completion operations */
|
/** GMA completion operations */
|
||||||
static struct ib_completion_queue_operations ib_gma_completion_ops = {
|
static struct ib_completion_queue_operations ib_gma_completion_ops = {
|
||||||
.complete_send = ib_gma_complete_send,
|
|
||||||
.complete_recv = ib_gma_complete_recv,
|
.complete_recv = ib_gma_complete_recv,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user