|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
One libfabric connection between an event-builder client and server. More...
#include <EbLfLink.hh>
Inherited by Pds::Eb::EbLfCltLink, and Pds::Eb::EbLfSvrLink.
Public Member Functions | |
| EbLfLink (Fabrics::Endpoint *, const unsigned depth, const unsigned &verbose, volatile uint64_t &pending, volatile uint64_t &posting) | |
| Wrap the endpoint with depth receive credits, zero the shared pending and posting words and post depth zero-length receives. | |
| ~EbLfLink () | |
| Zero the pending and posting words and print a message if fewer than depth credits are posted. | |
| int | recvU32 (uint32_t *u32, const char *peer, const char *name) |
| Wait up to 7 s for one immediate data value and store its low 32 bits in u32. | |
| int | sendU32 (uint32_t u32, const char *peer, const char *name) |
| Send u32 as immediate data with post(); returns 0, or the error after printing a message. | |
| int | sendMr (Fabrics::MemoryRegion *, const char *peer) |
| Send a RemoteAddress built from the memory region (start address, length, key) to the peer as a series of 32-bit immediate data values; returns 0 or a negative error. | |
| int | recvMr (Fabrics::RemoteAddress &, const char *peer) |
| Receive a RemoteAddress into ra as a series of 32-bit immediate data values (as sent by sendMr()), waiting up to 7 s for each; returns 0 or the poll() error. | |
| void * | lclAdx (size_t offset) const |
| Return the local address that is offset bytes from the start of the local memory region. | |
| size_t | lclOfs (const void *buffer) const |
| Return the byte offset of buffer from the start of the local memory region. | |
| uintptr_t | rmtAdx (size_t offset) const |
| Return the remote address that is offset bytes from the start of the remote region. | |
| size_t | rmtOfs (uintptr_t buffer) const |
| Return the byte offset of the remote address buffer from the start of the remote region. | |
| Fabrics::Endpoint * | endpoint () const |
| Return the libfabric endpoint. | |
| unsigned | id () const |
| Return the peer ID received in exchangeId(); (unsigned)-1 before that. | |
| const uint64_t & | tmoCnt () const |
| Return the number of timeouts counted by post() and poll(). | |
| int | post (const void *buf, size_t len, uint64_t immData) |
| Send len bytes from buf with immediate data immData using Endpoint::injectdata(), retrying -FI_EAGAIN for up to 300 s. | |
| int | post (uint64_t immData) |
| Send only the immediate data immData; same as post(nullptr, 0, immData). | |
| int | poll (uint64_t *data) |
| Check the receive completion queue once without waiting and re-post the consumed receive. | |
| int | poll (uint64_t *data, int msTmo) |
| Like poll(uint64_t*), but waits up to msTmo milliseconds for a completion. | |
| ssize_t | postCompRecv (const unsigned count) |
| Consume count receive credits, then re-post zero-length receives until depth credits are posted again (on -FI_EAGAIN, retry up to 100000 times with 10 us sleeps). | |
Public Attributes | |
| const unsigned | _depth |
| Number of receive buffers (credits) to keep posted. | |
| unsigned | _credits |
| Number of receive buffers currently posted. | |
Protected Types | |
| enum | { _BegSync = 0x11111111 , _EndSync = 0x22222222 , _SvrSync = 0x33333333 , _CltSync = 0x44444444 } |
Protected Attributes | |
| unsigned | _id |
| Fabrics::Endpoint * | _ep |
| Fabrics::MemoryRegion * | _mr |
| Fabrics::RemoteAddress | _ra |
| const unsigned & | _verbose |
| uint64_t | _timedOut |
| volatile uint64_t & | _pending |
| volatile uint64_t & | _posting |
One libfabric connection between an event-builder client and server.
Small values are exchanged as immediate data, a fixed number of zero-length receives (credits) is kept posted, and addresses are translated to and from offsets in the local and remote memory regions.
| Pds::Eb::EbLfLink::EbLfLink | ( | Fabrics::Endpoint * | , |
| const unsigned | depth, | ||
| const unsigned & | verbose, | ||
| volatile uint64_t & | pending, | ||
| volatile uint64_t & | posting | ||
| ) |
Wrap the endpoint with depth receive credits, zero the shared pending and posting words and post depth zero-length receives.
The peer ID starts as (unsigned)-1.
| Pds::Eb::EbLfLink::~EbLfLink | ( | ) |
Zero the pending and posting words and print a message if fewer than depth credits are posted.
The endpoint is not deleted.
|
inline |
Return the libfabric endpoint.
|
inline |
Return the peer ID received in exchangeId(); (unsigned)-1 before that.
|
inline |
Return the local address that is offset bytes from the start of the local memory region.
|
inline |
Return the byte offset of buffer from the start of the local memory region.
| int Pds::Eb::EbLfLink::poll | ( | uint64_t * | data | ) |
Check the receive completion queue once without waiting and re-post the consumed receive.
On a completion, store its immediate data in data and return 0; otherwise return -FI_EAGAIN (counted as a timeout), -FI_ENOTCONN if the peer has shut down, or another negative error.
| int Pds::Eb::EbLfLink::poll | ( | uint64_t * | data, |
| int | msTmo | ||
| ) |
Like poll(uint64_t*), but waits up to msTmo milliseconds for a completion.
The shared pending word is incremented while waiting.
| int Pds::Eb::EbLfLink::post | ( | const void * | buf, |
| size_t | len, | ||
| uint64_t | immData | ||
| ) |
Send len bytes from buf with immediate data immData using Endpoint::injectdata(), retrying -FI_EAGAIN for up to 300 s.
This peer's bit is set in the posting word while sending. Returns 0 or the last error (a timeout is counted).
|
inline |
Send only the immediate data immData; same as post(nullptr, 0, immData).
| ssize_t Pds::Eb::EbLfLink::postCompRecv | ( | const unsigned | count | ) |
Consume count receive credits, then re-post zero-length receives until depth credits are posted again (on -FI_EAGAIN, retry up to 100000 times with 10 us sleeps).
Returns 0 or a negative error other than -FI_EAGAIN.
| int Pds::Eb::EbLfLink::recvMr | ( | Fabrics::RemoteAddress & | , |
| const char * | peer | ||
| ) |
| int Pds::Eb::EbLfLink::recvU32 | ( | uint32_t * | u32, |
| const char * | peer, | ||
| const char * | name | ||
| ) |
Wait up to 7 s for one immediate data value and store its low 32 bits in u32.
Returns 0, or the poll() error after printing a message naming name and peer.
|
inline |
Return the remote address that is offset bytes from the start of the remote region.
|
inline |
Return the byte offset of the remote address buffer from the start of the remote region.
| int Pds::Eb::EbLfLink::sendMr | ( | Fabrics::MemoryRegion * | , |
| const char * | peer | ||
| ) |
Send a RemoteAddress built from the memory region (start address, length, key) to the peer as a series of 32-bit immediate data values; returns 0 or a negative error.
| int Pds::Eb::EbLfLink::sendU32 | ( | uint32_t | u32, |
| const char * | peer, | ||
| const char * | name | ||
| ) |
Send u32 as immediate data with post(); returns 0, or the error after printing a message.
|
inline |
| unsigned Pds::Eb::EbLfLink::_credits |
Number of receive buffers currently posted.
| const unsigned Pds::Eb::EbLfLink::_depth |
Number of receive buffers (credits) to keep posted.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |