diff options
| author | Michael Brown | 2012-08-29 23:11:58 +0200 |
|---|---|---|
| committer | Michael Brown | 2012-08-31 22:22:57 +0200 |
| commit | f747fac3e1dad31378579326d8e9dce0df85c214 (patch) | |
| tree | 68393b4686b7d28737b16b26c6f49c4d2db431d0 /src/net | |
| parent | [iobuf] Allow allocation of I/O buffers with a specified alignment offset (diff) | |
| download | ipxe-f747fac3e1dad31378579326d8e9dce0df85c214.tar.gz ipxe-f747fac3e1dad31378579326d8e9dce0df85c214.tar.xz ipxe-f747fac3e1dad31378579326d8e9dce0df85c214.zip | |
[infiniband] Allow queue pairs to have a custom allocator for receive iobufs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/infiniband.c | 7 | ||||
| -rw-r--r-- | src/net/infiniband/ib_cmrc.c | 8 | ||||
| -rw-r--r-- | src/net/infiniband/ib_mi.c | 8 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/net/infiniband.c b/src/net/infiniband.c index c17b6181d..a50b7a035 100644 --- a/src/net/infiniband.c +++ b/src/net/infiniband.c @@ -168,6 +168,7 @@ void ib_poll_cq ( struct ib_device *ibdev, * @v send_cq Send completion queue * @v num_recv_wqes Number of receive work queue entries * @v recv_cq Receive completion queue + * @v op Queue pair operations * @ret qp Queue pair * * The queue pair will be left in the INIT state; you must call @@ -178,7 +179,8 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev, unsigned int num_send_wqes, struct ib_completion_queue *send_cq, unsigned int num_recv_wqes, - struct ib_completion_queue *recv_cq ) { + struct ib_completion_queue *recv_cq, + struct ib_queue_pair_operations *op ) { struct ib_queue_pair *qp; size_t total_size; int rc; @@ -210,6 +212,7 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev, qp->recv.iobufs = ( ( ( void * ) qp ) + sizeof ( *qp ) + ( num_send_wqes * sizeof ( qp->send.iobufs[0] ) )); INIT_LIST_HEAD ( &qp->mgids ); + qp->op = op; /* Perform device-specific initialisation and get QPN */ if ( ( rc = ibdev->op->create_qp ( ibdev, qp ) ) != 0 ) { @@ -514,7 +517,7 @@ void ib_refill_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp ) { while ( qp->recv.fill < qp->recv.num_wqes ) { /* Allocate I/O buffer */ - iobuf = alloc_iob ( IB_MAX_PAYLOAD_SIZE ); + iobuf = qp->op->alloc_iob ( IB_MAX_PAYLOAD_SIZE ); if ( ! iobuf ) { /* Non-fatal; we will refill on next attempt */ return; diff --git a/src/net/infiniband/ib_cmrc.c b/src/net/infiniband/ib_cmrc.c index 369e2e906..dd623ddbf 100644 --- a/src/net/infiniband/ib_cmrc.c +++ b/src/net/infiniband/ib_cmrc.c @@ -257,6 +257,11 @@ static struct ib_completion_queue_operations ib_cmrc_completion_ops = { .complete_recv = ib_cmrc_complete_recv, }; +/** Infiniband CMRC queue pair operations */ +static struct ib_queue_pair_operations ib_cmrc_queue_pair_ops = { + .alloc_iob = alloc_iob, +}; + /** * Send data via CMRC * @@ -410,7 +415,8 @@ int ib_cmrc_open ( struct interface *xfer, struct ib_device *ibdev, /* Create queue pair */ cmrc->qp = ib_create_qp ( ibdev, IB_QPT_RC, IB_CMRC_NUM_SEND_WQES, - cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq ); + cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq, + &ib_cmrc_queue_pair_ops ); if ( ! cmrc->qp ) { DBGC ( cmrc, "CMRC %p could not create queue pair\n", cmrc ); rc = -ENOMEM; diff --git a/src/net/infiniband/ib_mi.c b/src/net/infiniband/ib_mi.c index ced2eea17..31fe71a48 100644 --- a/src/net/infiniband/ib_mi.c +++ b/src/net/infiniband/ib_mi.c @@ -164,6 +164,11 @@ static struct ib_completion_queue_operations ib_mi_completion_ops = { .complete_recv = ib_mi_complete_recv, }; +/** Management interface queue pair operations */ +static struct ib_queue_pair_operations ib_mi_queue_pair_ops = { + .alloc_iob = alloc_iob, +}; + /** * Transmit MAD * @@ -353,7 +358,8 @@ struct ib_mad_interface * ib_create_mi ( struct ib_device *ibdev, /* Create queue pair */ mi->qp = ib_create_qp ( ibdev, type, IB_MI_NUM_SEND_WQES, mi->cq, - IB_MI_NUM_RECV_WQES, mi->cq ); + IB_MI_NUM_RECV_WQES, mi->cq, + &ib_mi_queue_pair_ops ); if ( ! mi->qp ) { DBGC ( mi, "MI %p could not allocate queue pair\n", mi ); goto err_create_qp; |
