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

Point-to-point libfabric transport for DGRAM, RDM or MSG endpoints, adapted from the libfabric pingpong example per the file comment. More...

#include <fiTransport.hh>

Public Member Functions

 FiTransport (uint16_t srcPort, uint16_t dstPort, char *dstAddr, enum fi_ep_type epType, uint64_t caps, uint64_t mode, uint64_t mr_mode, char *domain, char *provider)
 Store the ports and destination address and allocate libfabric hints filled from epType, caps, mode, mr_mode, domain and provider.
 
 ~FiTransport ()
 Shut down the endpoint if one is open and free all libfabric resources.
 
int start (int maxMsgSize, void *buffer, size_t size)
 Set up the transport for the endpoint type given in the hints: DGRAM (applying maxMsgSize if non-zero and posting one extra receive into buffer), RDM, or MSG (control connection, server or client connect, then a sync).
 
ssize_t postTransmit (void *buf, size_t size)
 Send size bytes from buf with fi_inject() if size is below the provider's inject size, otherwise with fi_send() followed by a wait for its transmit completion.
 
ssize_t postReceive (void *buf, size_t size)
 Wait for the completion of the previously posted receive, then post the next receive into buf (length is the larger of size and 64) and count it as an acknowledged message.
 
int finalize (void *buf, size_t size)
 Copy the string fin into buf and send it with fi_sendmsg(FI_INJECT | FI_TRANSMIT_COMPLETE), wait for its transmit completion and for one receive completion, then close the control connection.
 
void clearCounters ()
 Reset the acknowledged-message counter.
 
const struct fi_info * fi () const
 Return the fi_info selected for the connection.
 
void dumpFabricInfo ()
 Print fabric, domain and endpoint attributes of the selected fi_info with FT_DEBUG (printed only when debug output is enabled).
 
int ctrlSync ()
 Exchange the sync question and answer strings over the control connection (the client sends and waits for the answer, the server waits and answers).
 
int ctrl_txrx_msg_count ()
 Exchange the acknowledged-message count over the control connection: the client sends its count and expects an ok reply; the server receives and stores the count and replies.
 

Static Public Member Functions

static void debug (int enable)
 Enable (non-zero) or disable the FT_DEBUG messages; the flag is file-static, so it affects all instances.
 

Detailed Description

Point-to-point libfabric transport for DGRAM, RDM or MSG endpoints, adapted from the libfabric pingpong example per the file comment.

In MSG mode a separate socket control connection is used to exchange synchronization messages.

Constructor & Destructor Documentation

◆ FiTransport()

Pds::Eb::FiTransport::FiTransport ( uint16_t  srcPort,
uint16_t  dstPort,
char *  dstAddr,
enum fi_ep_type  epType,
uint64_t  caps,
uint64_t  mode,
uint64_t  mr_mode,
char *  domain,
char *  provider 
)

Store the ports and destination address and allocate libfabric hints filled from epType, caps, mode, mr_mode, domain and provider.

If the allocation fails, start() returns EXIT_FAILURE.

◆ ~FiTransport()

Pds::Eb::FiTransport::~FiTransport ( )

Shut down the endpoint if one is open and free all libfabric resources.

Member Function Documentation

◆ clearCounters()

void Pds::Eb::FiTransport::clearCounters ( )

Reset the acknowledged-message counter.

◆ ctrl_txrx_msg_count()

int Pds::Eb::FiTransport::ctrl_txrx_msg_count ( )

Exchange the acknowledged-message count over the control connection: the client sends its count and expects an ok reply; the server receives and stores the count and replies.

Returns 0, a negative error, or in some mismatch cases the received length.

◆ ctrlSync()

int Pds::Eb::FiTransport::ctrlSync ( )

Exchange the sync question and answer strings over the control connection (the client sends and waits for the answer, the server waits and answers).

Returns 0, a negative errno, or -EBADMSG.

◆ debug()

static void Pds::Eb::FiTransport::debug ( int  enable)
static

Enable (non-zero) or disable the FT_DEBUG messages; the flag is file-static, so it affects all instances.

◆ dumpFabricInfo()

void Pds::Eb::FiTransport::dumpFabricInfo ( )

Print fabric, domain and endpoint attributes of the selected fi_info with FT_DEBUG (printed only when debug output is enabled).

◆ fi()

const struct fi_info * Pds::Eb::FiTransport::fi ( ) const

Return the fi_info selected for the connection.

◆ finalize()

int Pds::Eb::FiTransport::finalize ( void *  buf,
size_t  size 
)

Copy the string fin into buf and send it with fi_sendmsg(FI_INJECT | FI_TRANSMIT_COMPLETE), wait for its transmit completion and for one receive completion, then close the control connection.

Returns 0 or an error.

◆ postReceive()

ssize_t Pds::Eb::FiTransport::postReceive ( void *  buf,
size_t  size 
)

Wait for the completion of the previously posted receive, then post the next receive into buf (length is the larger of size and 64) and count it as an acknowledged message.

Returns 0 or an error.

◆ postTransmit()

ssize_t Pds::Eb::FiTransport::postTransmit ( void *  buf,
size_t  size 
)

Send size bytes from buf with fi_inject() if size is below the provider's inject size, otherwise with fi_send() followed by a wait for its transmit completion.

Posts that return -FI_EAGAIN are retried. Returns 0 or an error.

◆ start()

int Pds::Eb::FiTransport::start ( int  maxMsgSize,
void *  buffer,
size_t  size 
)

Set up the transport for the endpoint type given in the hints: DGRAM (applying maxMsgSize if non-zero and posting one extra receive into buffer), RDM, or MSG (control connection, server or client connect, then a sync).

Returns 0 or an error code (EXIT_FAILURE for an unsupported type or a failed constructor).


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