[infiniband] Add notion of a queue pair type
This commit is contained in:
parent
3f4972db9a
commit
80c41b90d2
|
@ -519,7 +519,8 @@ static int ipoib_open ( struct net_device *netdev ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate queue pair */
|
/* 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 );
|
IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
|
||||||
if ( ! ipoib->qp ) {
|
if ( ! ipoib->qp ) {
|
||||||
DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
|
DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct ib_completion_queue;
|
||||||
struct ib_queue_pair;
|
struct ib_queue_pair;
|
||||||
union ib_mad;
|
union ib_mad;
|
||||||
struct ib_gma;
|
struct ib_gma;
|
||||||
|
enum ib_queue_pair_type;
|
||||||
|
|
||||||
/** A GMA attribute handler */
|
/** A GMA attribute handler */
|
||||||
struct ib_gma_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,
|
extern int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
|
||||||
struct ib_address_vector *av, int retry );
|
struct ib_address_vector *av, int retry );
|
||||||
extern int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
|
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 );
|
extern void ib_destroy_gma ( struct ib_gma *gma );
|
||||||
|
|
||||||
#endif /* _GPXE_IB_GMA_H */
|
#endif /* _GPXE_IB_GMA_H */
|
||||||
|
|
|
@ -83,6 +83,13 @@ struct ib_multicast_gid {
|
||||||
struct ib_gid 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 */
|
/** An Infiniband Queue Pair */
|
||||||
struct ib_queue_pair {
|
struct ib_queue_pair {
|
||||||
/** Containing Infiniband device */
|
/** Containing Infiniband device */
|
||||||
|
@ -91,6 +98,8 @@ struct ib_queue_pair {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
/** Queue Pair Number */
|
/** Queue Pair Number */
|
||||||
unsigned long qpn;
|
unsigned long qpn;
|
||||||
|
/** Queue pair type */
|
||||||
|
enum ib_queue_pair_type type;
|
||||||
/** Queue key */
|
/** Queue key */
|
||||||
unsigned long qkey;
|
unsigned long qkey;
|
||||||
/** Send queue */
|
/** Send queue */
|
||||||
|
@ -395,9 +404,10 @@ extern void ib_destroy_cq ( struct ib_device *ibdev,
|
||||||
extern void ib_poll_cq ( struct ib_device *ibdev,
|
extern void ib_poll_cq ( struct ib_device *ibdev,
|
||||||
struct ib_completion_queue *cq );
|
struct ib_completion_queue *cq );
|
||||||
extern struct ib_queue_pair *
|
extern struct ib_queue_pair *
|
||||||
ib_create_qp ( struct ib_device *ibdev, unsigned int num_send_wqes,
|
ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
|
||||||
struct ib_completion_queue *send_cq, unsigned int num_recv_wqes,
|
unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
|
||||||
struct ib_completion_queue *recv_cq, unsigned long qkey );
|
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,
|
extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
|
||||||
unsigned long mod_list, unsigned long qkey );
|
unsigned long mod_list, unsigned long qkey );
|
||||||
extern void ib_destroy_qp ( struct ib_device *ibdev,
|
extern void ib_destroy_qp ( struct ib_device *ibdev,
|
||||||
|
|
|
@ -143,6 +143,7 @@ void ib_poll_cq ( struct ib_device *ibdev,
|
||||||
* Create queue pair
|
* Create queue pair
|
||||||
*
|
*
|
||||||
* @v ibdev Infiniband device
|
* @v ibdev Infiniband device
|
||||||
|
* @v type Queue pair type
|
||||||
* @v num_send_wqes Number of send work queue entries
|
* @v num_send_wqes Number of send work queue entries
|
||||||
* @v send_cq Send completion queue
|
* @v send_cq Send completion queue
|
||||||
* @v num_recv_wqes Number of receive work queue entries
|
* @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
|
* @ret qp Queue pair
|
||||||
*/
|
*/
|
||||||
struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
|
struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
|
||||||
|
enum ib_queue_pair_type type,
|
||||||
unsigned int num_send_wqes,
|
unsigned int num_send_wqes,
|
||||||
struct ib_completion_queue *send_cq,
|
struct ib_completion_queue *send_cq,
|
||||||
unsigned int num_recv_wqes,
|
unsigned int num_recv_wqes,
|
||||||
|
@ -171,6 +173,7 @@ struct ib_queue_pair * ib_create_qp ( struct ib_device *ibdev,
|
||||||
goto err_alloc_qp;
|
goto err_alloc_qp;
|
||||||
qp->ibdev = ibdev;
|
qp->ibdev = ibdev;
|
||||||
list_add ( &qp->list, &ibdev->qps );
|
list_add ( &qp->list, &ibdev->qps );
|
||||||
|
qp->type = type;
|
||||||
qp->qkey = qkey;
|
qp->qkey = qkey;
|
||||||
qp->send.qp = qp;
|
qp->send.qp = qp;
|
||||||
qp->send.is_send = 1;
|
qp->send.is_send = 1;
|
||||||
|
@ -515,7 +518,7 @@ int ib_open ( struct ib_device *ibdev ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create general management agent */
|
/* 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",
|
DBGC ( ibdev, "IBDEV %p could not create GMA: %s\n",
|
||||||
ibdev, strerror ( rc ) );
|
ibdev, strerror ( rc ) );
|
||||||
goto err_create_gma;
|
goto err_create_gma;
|
||||||
|
|
|
@ -343,11 +343,12 @@ int ib_gma_request ( struct ib_gma *gma, union ib_mad *mad,
|
||||||
*
|
*
|
||||||
* @v gma General management agent
|
* @v gma General management agent
|
||||||
* @v ibdev Infiniband device
|
* @v ibdev Infiniband device
|
||||||
* @v qkey Queue key
|
* @v type Queue pair type
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
|
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;
|
int rc;
|
||||||
|
|
||||||
/* Initialise fields */
|
/* Initialise fields */
|
||||||
|
@ -366,7 +367,8 @@ int ib_create_gma ( struct ib_gma *gma, struct ib_device *ibdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create queue pair */
|
/* 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 );
|
IB_GMA_NUM_RECV_WQES, gma->cq, qkey );
|
||||||
if ( ! gma->qp ) {
|
if ( ! gma->qp ) {
|
||||||
DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );
|
DBGC ( gma, "GMA %p could not allocate queue pair\n", gma );
|
||||||
|
|
|
@ -286,7 +286,7 @@ int ib_create_sma ( struct ib_sma *sma, struct ib_device *ibdev ) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Initialise GMA */
|
/* 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",
|
DBGC ( sma, "SMA %p could not create GMA: %s\n",
|
||||||
sma, strerror ( rc ) );
|
sma, strerror ( rc ) );
|
||||||
goto err_create_gma;
|
goto err_create_gma;
|
||||||
|
|
Reference in New Issue