iPXE
Functions
ib_cmrc.h File Reference

Infiniband Communication-managed Reliable Connections. More...

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

Go to the source code of this file.

Functions

 FILE_LICENCE (BSD2)
 
int ib_cmrc_open (struct interface *xfer, struct ib_device *ibdev, union ib_gid *dgid, union ib_guid *service_id, const char *name)
 Open CMRC connection. More...
 

Detailed Description

Infiniband Communication-managed Reliable Connections.

Definition in file ib_cmrc.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ ib_cmrc_open()

int ib_cmrc_open ( struct interface xfer,
struct ib_device ibdev,
union ib_gid dgid,
union ib_guid service_id,
const char *  name 
)

Open CMRC connection.

Parameters
xferData transfer interface
ibdevInfiniband device
dgidDestination GID
service_idService ID
nameConnection name
Return values
rcReturns status code

Definition at line 397 of file ib_cmrc.c.

399  {
400  struct ib_cmrc_connection *cmrc;
401  int rc;
402 
403  /* Allocate and initialise structure */
404  cmrc = zalloc ( sizeof ( *cmrc ) );
405  if ( ! cmrc ) {
406  rc = -ENOMEM;
407  goto err_alloc;
408  }
409  ref_init ( &cmrc->refcnt, NULL );
410  cmrc->name = name;
411  intf_init ( &cmrc->xfer, &ib_cmrc_xfer_desc, &cmrc->refcnt );
412  cmrc->ibdev = ibdev;
413  memcpy ( &cmrc->dgid, dgid, sizeof ( cmrc->dgid ) );
414  memcpy ( &cmrc->service_id, service_id, sizeof ( cmrc->service_id ) );
416  &cmrc->refcnt );
417 
418  /* Open Infiniband device */
419  if ( ( rc = ib_open ( ibdev ) ) != 0 ) {
420  DBGC ( cmrc, "CMRC %s %s could not open device: %s\n",
421  ibdev->name, cmrc->name, strerror ( rc ) );
422  goto err_open;
423  }
424 
425  /* Create completion queue */
427  &ib_cmrc_completion_ops, &cmrc->cq ) ) != 0){
428  DBGC ( cmrc, "CMRC %s %s could not create completion queue: "
429  "%s\n", ibdev->name, cmrc->name, strerror ( rc ) );
430  goto err_create_cq;
431  }
432 
433  /* Create queue pair */
435  cmrc->cq, IB_CMRC_NUM_RECV_WQES, cmrc->cq,
437  &cmrc->qp ) ) != 0 ) {
438  DBGC ( cmrc, "CMRC %s %s could not create queue pair: %s\n",
439  ibdev->name, cmrc->name, strerror ( rc ) );
440  goto err_create_qp;
441  }
442  ib_qp_set_ownerdata ( cmrc->qp, cmrc );
443  DBGC ( cmrc, "CMRC %s %s using QPN %#lx\n",
444  ibdev->name, cmrc->name, cmrc->qp->qpn );
445 
446  /* Attach to parent interface, transfer reference (implicitly)
447  * to our shutdown process, and return.
448  */
449  intf_plug_plug ( &cmrc->xfer, xfer );
450  return 0;
451 
452  ib_destroy_qp ( ibdev, cmrc->qp );
453  err_create_qp:
454  ib_destroy_cq ( ibdev, cmrc->cq );
455  err_create_cq:
456  ib_close ( ibdev );
457  err_open:
458  ref_put ( &cmrc->refcnt );
459  err_alloc:
460  return rc;
461 }
struct ib_completion_queue * cq
Completion queue.
Definition: ib_cmrc.c:79
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
static struct interface_descriptor ib_cmrc_xfer_desc
CMRC data transfer interface descriptor.
Definition: ib_cmrc.c:379
char name[IBDEV_NAME_LEN]
Name of this Infiniband device.
Definition: infiniband.h:408
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
int ib_create_cq(struct ib_device *ibdev, unsigned int num_cqes, struct ib_completion_queue_operations *op, struct ib_completion_queue **new_cq)
Create completion queue.
Definition: infiniband.c:98
#define DBGC(...)
Definition: compiler.h:505
static struct ib_queue_pair_operations ib_cmrc_queue_pair_ops
Infiniband CMRC queue pair operations.
Definition: ib_cmrc.c:272
int ib_open(struct ib_device *ibdev)
Open port.
Definition: infiniband.c:652
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:102
static struct process_descriptor ib_cmrc_shutdown_desc
CMRC shutdown process descriptor.
Definition: ib_cmrc.c:383
void ib_close(struct ib_device *ibdev)
Close port.
Definition: infiniband.c:716
struct process shutdown
Shutdown process.
Definition: ib_cmrc.c:91
union ib_gid dgid
Destination GID.
Definition: ib_cmrc.c:85
void ib_destroy_cq(struct ib_device *ibdev, struct ib_completion_queue *cq)
Destroy completion queue.
Definition: infiniband.c:145
const char * name
Name.
Definition: ib_cmrc.c:73
#define ENOMEM
Not enough space.
Definition: errno.h:534
#define IB_CMRC_NUM_RECV_WQES
CMRC number of receive WQEs.
Definition: ib_cmrc.c:60
void * memcpy(void *dest, const void *src, size_t len) __nonnull
An Infiniband Communication-Managed Reliable Connection.
Definition: ib_cmrc.c:69
unsigned long qpn
Queue pair number.
Definition: infiniband.h:165
#define IB_CMRC_NUM_SEND_WQES
CMRC number of send WQEs.
Definition: ib_cmrc.c:54
#define IB_CMRC_NUM_CQES
CMRC number of completion queue entries.
Definition: ib_cmrc.c:66
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
void ib_destroy_qp(struct ib_device *ibdev, struct ib_queue_pair *qp)
Destroy queue pair.
Definition: infiniband.c:314
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
Definition: process.h:145
static struct ib_completion_queue_operations ib_cmrc_completion_ops
Infiniband CMRC completion operations.
Definition: ib_cmrc.c:266
union ib_guid service_id
Service ID.
Definition: ib_cmrc.c:87
union ib_gid dgid
Definition: ib_mad.h:12
struct interface xfer
Data transfer interface.
Definition: ib_cmrc.c:75
struct refcnt refcnt
Reference count.
Definition: ib_cmrc.c:71
int 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, struct ib_queue_pair_operations *op, const char *name, struct ib_queue_pair **new_qp)
Create queue pair.
Definition: infiniband.c:199
struct ib_queue_pair * qp
Queue pair.
Definition: ib_cmrc.c:81
union ib_guid service_id
Service ID.
Definition: ib_mad.h:16
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:173
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
static __always_inline void ib_qp_set_ownerdata(struct ib_queue_pair *qp, void *priv)
Set Infiniband queue pair owner-private data.
Definition: infiniband.h:652
struct ib_device * ibdev
Infiniband device.
Definition: ib_cmrc.c:77
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ib_cmrc_connection::cq, DBGC, dgid, ib_cmrc_connection::dgid, ENOMEM, ib_close(), ib_cmrc_completion_ops, IB_CMRC_NUM_CQES, IB_CMRC_NUM_RECV_WQES, IB_CMRC_NUM_SEND_WQES, ib_cmrc_queue_pair_ops, ib_cmrc_shutdown_desc, ib_cmrc_xfer_desc, ib_create_cq(), ib_create_qp(), ib_destroy_cq(), ib_destroy_qp(), ib_open(), ib_qp_set_ownerdata(), IB_QPT_RC, ib_cmrc_connection::ibdev, intf_init(), intf_plug_plug(), memcpy(), ib_cmrc_connection::name, ib_device::name, name, NULL, process_init_stopped(), ib_cmrc_connection::qp, ib_queue_pair::qpn, rc, ref_init, ref_put, ib_cmrc_connection::refcnt, service_id, ib_cmrc_connection::service_id, ib_cmrc_connection::shutdown, strerror(), ib_cmrc_connection::xfer, and zalloc().

Referenced by ib_srp_open(), and xcm_reopen().