Skip to content

Refactor queue limit #4098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,14 @@ QuicConnQueueRecvPackets(
PacketsTail = (QUIC_RX_PACKET**)&((*PacketsTail)->Next);
}

//
// Base the limit of queued packets on the connection-wide flow control, but
// allow at least a few packets even if the app configured an extremely
// tiny FC window.
//
const uint32_t QueueLimit =
CXPLAT_MAX(10, Connection->Settings.ConnFlowControlWindow >> 10);

QuicTraceLogConnVerbose(
QueueDatagrams,
Connection,
Expand All @@ -3157,7 +3165,7 @@ QuicConnQueueRecvPackets(

BOOLEAN QueueOperation;
CxPlatDispatchLockAcquire(&Connection->ReceiveQueueLock);
if (Connection->ReceiveQueueCount >= QUIC_MAX_RECEIVE_QUEUE_COUNT) {
if (Connection->ReceiveQueueCount >= QueueLimit) {
QueueOperation = FALSE;
} else {
*Connection->ReceiveQueueTail = Packets;
Expand Down
10 changes: 0 additions & 10 deletions src/core/quicdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,6 @@ typedef struct QUIC_RX_PACKET QUIC_RX_PACKET;
//
#define QUIC_MAX_CRYPTO_BATCH_COUNT 8

//
// The maximum number of received packets that may be queued on a single
// connection. When this limit is reached, any additional packets are dropped.
//
#ifdef _KERNEL_MODE
#define QUIC_MAX_RECEIVE_QUEUE_COUNT 1024
#else
#define QUIC_MAX_RECEIVE_QUEUE_COUNT 8192
#endif

//
// The maximum number of received packets that may be processed in a single
// flush operation.
Expand Down