28 new = (
struct photon_ri_ledger_t *)((uintptr_t)ledger_buffer +
PHOTON_INFO_SSIZE(ledger_size) -
29 sizeof(
struct photon_ri_ledger_t));
31 memset(
new, 0,
sizeof(
struct photon_ri_ledger_t));
33 new->entries = ledger_buffer;
38 memset(new->entries, 0,
sizeof(
struct photon_ri_ledger_entry_t) * ledger_size);
42 new->num_entries = ledger_size;
45 new->acct.event_prefix = prefix;
55 uint64_t curr, tail, rcur;
58 int rc = be->tx_size_left(proc);
64 rcur = sync_load(&l->acct.rcur, SYNC_RELAXED);
65 curr = sync_load(&l->curr, SYNC_RELAXED);
66 tail = sync_load(&l->tail, SYNC_RELAXED);
67 if ((curr - tail) >= l->num_entries) {
68 log_err(
"Exceeded number of outstanding RI ledger entries - increase ledger size or wait for completion");
71 if ((curr - rcur) >= l->num_entries) {
73 _get_remote_progress(proc, l);
74 dbg_trace(
"No new info ledger entry until receiver catches up...");
77 }
while (!sync_cas(&l->curr, &curr, curr+1, SYNC_RELAXED, SYNC_RELAXED));
79 if ((curr - rcur) == (
int)(l->num_entries * 0.8)) {
81 _get_remote_progress(proc, l);
84 return curr & (l->num_entries - 1);
97 dbg_err(
"Failure getting event");
102 if (sync_cas(&buf->acct.rloc, &rloc, 1, SYNC_ACQUIRE, SYNC_RELAXED)) {
104 dbg_trace(
"Fetching remote info ledger (%d) curr at rcur: %llu", proc, buf->acct.rcur);
107 sizeof(
struct photon_ri_ledger_t) + offsetof(struct photon_ri_ledger_t, prog);
109 cookie = ( (uint64_t)buf->acct.event_prefix<<32) | proc;
111 rc = be->rdma_get(proc, (uintptr_t)&buf->acct.rcur, rmt_addr,
sizeof(buf->acct.rcur),
114 dbg_err(
"RDMA GET for remote info ledger progress counter failed");
photonRILedger photon_ri_ledger_create_reuse(photonRILedgerEntry ledger_buffer, int ledger_size, int prefix)
struct photon_ri_ledger_entry_t * photonRILedgerEntry
photonBufferHandle shared_storage
struct photon_ri_ledger_t * photonRILedger
#define PHOTON_INFO_SSIZE(c)
struct photon_req_t * photonRequest
ProcessInfo * photon_processes
void photon_ri_ledger_free(photonRILedger ledger)
#define PHOTON_ERROR
Error code, general error.
int photon_ri_ledger_get_next(int proc, photonRILedger l)
#define PHOTON_OK
Photon success code.
#define PHOTON_EVENT_ERROR
int __photon_try_one_event(photonRequest *rreq)