DABC (Data Acquisition Backbone Core)  2.9.9
MemoryPool.h
Go to the documentation of this file.
1 /************************************************************
2  * The Data Acquisition Backbone Core (DABC) *
3  ************************************************************
4  * Copyright (C) 2009 - *
5  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
6  * Planckstr. 1, 64291 Darmstadt, Germany *
7  * Contact: http://dabc.gsi.de *
8  ************************************************************
9  * This software can be used under the GPL license *
10  * agreements as stated in LICENSE.txt file *
11  * which is part of the distribution. *
12  ************************************************************/
13 
14 #ifndef VERBS_MemoryPool
15 #define VERBS_MemoryPool
16 
17 #ifndef DABC_MemoryPool
18 #include "dabc/MemoryPool.h"
19 #endif
20 
21 #ifndef VERBS_Context
22 #include "verbs/Context.h"
23 #endif
24 
25 namespace verbs {
26 
27  class PoolRegistry;
28 
31  class MemoryPool : public dabc::MemoryPool {
32  protected:
33  bool fUD;
36  struct ibv_recv_wr* f_rwr; // field for receive configs, allocated dynamically
37  struct ibv_send_wr* f_swr; // field for send configs, allocated dynamically
38  struct ibv_sge* f_sge; // memory segment description, used for both send/recv
39 
40  public:
42  const char* name,
43  int32_t number,
44  int64_t bufsize,
45  bool isud,
46  bool without_wr = false);
47 
48  virtual ~MemoryPool();
49 
50  uint32_t GetLkey(unsigned id)
51  {
52  return fReg() ? fReg()->GetLkey(id) : 0;
53  }
54 
55  struct ibv_recv_wr* GetRecvWR(unsigned id);
56  struct ibv_send_wr* GetSendWR(unsigned id, uint64_t size);
57 
58  void* GetSendBufferLocation(unsigned id);
59 
60  bool TakeRawBuffer(unsigned& indx) { return dabc::MemoryPool::TakeRawBuffer(indx); }
61 
64 
65  };
66 }
67 
68 #endif
void ReleaseRawBuffer(unsigned indx)
Release raw buffer, allocated before by TakeRawBuffer.
Definition: MemoryPool.cxx:326
bool TakeRawBuffer(unsigned &indx)
Reserve raw buffer without creating Buffer instance.
Definition: MemoryPool.cxx:318
Reference to verbs::Context
Definition: Context.h:74
Special memory pool, which automatically includes PoolRegistry.
Definition: MemoryPool.h:31
struct ibv_send_wr * GetSendWR(unsigned id, uint64_t size)
Definition: MemoryPool.cxx:103
void * GetSendBufferLocation(unsigned id)
Definition: MemoryPool.cxx:128
PoolRegistryRef fReg
Definition: MemoryPool.h:35
void ReleaseRawBuffer(unsigned indx)
Release raw buffer, allocated before by TakeRawBuffer.
Definition: MemoryPool.h:63
MemoryPool(ContextRef ctx, const char *name, int32_t number, int64_t bufsize, bool isud, bool without_wr=false)
Definition: MemoryPool.cxx:20
struct ibv_recv_wr * GetRecvWR(unsigned id)
Definition: MemoryPool.cxx:85
virtual ~MemoryPool()
Definition: MemoryPool.cxx:71
struct ibv_recv_wr * f_rwr
Definition: MemoryPool.h:36
unsigned fSendBufferOffset
Definition: MemoryPool.h:34
struct ibv_sge * f_sge
Definition: MemoryPool.h:38
bool TakeRawBuffer(unsigned &indx)
Definition: MemoryPool.h:60
struct ibv_send_wr * f_swr
Definition: MemoryPool.h:37
uint32_t GetLkey(unsigned id)
Definition: MemoryPool.h:50
Reference on verbs::PoolRegistry
Definition: Context.h:143
Support of InfiniBand verbs.
Definition: Device.cxx:54