34 DOUT4(
"Create verbs::Pool %s %p", GetName(),
this);
36 if (isud && (bufsize>0x1000)) bufsize = 0x1000;
38 SetAlignment((bufsize<0x100) ? 0x10 : 0x100);
40 Allocate(bufsize, number);
42 fReg =
new PoolRegistry(ctx,
this);
43 fReg()->SyncMRStructure();
45 if (without_wr)
return;
47 f_rwr =
new ibv_recv_wr [number];
48 f_swr =
new ibv_send_wr [number];
49 f_sge =
new ibv_sge [number];
51 for (int32_t
id = 0;
id<number;
id++) {
52 f_sge[id].addr = (uintptr_t) 0;
57 f_swr[id].sg_list = &(f_sge[id]);
58 f_swr[id].num_sge = 1;
59 f_swr[id].opcode = IBV_WR_SEND;
60 f_swr[id].next = NULL;
61 f_swr[id].send_flags = IBV_SEND_SIGNALED;
64 f_rwr[id].sg_list = &(f_sge[id]);
65 f_rwr[id].num_sge = 1;
66 f_rwr[id].next = NULL;
89 if ((f_rwr==0) || (f_sge==0))
return 0;
91 f_sge[bufid].addr = (uintptr_t) GetBufferLocation(bufid);
92 f_sge[bufid].length = GetBufferSize(bufid);
93 f_sge[bufid].lkey = GetLkey(bufid);
95 f_rwr[bufid].wr_id = bufid;
96 f_rwr[bufid].sg_list = &(f_sge[bufid]);
97 f_rwr[bufid].num_sge = 1;
98 f_rwr[bufid].next = NULL;
100 return &(f_rwr[bufid]);
107 if ((f_swr==0) || (f_sge==0))
return 0;
109 if (size==0) size = GetBufferSize(bufid) - fSendBufferOffset;
111 f_sge[bufid].addr = (uintptr_t) GetSendBufferLocation(bufid);
112 f_sge[bufid].length = size;
113 f_sge[bufid].lkey = GetLkey(bufid);
115 f_swr[bufid].wr_id = bufid;
116 f_swr[bufid].sg_list = &(f_sge[bufid]);
117 f_swr[bufid].num_sge = 1;
118 f_swr[bufid].opcode = IBV_WR_SEND;
119 f_swr[bufid].next = NULL;
121 f_swr[bufid].send_flags = (ibv_send_flags) (IBV_SEND_SIGNALED | IBV_SEND_INLINE);
123 f_swr[bufid].send_flags = IBV_SEND_SIGNALED;
125 return &(f_swr[bufid]);
130 return (
char*)GetBufferLocation(bufid) + fSendBufferOffset;
#define VERBS_UD_MEMADDON
unsigned NumReferences()
Return number of references on the object.
const char * GetName() const
Returns name of the object, thread safe
void Destroy()
Release reference and starts destroyment of referenced object.
Reference to verbs::Context
struct ibv_send_wr * GetSendWR(unsigned id, uint64_t size)
void * GetSendBufferLocation(unsigned id)
MemoryPool(ContextRef ctx, const char *name, int32_t number, int64_t bufsize, bool isud, bool without_wr=false)
struct ibv_recv_wr * GetRecvWR(unsigned id)
struct ibv_recv_wr * f_rwr
struct ibv_send_wr * f_swr