diff --git a/src/drivers/net/ipoib.c b/src/drivers/net/ipoib.c index c5b2b432..4d9f21d7 100644 --- a/src/drivers/net/ipoib.c +++ b/src/drivers/net/ipoib.c @@ -519,7 +519,8 @@ static int ipoib_open ( struct net_device *netdev ) { } /* Allocate queue pair */ - ipoib->qp = ib_create_qp ( ibdev, IPOIB_NUM_SEND_WQES, ipoib->cq, + ipoib->qp = ib_create_qp ( ibdev, IB_QPT_UD, + IPOIB_NUM_SEND_WQES, ipoib->cq, IPOIB_NUM_RECV_WQES, ipoib->cq, 0 ); if ( ! ipoib->qp ) { DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n", diff --git a/src/include/gpxe/ib_gma.h b/src/include/gpxe/ib_gma.h index d24b32db..9ba25ddf 100644 --- a/src/include/gpxe/ib_gma.h +++ b/src/include/gpxe/ib_gma.h @@ -18,6 +18,7 @@ struct ib_completion_queue; struct ib_queue_pair; union ib_mad; struct ib_gma; +enum ib_queue_pair_type; /** A GMA attribute handler */ struct ib_gma_handler { @@ -68,7 +69,7 @@ struct ib_gma { extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad, struct ib_address_vector *av, int retry ); extern int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev, - unsigned long qkey ); + enum ib_queue_pair_type type ); extern void ib_destroy_gma ( struct ib_gma *gma ); #endif /* _GPXE_IB_GMA_H */ diff --git a/src/include/gpxe/infiniband.h b/src/include/gpxe/infiniband.h index c00388e5..80e59bf5 100644 --- a/src/include/gpxe/infiniband.h +++ b/src/include/gpxe/infiniband.h @@ -83,6 +83,13 @@ struct ib_multicast_gid { struct ib_gid gid; }; +/** An Infiniband queue pair type */ +enum ib_queue_pair_type { + IB_QPT_SMA, + IB_QPT_GMA, + IB_QPT_UD, +}; + /** An Infiniband Queue Pair */ struct ib_queue_pair { /** Containing Infiniband device */ @@ -91,6 +98,8 @@ struct ib_queue_pair { struct list_head list; /** Queue Pair Number */ unsigned long qpn; + /** Queue pair type */ + enum ib_queue_pair_type type; /** Queue key */ unsigned long qkey; /** Send queue */ @@ -395,9 +404,10 @@ extern void ib_destroy_cq ( struct ib_device *ibdev, extern void ib_poll_cq ( struct ib_device *ibdev, struct ib_completion_queue *cq ); extern 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, unsigned long qkey ); +ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type, + unsigned int num_send_wqes, struct ib_completion_queue *send_cq, + unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq, + unsigned long qkey ); extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp, unsigned long mod_list, unsigned long qkey ); extern void ib_destroy_qp ( struct ib_device *ibdev, diff --git a/src/net/infiniband.c b/src/net/infiniband.c index f7f86cab..42ffbcec 100644 --- a/src/net/infiniband.c +++ b/src/net/infiniband.c @@ -143,6 +143,7 @@ void ib_poll_cq ( struct ib_device *ibdev, * Create queue pair * * @v ibdev Infiniband device + * @v type Queue pair type * @v num_send_wqes Number of send work queue entries * @v send_cq Send completion queue * @v num_recv_wqes Number of receive work queue entries @@ -151,6 +152,7 @@ void ib_poll_cq ( struct ib_device *ibdev, * @ret qp Queue pair */ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev, + enum ib_queue_pair_type type, unsigned int num_send_wqes, struct ib_completion_queue *send_cq, unsigned int num_recv_wqes, @@ -171,6 +173,7 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev, goto err_alloc_qp; qp->ibdev = ibdev; list_add ( &qp->list, &ibdev->qps ); + qp->type = type; qp->qkey = qkey; qp->send.qp = qp; qp->send.is_send = 1; @@ -515,7 +518,7 @@ int ib_open ( struct ib_device *ibdev ) { } /* Create general management agent */ - if ( ( rc = ib_create_gma ( &ibdev->gma, ibdev, IB_QKEY_GMA ) ) != 0 ){ + if ( ( rc = ib_create_gma ( &ibdev->gma, ibdev, IB_QPT_GMA ) ) != 0 ) { DBGC ( ibdev, "IBDEV %p could not create GMA: %s\n", ibdev, strerror ( rc ) ); goto err_create_gma; diff --git a/src/net/infiniband/ib_gma.c b/src/net/infiniband/ib_gma.c index 649533ab..1968bc27 100644 --- a/src/net/infiniband/ib_gma.c +++ b/src/net/infiniband/ib_gma.c @@ -343,11 +343,12 @@ int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad, * * @v gma General management agent * @v ibdev Infiniband device - * @v qkey Queue key + * @v type Queue pair type * @ret rc Return status code */ int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev, - unsigned long qkey ) { + enum ib_queue_pair_type type ) { + unsigned long qkey; int rc; /* Initialise fields */ @@ -366,7 +367,8 @@ int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev, } /* Create queue pair */ - gma->qp = ib_create_qp ( ibdev, IB_GMA_NUM_SEND_WQES, gma->cq, + qkey = ( ( type == IB_QPT_SMA ) ? IB_QKEY_SMA : IB_QKEY_GMA ); + gma->qp = ib_create_qp ( ibdev, type, IB_GMA_NUM_SEND_WQES, gma->cq, IB_GMA_NUM_RECV_WQES, gma->cq, qkey ); if ( ! gma->qp ) { DBGC ( gma, "GMA %p could not allocate queue pair\n", gma ); diff --git a/src/net/infiniband/ib_sma.c b/src/net/infiniband/ib_sma.c index 9e99703f..8fb33241 100644 --- a/src/net/infiniband/ib_sma.c +++ b/src/net/infiniband/ib_sma.c @@ -286,7 +286,7 @@ int ib_create_sma ( struct ib_sma *sma, struct ib_device *ibdev ) { int rc; /* Initialise GMA */ - if ( ( rc = ib_create_gma ( &sma->gma, ibdev, 0 ) ) != 0 ) { + if ( ( rc = ib_create_gma ( &sma->gma, ibdev, IB_QPT_SMA ) ) != 0 ) { DBGC ( sma, "SMA %p could not create GMA: %s\n", sma, strerror ( rc ) ); goto err_create_gma;