Beispiel #1
0
 public Mempool(ulong baseAddr, uint bufSize, uint numEntries)
 {
     this.BaseAddress = baseAddr;
     this.BufferSize  = bufSize;
     this.NumEntries  = numEntries;
     //Register this mempool to static list of pools
     Mempool.AddPool(this);
 }
Beispiel #2
0
        public static void AddPool(Mempool pool)
        {
            long i = 0;

            while (!ValidId(i))
            {
                i++;
            }
            pool.Id = i;
            Pools.Add(pool);
        }
Beispiel #3
0
        public static Mempool AllocateMempool(uint numEntries, uint entrySize = 2048)
        {
            if (HugePageSize % entrySize != 0)
            {
                Log.Error("FATAL: Entry size must be a divisor of the huge page size {0}", HugePageSize);
                Environment.Exit(1);
            }

            var dma     = AllocateDmaC(numEntries * entrySize, false);
            var mempool = new Mempool(dma.VirtualAddress, entrySize, numEntries);

            mempool.PreallocateBuffers();
            return(mempool);
        }
Beispiel #4
0
 public static void FreePool(Mempool pool)
 {
     Pools.Remove(pool);
 }