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); }
public static void AddPool(Mempool pool) { long i = 0; while (!ValidId(i)) { i++; } pool.Id = i; Pools.Add(pool); }
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); }
public static void FreePool(Mempool pool) { Pools.Remove(pool); }