29 sizeof(
struct photon_rdma_eager_buf_t));
31 memset(
new, 0,
sizeof(
struct photon_rdma_eager_buf_t));
33 new->data = eager_buffer;
34 memset(new->data, 0,
sizeof(uint8_t) * size);
42 new->acct.event_prefix = prefix;
52 uint64_t curr,
new, left, tail, rcur, wrap;
56 int rc = be->tx_size_left(proc);
62 rcur = sync_load(&buf->acct.rcur, SYNC_RELAXED);
63 curr = sync_load(&buf->curr, SYNC_RELAXED);
64 tail = sync_load(&buf->tail, SYNC_RELAXED);
66 if ((curr - tail) >= buf->size) {
71 offset = curr & (buf->size - 1);
72 left = buf->size - offset;
74 new = curr + left + size;
84 if (((curr - rcur) + size + wrap) >= buf->size) {
86 _get_remote_progress(proc, buf);
87 dbg_trace(
"No new offset until receiver catches up...");
90 }
while (!sync_cas(&buf->curr, &curr,
new, SYNC_RELAXED, SYNC_RELAXED));
93 sync_fadd(&buf->tail, left, SYNC_RELAXED);
95 if (((curr - rcur) + size + wrap) >= (
int)(buf->size * 0.8)) {
97 _get_remote_progress(proc, buf);
113 dbg_err(
"Failure getting event");
118 if (!rloc && sync_cas(&buf->acct.rloc, &rloc, 1, SYNC_ACQUIRE, SYNC_RELAXED)) {
120 dbg_trace(
"Fetching remote eager (%d) curr at rcur: %llu", proc, buf->acct.rcur);
123 sizeof(
struct photon_rdma_eager_buf_t) + offsetof(struct photon_rdma_eager_buf_t, prog);
125 cookie = ( (uint64_t)buf->acct.event_prefix<<32) | proc;
127 rc = be->rdma_get(proc, (uintptr_t)&buf->acct.rcur, rmt_addr,
sizeof(buf->acct.rcur),
130 dbg_err(
"RDMA GET for remote ledger progress counter failed");
photonBufferHandle shared_storage
void photon_rdma_eager_buf_free(photonEagerBuf buf)
int photon_rdma_eager_buf_get_offset(int proc, photonEagerBuf buf, int size, int lim)
struct photon_req_t * photonRequest
ProcessInfo * photon_processes
#define PHOTON_ERROR
Error code, general error.
uint64_t size
The size of the buffer in bytes.
photonEagerBuf photon_rdma_eager_buf_create_reuse(uint8_t *eager_buffer, int size, int prefix)
#define PHOTON_OK
Photon success code.
#define PHOTON_EBUF_SSIZE(c)
#define PHOTON_EVENT_ERROR
int __photon_try_one_event(photonRequest *rreq)
struct photon_rdma_eager_buf_t * photonEagerBuf