From 6f8a7bb1ac19217a953f70dcd96946dc878aa7f8 Mon Sep 17 00:00:00 2001 From: Yuri Benditovich Date: Mon, 23 Dec 2024 12:32:45 +0200 Subject: [PATCH] netkvm: activate lazy RX memory allocation Jira link: https://issues.redhat.com/browse/RHEL-40693 Initially allocate 16 buffers per RX queue, the rest of the buffers will be allocated by the system thread. Signed-off-by: Yuri Benditovich --- NetKVM/Common/ParaNdis_RX.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/NetKVM/Common/ParaNdis_RX.cpp b/NetKVM/Common/ParaNdis_RX.cpp index ec4e95e46..7f3fa3101 100644 --- a/NetKVM/Common/ParaNdis_RX.cpp +++ b/NetKVM/Common/ParaNdis_RX.cpp @@ -6,6 +6,10 @@ #include "ParaNdis_RX.tmh" #endif +//define as 0 to allocate all the required buffer at once +//#define INITIAL_RX_BUFFERS 0 +#define INITIAL_RX_BUFFERS 16 + static FORCEINLINE VOID ParaNdis_ReceiveQueueAddBuffer(PPARANDIS_RECEIVE_QUEUE pQueue, pRxNetDescriptor pBuffer) { NdisInterlockedInsertTailList(&pQueue->BuffersList, @@ -110,7 +114,11 @@ bool CParaNdisRX::Create(PPARANDIS_ADAPTER Context, UINT DeviceQueueIndex) { m_Context = Context; m_queueIndex = (u16)DeviceQueueIndex; - m_NetMaxReceiveBuffers = Context->maxRxBufferPerQueue; + m_NetMaxReceiveBuffers = INITIAL_RX_BUFFERS; + if (!m_NetMaxReceiveBuffers || m_NetMaxReceiveBuffers > Context->maxRxBufferPerQueue) + { + m_NetMaxReceiveBuffers = Context->maxRxBufferPerQueue; + } if (!m_VirtQueue.Create(DeviceQueueIndex, &m_Context->IODevice,