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. More...
 
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()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ ib_create_conn()

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 
)

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.

454  {
455  struct ib_connection *conn;
457 
458  /* Allocate and initialise request */
459  conn = zalloc ( sizeof ( *conn ) + private_data_len );
460  if ( ! conn )
461  goto err_alloc_conn;
462  conn->ibdev = ibdev;
463  conn->qp = qp;
464  memset ( &qp->av, 0, sizeof ( qp->av ) );
465  qp->av.gid_present = 1;
466  memcpy ( &qp->av.gid, dgid, sizeof ( qp->av.gid ) );
467  conn->local_id = local_id = random();
468  memcpy ( &conn->service_id, service_id, sizeof ( conn->service_id ) );
469  conn->op = op;
472 
473  /* Create path */
474  conn->path = ib_create_path ( ibdev, &qp->av, &ib_cm_path_op );
475  if ( ! conn->path )
476  goto err_create_path;
477  ib_path_set_ownerdata ( conn->path, conn );
478 
479  /* Add to list of connections */
480  list_add ( &conn->list, &ib_cm_conns );
481 
482  DBGC ( local_id, "CM %08x created for IBDEV %s QPN %#lx\n",
483  local_id, ibdev->name, qp->qpn );
484  DBGC ( local_id, "CM %08x connecting to " IB_GID_FMT " "
486  IB_GUID_ARGS ( service_id ) );
487 
488  return conn;
489 
490  ib_destroy_path ( ibdev, conn->path );
491  err_create_path:
492  free ( conn );
493  err_alloc_conn:
494  return NULL;
495 }
char name[IBDEV_NAME_LEN]
Name of this Infiniband device.
Definition: infiniband.h:408
struct list_head list
List of connections.
Definition: ib_cm.h:50
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:69
uint8_t private_data[0]
Connection request private data.
Definition: ib_cm.h:60
#define DBGC(...)
Definition: compiler.h:505
size_t private_data_len
Length of connection request private data.
Definition: ib_cm.h:58
#define IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
Definition: ib_packet.h:29
union ib_guid service_id
Target service ID.
Definition: ib_cm.h:45
static __always_inline void ib_path_set_ownerdata(struct ib_path *path, void *priv)
Set Infiniband path owner-private data.
Definition: ib_pathrec.h:52
uint32_t local_id
Local communication ID.
Definition: ib_cm.h:41
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define IB_GUID_FMT
Infiniband Globally Unique Identifier debug message format.
Definition: ib_packet.h:26
struct ib_path * ib_create_path(struct ib_device *ibdev, struct ib_address_vector *av, struct ib_path_operations *op)
Create path.
Definition: ib_pathrec.c:107
#define IB_GID_ARGS(gid)
Infiniband Global Identifier debug message arguments.
Definition: ib_packet.h:48
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct ib_connection_operations * op
Connection operations.
Definition: ib_cm.h:47
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
Definition: random.c:31
unsigned int uint32_t
Definition: stdint.h:12
An Infiniband connection.
Definition: ib_cm.h:35
struct ib_path * path
Path to target.
Definition: ib_cm.h:53
union ib_gid dgid
Definition: ib_mad.h:12
struct arbelprm_qp_db_record qp
Definition: arbel.h:13
static uint16_t struct vmbus_xfer_pages_operations * op
Definition: netvsc.h:327
struct ib_queue_pair * qp
Queue pair.
Definition: ib_cm.h:39
uint8_t private_data[92]
Private data.
Definition: ib_mad.h:44
#define IB_GID_FMT
Infiniband Global Identifier debug message format.
Definition: ib_packet.h:45
struct ib_device * ibdev
Infiniband device.
Definition: ib_cm.h:37
uint32_t local_id
Local communication ID.
Definition: ib_mad.h:12
static struct ib_path_operations ib_cm_path_op
Connection path operations.
Definition: ib_cm.c:434
union ib_guid service_id
Service ID.
Definition: ib_mad.h:16
void ib_destroy_path(struct ib_device *ibdev, struct ib_path *path)
Destroy path.
Definition: ib_pathrec.c:156
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
void * memset(void *dest, int character, size_t len) __nonnull

References DBGC, dgid, free, ib_cm_path_op, 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, local_id, ib_connection::local_id, memcpy(), memset(), ib_device::name, NULL, ib_connection::op, op, ib_connection::path, private_data, ib_connection::private_data, ib_connection::private_data_len, qp, ib_connection::qp, random(), service_id, ib_connection::service_id, and zalloc().

Referenced by ib_cmrc_xfer_deliver().

◆ ib_destroy_conn()

void ib_destroy_conn ( struct ib_device ibdev,
struct ib_queue_pair qp,
struct ib_connection conn 
)