opal/mca/common/libfabric/libfabric/prov/usnic/src/usnic_direct/usd_ib_cmd.c
/*
 * Make the verbs call to create a CQ
 */
Make the verbs call to create a CQ
Make the verbs call to create a CQ
int
usd_ib_cmd_create_cq(
    struct usd_device *dev,
    struct usd_cq_impl *cq)
{
    struct usnic_create_cq cmd;
    struct usnic_create_cq_resp resp;
    struct ibv_create_cq *icp;
    struct ibv_create_cq_resp *irp;
    int n;
    memset(&cmd, 0, sizeof(cmd));
    memset(&resp, 0, sizeof(resp));
    icp = &cmd.ibv_cmd;
    icp->command = IB_USER_VERBS_CMD_CREATE_CQ;
    icp->in_words = sizeof(cmd) / 4;
    icp->out_words = sizeof(resp) / 4;
    icp->response = (uintptr_t) & resp;
    icp->user_handle = (uintptr_t) cq;
    icp->cqe = cq->ucq_num_entries;
    icp->comp_channel = -1;
    icp->comp_vector = 0;
    n = write(dev->ud_ib_dev_fd, &cmd, sizeof(cmd));
    if (n != sizeof(cmd)) {
        return -errno;
    }
    irp = &resp.ibv_resp;
    cq->ucq_handle = irp->cq_handle;
    return 0;
}
int usd_ib_cmd_create_cq ( struct usd_device * dev , struct usd_cq_impl * cq ) { struct usnic_create_cq cmd ; struct usnic_create_cq_resp resp ; struct ibv_create_cq * icp ; struct ibv_create_cq_resp * irp ; int n ; memset ( & cmd , 0 , sizeof ( cmd ) ) ; memset ( & resp , 0 , sizeof ( resp ) ) ; icp = & cmd . ibv_cmd ; icp -> command = IB_USER_VERBS_CMD_CREATE_CQ ; icp -> in_words = sizeof ( cmd ) / 4 ; icp -> out_words = sizeof ( resp ) / 4 ; icp -> response = ( uintptr_t ) & resp ; icp -> user_handle = ( uintptr_t ) cq ; icp -> cqe = cq -> ucq_num_entries ; icp -> comp_channel = -1 ; icp -> comp_vector = 0 ; n = write ( dev -> ud_ib_dev_fd , & cmd , sizeof ( cmd ) ) ; if ( n != sizeof ( cmd ) ) { return - errno ; } irp = & resp . ibv_resp ; cq -> ucq_handle = irp -> cq_handle ; return 0 ; }
Make the verbs call to create a CQ
Make the verbs call to create a CQ
/* Issue command to IB driver */ /* process response */