Skip to content
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

Updated ACK_FREQUENCY according to draft-ietf-quic-ack-frequency-10 #4670

Merged
merged 32 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d6cde24
added reordering threshold in ack frequency
gaurav2699 Nov 28, 2024
bf614d9
modified log filesd
gaurav2699 Dec 2, 2024
542c781
few refactoring
gaurav2699 Dec 2, 2024
54a90da
minor refactoring
gaurav2699 Dec 2, 2024
8097350
fixed clog
gaurav2699 Dec 2, 2024
e7b4add
fixed clog
gaurav2699 Dec 3, 2024
5fdcc8d
removed IgnoreOrder
gaurav2699 Dec 3, 2024
3f17438
removed IgnoreCE
gaurav2699 Dec 3, 2024
d4ed890
updated names
gaurav2699 Dec 3, 2024
d7d69b8
updated the values
gaurav2699 Dec 3, 2024
93dd676
added logic for reordering
gaurav2699 Dec 4, 2024
4a2c327
removed ignorereordering parameter in connection
gaurav2699 Dec 4, 2024
77474a6
added assert
gaurav2699 Dec 4, 2024
d607245
updated logic for the reordering threshold function
gaurav2699 Dec 4, 2024
7a8cbad
minor change
gaurav2699 Dec 4, 2024
4c0e62a
added unit test
gaurav2699 Dec 5, 2024
6191f1f
added more unit test cases
gaurav2699 Dec 5, 2024
1d1e130
changed the reordering logic
gaurav2699 Dec 11, 2024
4a9aae6
minor refactoring
gaurav2699 Dec 11, 2024
f354d43
minor refactoring
gaurav2699 Dec 12, 2024
2cb10ef
changed variable names
gaurav2699 Dec 15, 2024
5e48229
modified way of implementing to be more optimised
gaurav2699 Dec 16, 2024
d2baaa0
addressed comments
gaurav2699 Dec 17, 2024
95a3533
resolved comments
gaurav2699 Dec 18, 2024
a928db6
modified variable name
gaurav2699 Dec 19, 2024
70b564e
changed the alogrithm logic
gaurav2699 Dec 23, 2024
f53a7fb
resolved comments
gaurav2699 Dec 24, 2024
56f3f00
addressed comments
gaurav2699 Dec 24, 2024
a8f2386
minor change
gaurav2699 Dec 24, 2024
7a37125
minor change to fix the pipeline
gaurav2699 Jan 3, 2025
d94d218
minor change
gaurav2699 Jan 3, 2025
140e052
New Largest Packet Number check shifted
gaurav2699 Jan 3, 2025
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
11 changes: 6 additions & 5 deletions src/core/ack_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ QuicAckTrackerAckPacket(
// 1. The packet included an IMMEDIATE_ACK frame.
// 2. ACK delay is disabled (MaxAckDelayMs == 0).
// 3. We have received 'PacketTolerance' ACK eliciting packets.
// 4. We received an ACK eliciting packet that doesn't directly follow the
// previously received packet number. So we assume there might have
// been loss and should indicate this info to the peer. This logic is
// disabled if 'IgnoreReordering' is TRUE.
// 4. We had received an ACK eliciting packet that is out of order and the
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
// gap between the smallest Unreported Missing packet and the Largest
// Unacked is greater than or equal to the Reordering Threshold value. This logic is
// disabled if 'IgnoreReordering' is TRUE or the Reordering Threshold is 0.
// 5. The delayed ACK timer fires after the configured time.
//
// If we don't queue an immediate ACK and this is the first ACK eliciting
Expand All @@ -196,11 +196,12 @@ QuicAckTrackerAckPacket(
Connection->Settings.MaxAckDelayMs == 0 ||
(Tracker->AckElicitingPacketsToAcknowledge >= (uint16_t)Connection->PacketTolerance) ||
(!Connection->State.IgnoreReordering &&
Connection->ReorderingThreshold > 0 &&
(NewLargestPacketNumber &&
QuicRangeSize(&Tracker->PacketNumbersToAck) > 1 && // There are more than two ranges, i.e. a gap somewhere.
QuicRangeGet(
&Tracker->PacketNumbersToAck,
QuicRangeSize(&Tracker->PacketNumbersToAck) - 1)->Count == 1))) { // The gap is right before the last packet number.
QuicRangeSize(&Tracker->PacketNumbersToAck) - 1)->Count == Connection->ReorderingThreshold))) {
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
//
// Send the ACK immediately.
//
Expand Down
7 changes: 7 additions & 0 deletions src/core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ QuicConnAlloc(
Connection->AckDelayExponent = QUIC_ACK_DELAY_EXPONENT;
Connection->PacketTolerance = QUIC_MIN_ACK_SEND_NUMBER;
Connection->PeerPacketTolerance = QUIC_MIN_ACK_SEND_NUMBER;
Connection->ReorderingThreshold = QUIC_MIN_REORDERING_THRESHOLD;
Connection->PeerReorderingThreshold = QUIC_MIN_REORDERING_THRESHOLD;
Connection->PeerTransportParams.AckDelayExponent = QUIC_TP_ACK_DELAY_EXPONENT_DEFAULT;
Connection->ReceiveQueueTail = &Connection->ReceiveQueue;
QuicSettingsCopy(&Connection->Settings, &MsQuicLib.Settings);
Expand Down Expand Up @@ -5245,6 +5247,11 @@ QuicConnRecvFrames(
} else {
Connection->PacketTolerance = UINT8_MAX; // Cap to 0xFF for space savings.
}
if (Frame.ReorderingThreshold < UINT8_MAX) {
Connection->ReorderingThreshold = (uint8_t)Frame.ReorderingThreshold;
} else {
Connection->ReorderingThreshold = UINT8_MAX; // Cap to 0xFF for space savings.
}
QuicTraceLogConnInfo(
UpdatePacketTolerance,
Connection,
Expand Down
15 changes: 15 additions & 0 deletions src/core/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,21 @@ typedef struct QUIC_CONNECTION {
// be able to send to the peer.
//
uint8_t PeerPacketTolerance;

//
// The maximum number of packets that can be out of order before an immediate
// acknowledgment (ACK) is triggered. If no specific instructions (ACK_FREQUENCY
// frames) are received from the peer, the receiver will immediately acknowledge
// any out-of-order packets, which means the default value is 1. A value of 0
// means out-of-order packets do not trigger an immediate ACK.
//
uint8_t ReorderingThreshold;
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved

//
// The maximum number of packets that the peer can be out of order before an immediate
// acknowledgment (ACK) is triggered.
//
uint8_t PeerReorderingThreshold;
nibanks marked this conversation as resolved.
Show resolved Hide resolved

//
// The ACK frequency sequence number we are currently using to send.
Expand Down
8 changes: 6 additions & 2 deletions src/core/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,7 @@ QuicAckFrequencyFrameEncode(
QuicVarIntSize(Frame->SequenceNumber) +
QuicVarIntSize(Frame->PacketTolerance) +
QuicVarIntSize(Frame->UpdateMaxAckDelay) +
QuicVarIntSize(Frame->ReorderingThreshold) +
sizeof(QUIC_ACK_FREQUENCY_EXTRAS);

if (BufferLength < *Offset + RequiredLength) {
Expand All @@ -1279,6 +1280,7 @@ QuicAckFrequencyFrameEncode(
Buffer = QuicVarIntEncode(Frame->SequenceNumber, Buffer);
Buffer = QuicVarIntEncode(Frame->PacketTolerance, Buffer);
Buffer = QuicVarIntEncode(Frame->UpdateMaxAckDelay, Buffer);
Buffer = QuicVarIntEncode(Frame->ReorderingThreshold, Buffer);
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
QuicUint8Encode(Extras.Value, Buffer);
*Offset += RequiredLength;

Expand All @@ -1299,6 +1301,7 @@ QuicAckFrequencyFrameDecode(
if (!QuicVarIntDecode(BufferLength, Buffer, Offset, &Frame->SequenceNumber) ||
!QuicVarIntDecode(BufferLength, Buffer, Offset, &Frame->PacketTolerance) ||
!QuicVarIntDecode(BufferLength, Buffer, Offset, &Frame->UpdateMaxAckDelay) ||
!QuicVarIntDecode(BufferLength, Buffer, Offset, &Frame->ReorderingThreshold) ||
!QuicUint8tDecode(BufferLength, Buffer, Offset, &Extras.Value)) {
return FALSE;
}
Expand Down Expand Up @@ -1963,13 +1966,14 @@ QuicFrameLog(

QuicTraceLogVerbose(
FrameLogAckFrequency,
"[%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu IgnoreOrder:%hhu IgnoreCE:%hhu",
"[%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu ReorderThreshold: %llu IgnoreOrder:%hhu IgnoreCE:%hhu",
PtkConnPre(Connection),
PktRxPre(Rx),
PacketNumber,
Frame.SequenceNumber,
Frame.PacketTolerance,
Frame.UpdateMaxAckDelay,
Frame.ReorderingThreshold,
Frame.IgnoreOrder,
Frame.IgnoreCE);
break;
Expand Down Expand Up @@ -2006,7 +2010,7 @@ QuicFrameLog(
Frame.Timestamp);
break;
}

case QUIC_FRAME_RELIABLE_RESET_STREAM: {
QUIC_RELIABLE_RESET_STREAM_EX Frame;
if (!QuicReliableResetFrameDecode(PacketLength, Packet, Offset, &Frame)) {
Expand Down
1 change: 1 addition & 0 deletions src/core/frame.h
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ typedef struct QUIC_ACK_FREQUENCY_EX {
QUIC_VAR_INT SequenceNumber;
QUIC_VAR_INT PacketTolerance;
QUIC_VAR_INT UpdateMaxAckDelay; // In microseconds (us)
QUIC_VAR_INT ReorderingThreshold;
BOOLEAN IgnoreOrder;
BOOLEAN IgnoreCE;
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
6 changes: 6 additions & 0 deletions src/core/quicdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ typedef struct QUIC_RX_PACKET QUIC_RX_PACKET;
//
#define QUIC_MIN_ACK_SEND_NUMBER 2

//
// The value for Reordering threshold when no ACK_FREQUENCY frame is received.
// This means that the receiver will immediately acknowledge any out-of-order packets.
//
#define QUIC_MIN_REORDERING_THRESHOLD 1

//
// The size of the stateless reset token.
//
Expand Down
1 change: 1 addition & 0 deletions src/core/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ QuicSendWriteFrames(
Frame.SequenceNumber = Connection->SendAckFreqSeqNum;
Frame.PacketTolerance = Connection->PeerPacketTolerance;
Frame.UpdateMaxAckDelay = MS_TO_US(QuicConnGetAckDelay(Connection));
Frame.ReorderingThreshold = Connection->PeerReorderingThreshold;
Frame.IgnoreOrder = FALSE;
Frame.IgnoreCE = FALSE;

Expand Down
2 changes: 1 addition & 1 deletion src/core/unittest/FrameTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ struct ResetStreamFrameParams {
uint8_t TestValue = (j & 1) ? 64 : 255;

if (i & 1) {
Temp.Buffer[1] = TestValue;
Temp.Buffer[1] = TestValue;
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
} else {
Temp.Buffer[1] = 0;
}
Expand Down
16 changes: 9 additions & 7 deletions src/generated/linux/frame.c.clog.h
Original file line number Diff line number Diff line change
Expand Up @@ -1173,16 +1173,17 @@ tracepoint(CLOG_FRAME_C, FrameLogAckFrequencyInvalid , arg2, arg3, arg4);\

/*----------------------------------------------------------
// Decoder Ring for FrameLogAckFrequency
// [%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu IgnoreOrder:%hhu IgnoreCE:%hhu
// [%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu ReorderThreshold:%llu IgnoreOrder:%hhu IgnoreCE:%hhu
// QuicTraceLogVerbose(
FrameLogAckFrequency,
"[%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu IgnoreOrder:%hhu IgnoreCE:%hhu",
"[%c][%cX][%llu] ACK_FREQUENCY SeqNum:%llu PktTolerance:%llu MaxAckDelay:%llu ReorderThreshold:%llu IgnoreOrder:%hhu IgnoreCE:%hhu",
PtkConnPre(Connection),
PktRxPre(Rx),
PacketNumber,
Frame.SequenceNumber,
Frame.PacketTolerance,
Frame.UpdateMaxAckDelay,
Frame.ReorderingThreshold,
Frame.IgnoreOrder,
Frame.IgnoreCE);
// arg2 = arg2 = PtkConnPre(Connection) = arg2
Expand All @@ -1191,12 +1192,13 @@ tracepoint(CLOG_FRAME_C, FrameLogAckFrequencyInvalid , arg2, arg3, arg4);\
// arg5 = arg5 = Frame.SequenceNumber = arg5
// arg6 = arg6 = Frame.PacketTolerance = arg6
// arg7 = arg7 = Frame.UpdateMaxAckDelay = arg7
// arg8 = arg8 = Frame.IgnoreOrder = arg8
// arg9 = arg9 = Frame.IgnoreCE = arg9
// arg8 = arg8 = Frame.ReorderingThreshold = arg8
// arg9 = arg9 = Frame.IgnoreOrder = arg9
// arg10 = arg10 = Frame.IgnoreCE = arg10
----------------------------------------------------------*/
#ifndef _clog_10_ARGS_TRACE_FrameLogAckFrequency
#define _clog_10_ARGS_TRACE_FrameLogAckFrequency(uniqueId, encoded_arg_string, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)\
tracepoint(CLOG_FRAME_C, FrameLogAckFrequency , arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);\
#ifndef _clog_11_ARGS_TRACE_FrameLogAckFrequency
#define _clog_11_ARGS_TRACE_FrameLogAckFrequency(uniqueId, encoded_arg_string, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)\
tracepoint(CLOG_FRAME_C, FrameLogAckFrequency , arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);\

#endif

Expand Down
Loading
Loading