iPXE
Data Structures | Functions
ib_cm.h File Reference

Infiniband communication management. More...

#include <ipxe/infiniband.h>
#include <ipxe/retry.h>

Go to the source code of this file.

Data Structures

struct  ib_connection_operations
 Infiniband connection operations. More...
struct  ib_connection
 An Infiniband connection. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
struct ib_connectionib_create_conn (struct ib_device *ibdev, struct ib_queue_pair *qp, union ib_gid *dgid, union ib_guid *service_id, void *req_private_data, size_t req_private_data_len, struct ib_connection_operations *op)
 Create connection to remote QP.
void ib_destroy_conn (struct ib_device *ibdev, struct ib_queue_pair *qp, struct ib_connection *conn)

Detailed Description

Infiniband communication management.

Definition in file ib_cm.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
struct ib_connection* ib_create_conn ( struct ib_device ibdev,
struct ib_queue_pair qp,
union ib_gid dgid,
union ib_guid service_id,
void *  private_data,
size_t  private_data_len,
struct ib_connection_operations op 
) [read]

Create connection to remote QP.

Parameters:
ibdevInfiniband device
qpQueue pair
dgidTarget GID
service_idTarget service ID
private_dataConnection request private data
private_data_lenLength of connection request private data
opConnection operations
Return values:
connConnection

Definition at line 451 of file ib_cm.c.

References ib_queue_pair::av, DBGC, free, ib_address_vector::gid, ib_address_vector::gid_present, ib_create_path(), ib_destroy_path(), IB_GID_ARGS, IB_GID_FMT, IB_GUID_ARGS, IB_GUID_FMT, ib_path_set_ownerdata(), ib_connection::ibdev, ib_connection::list, list_add, ib_connection::local_id, local_id, memcpy(), memset(), ib_device::name, NULL, ib_connection::op, op, ib_connection::path, ib_connection::private_data, ib_connection::private_data_len, ib_connection::qp, qp, ib_queue_pair::qpn, random(), ib_connection::service_id, and zalloc().

Referenced by ib_cmrc_xfer_deliver().

                                                       {
        struct ib_connection *conn;
        uint32_t local_id;

        /* Allocate and initialise request */
        conn = zalloc ( sizeof ( *conn ) + private_data_len );
        if ( ! conn )
                goto err_alloc_conn;
        conn->ibdev = ibdev;
        conn->qp = qp;
        memset ( &qp->av, 0, sizeof ( qp->av ) );
        qp->av.gid_present = 1;
        memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
        conn->local_id = local_id = random();
        memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
        conn->op = op;
        conn->private_data_len = private_data_len;
        memcpy ( &conn->private_data, private_data, private_data_len );

        /* Create path */
        conn->path = ib_create_path ( ibdev, &qp->av, &ib_cm_path_op );
        if ( ! conn->path )
                goto err_create_path;
        ib_path_set_ownerdata ( conn->path, conn );

        /* Add to list of connections */
        list_add ( &conn->list, &ib_cm_conns );

        DBGC ( local_id, "CM %08x created for IBDEV %s QPN %#lx\n",
               local_id, ibdev->name, qp->qpn );
        DBGC ( local_id, "CM %08x connecting to " IB_GID_FMT " "
               IB_GUID_FMT "\n", local_id, IB_GID_ARGS ( dgid ),
               IB_GUID_ARGS ( service_id ) );

        return conn;

        ib_destroy_path ( ibdev, conn->path );
 err_create_path:
        free ( conn );
 err_alloc_conn:
        return NULL;
}
void ib_destroy_conn ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct ib_connection conn 
)