}
/* 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",
struct ib_queue_pair;
union ib_mad;
struct ib_gma;
+enum ib_queue_pair_type;
/** A GMA attribute handler */
struct ib_gma_handler {
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 */
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 */
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 */
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,
* 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
* @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,
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;
}
/* 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;
*
* @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 */
}
/* 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 );
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;