mirror of https://github.com/PentHertz/srsLTE.git
Increase buffer pool size for enb
This commit is contained in:
parent
efea8f4436
commit
a2615628aa
|
@ -56,8 +56,12 @@ class buffer_pool{
|
|||
public:
|
||||
|
||||
// non-static methods
|
||||
buffer_pool(uint32_t nof_buffers = POOL_SIZE)
|
||||
buffer_pool(int capacity_ = -1)
|
||||
{
|
||||
uint32_t nof_buffers = POOL_SIZE;
|
||||
if (capacity > 0) {
|
||||
nof_buffers = (uint32_t) capacity_;
|
||||
}
|
||||
pthread_mutex_init(&mutex, NULL);
|
||||
for(uint32_t i=0;i<nof_buffers;i++) {
|
||||
buffer_t *b = new buffer_t;
|
||||
|
@ -162,10 +166,10 @@ class byte_buffer_pool {
|
|||
public:
|
||||
// Singleton static methods
|
||||
static byte_buffer_pool *instance;
|
||||
static byte_buffer_pool* get_instance(void);
|
||||
static byte_buffer_pool* get_instance(int capacity = -1);
|
||||
static void cleanup(void);
|
||||
byte_buffer_pool() {
|
||||
pool = new buffer_pool<byte_buffer_t>;
|
||||
byte_buffer_pool(int capacity = -1) {
|
||||
pool = new buffer_pool<byte_buffer_t>(capacity);
|
||||
}
|
||||
~byte_buffer_pool() {
|
||||
delete pool;
|
||||
|
@ -178,7 +182,9 @@ public:
|
|||
return;
|
||||
}
|
||||
b->reset();
|
||||
pool->deallocate(b);
|
||||
if (!pool->deallocate(b)) {
|
||||
fprintf(stderr, "Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b);
|
||||
}
|
||||
b = NULL;
|
||||
}
|
||||
void print_all_buffers() {
|
||||
|
|
|
@ -35,11 +35,13 @@ namespace srslte{
|
|||
byte_buffer_pool *byte_buffer_pool::instance = NULL;
|
||||
pthread_mutex_t instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
byte_buffer_pool* byte_buffer_pool::get_instance(void)
|
||||
byte_buffer_pool* byte_buffer_pool::get_instance(int capacity)
|
||||
{
|
||||
pthread_mutex_lock(&instance_mutex);
|
||||
if(NULL == instance)
|
||||
instance = new byte_buffer_pool();
|
||||
if(NULL == instance) {
|
||||
printf("Creating buffer pool capacity=%d\n", capacity);
|
||||
instance = new byte_buffer_pool(capacity);
|
||||
}
|
||||
pthread_mutex_unlock(&instance_mutex);
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -173,6 +173,8 @@ public:
|
|||
private:
|
||||
static enb *instance;
|
||||
|
||||
const static int ENB_POOL_SIZE = 1024*10;
|
||||
|
||||
enb();
|
||||
|
||||
virtual ~enb();
|
||||
|
|
|
@ -55,7 +55,7 @@ void enb::cleanup(void)
|
|||
|
||||
enb::enb() : started(false) {
|
||||
srslte_dft_load();
|
||||
pool = srslte::byte_buffer_pool::get_instance();
|
||||
pool = srslte::byte_buffer_pool::get_instance(ENB_POOL_SIZE);
|
||||
|
||||
logger = NULL;
|
||||
args = NULL;
|
||||
|
|
Loading…
Reference in New Issue