lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Fabrics::CompletionQueue Class Reference

Wraps a libfabric completion queue (fid_cq). More...

#include <Endpoint.hh>

Inherits Pds::Fabrics::ErrorHandler.

Public Member Functions

 CompletionQueue (Fabric *fabric, size_t size=0)
 Open a completion queue of the given size with FI_CQ_FORMAT_DATA entries and an unspecified wait object; up() reports success.
 
 CompletionQueue (Fabric *fabric, struct fi_cq_attr *cq_attr, void *context)
 Open a completion queue with caller-supplied attributes and context; up() reports success.
 
 ~CompletionQueue ()
 Close the queue if it is up.
 
struct fid_cq * cq () const
 Return the underlying fid_cq.
 
ssize_t comp (struct fi_cq_data_entry *comp, ssize_t max_count)
 Read up to max_count entries without blocking (fi_cq_read()); returns the count or a negative error (-FI_EAGAIN is returned but not recorded as an error).
 
ssize_t comp_wait (struct fi_cq_data_entry *comp, ssize_t max_count, int timeout=-1)
 Like comp(), but blocks in fi_cq_sread() with the given timeout.
 
ssize_t comp_error (struct fi_cq_err_entry *comp_err)
 Read one error entry into comp_err (fi_cq_readerr()); returns a positive count, FI_SUCCESS if there was nothing to read, or a negative error.
 
bool up () const
 Return true if the queue was opened and not shut down.
 
bool bind (Endpoint *ep, uint64_t flags)
 Bind this queue to the fid_ep of ep with flags; returns false on failure.
 
void shutdown ()
 Close the queue if it is up and mark it down.
 
void comp_error_dump (const struct fi_cq_err_entry &comp_err) const
 Print all fields of an error completion entry, including the provider error string and a hex dump of err_data, to stderr.
 
- Public Member Functions inherited from Pds::Fabrics::ErrorHandler
 ErrorHandler ()
 Allocate the message buffer and start with no error (FI_SUCCESS and a message built from the text None).
 
virtual ~ErrorHandler ()
 Free the message buffer.
 
int error_num () const
 Return the last recorded error number (FI_SUCCESS if none).
 
const char * error () const
 Return the last recorded error message.
 
void clear_error ()
 Reset the error number to FI_SUCCESS and the message to the no-error text.
 

Static Public Member Functions

static void dump_cq_data_entry (const struct fi_cq_data_entry &comp)
 Print the context pointer (and the int it points to), flags, length, buffer and data of a completion entry to stderr.
 

Additional Inherited Members

- Protected Member Functions inherited from Pds::Fabrics::ErrorHandler
void set_custom_error (const char *fmt,...)
 
void set_error (const char *error_desc)
 
- Protected Attributes inherited from Pds::Fabrics::ErrorHandler
int _errno
 
char * _error
 

Detailed Description

Wraps a libfabric completion queue (fid_cq).

Constructor & Destructor Documentation

◆ CompletionQueue() [1/2]

Pds::Fabrics::CompletionQueue::CompletionQueue ( Fabric *  fabric,
size_t  size = 0 
)

Open a completion queue of the given size with FI_CQ_FORMAT_DATA entries and an unspecified wait object; up() reports success.

◆ CompletionQueue() [2/2]

Pds::Fabrics::CompletionQueue::CompletionQueue ( Fabric *  fabric,
struct fi_cq_attr *  cq_attr,
void *  context 
)

Open a completion queue with caller-supplied attributes and context; up() reports success.

◆ ~CompletionQueue()

Pds::Fabrics::CompletionQueue::~CompletionQueue ( )

Close the queue if it is up.

Member Function Documentation

◆ bind()

bool Pds::Fabrics::CompletionQueue::bind ( Endpoint *  ep,
uint64_t  flags 
)

Bind this queue to the fid_ep of ep with flags; returns false on failure.

◆ comp()

ssize_t Pds::Fabrics::CompletionQueue::comp ( struct fi_cq_data_entry *  comp,
ssize_t  max_count 
)

Read up to max_count entries without blocking (fi_cq_read()); returns the count or a negative error (-FI_EAGAIN is returned but not recorded as an error).

◆ comp_error()

ssize_t Pds::Fabrics::CompletionQueue::comp_error ( struct fi_cq_err_entry *  comp_err)

Read one error entry into comp_err (fi_cq_readerr()); returns a positive count, FI_SUCCESS if there was nothing to read, or a negative error.

◆ comp_error_dump()

void Pds::Fabrics::CompletionQueue::comp_error_dump ( const struct fi_cq_err_entry &  comp_err) const

Print all fields of an error completion entry, including the provider error string and a hex dump of err_data, to stderr.

◆ comp_wait()

ssize_t Pds::Fabrics::CompletionQueue::comp_wait ( struct fi_cq_data_entry *  comp,
ssize_t  max_count,
int  timeout = -1 
)

Like comp(), but blocks in fi_cq_sread() with the given timeout.

◆ cq()

struct fid_cq * Pds::Fabrics::CompletionQueue::cq ( ) const

Return the underlying fid_cq.

◆ dump_cq_data_entry()

static void Pds::Fabrics::CompletionQueue::dump_cq_data_entry ( const struct fi_cq_data_entry &  comp)
static

Print the context pointer (and the int it points to), flags, length, buffer and data of a completion entry to stderr.

◆ shutdown()

void Pds::Fabrics::CompletionQueue::shutdown ( )

Close the queue if it is up and mark it down.

◆ up()

bool Pds::Fabrics::CompletionQueue::up ( ) const

Return true if the queue was opened and not shut down.


The documentation for this class was generated from the following file: