Skip to content

Commit

Permalink
netkvm: activate lazy RX memory allocation
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ybendito committed Dec 23, 2024
1 parent 16d4ae1 commit 6f8a7bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion NetKVM/Common/ParaNdis_RX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 6f8a7bb

Please sign in to comment.