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 1 commit
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
44 changes: 26 additions & 18 deletions src/core/ack_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,25 @@
)
{
if (ReorderingThreshold == 0) {
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
return FALSE;

Check warning on line 110 in src/core/ack_tracker.c

View check run for this annotation

Codecov / codecov/patch

src/core/ack_tracker.c#L110

Added line #L110 was not covered by tests
}

const uint64_t LargestUnacked = QuicRangeGetMax(&Tracker->PacketNumbersToAck);
const uint64_t SmallestTracked = QuicRangeGet(&Tracker->PacketNumbersToAck, 0)->Low;
uint64_t LargestReported; // The largest packet number that could be declared lost

//
// Largest Reported is equal to the largest packet number acknowledged minus the Reordering Threshold.
// If the difference between the largest packet number acknowledged and the Reordering Threshold is smaller than the
// smallest packet in the ack tracker, then the largest reported is the smallest packet in the ack tracker.
// Largest Reported is equal to the largest packet number acknowledged minus the
// Reordering Threshold. If the difference between the largest packet number
// acknowledged and the Reordering Threshold is smaller than the smallest packet
// in the ack tracker, then the largest reported is the smallest packet in the ack
// tracker.
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
//

if (Tracker->LargestPacketNumberAcknowledged >= QuicRangeGet(&Tracker->PacketNumbersToAck, 0)->Low + ReorderingThreshold) {
if (Tracker->LargestPacketNumberAcknowledged >= SmallestTracked + ReorderingThreshold) {
LargestReported = Tracker->LargestPacketNumberAcknowledged - ReorderingThreshold + 1;
} else {
LargestReported = QuicRangeGet(&Tracker->PacketNumbersToAck, 0)->Low;
LargestReported = SmallestTracked;
}

//
Expand All @@ -134,23 +137,29 @@
//

for (uint32_t Index = QuicRangeSize(&Tracker->PacketNumbersToAck) - 1; Index > 0; --Index) {
uint64_t SmallestMissing = QuicRangeGetHigh(QuicRangeGet(&Tracker->PacketNumbersToAck, Index - 1)) + 1; // Smallest missing in the previous gap
uint64_t RangeStart = QuicRangeGet(&Tracker->PacketNumbersToAck, Index)->Low; // Lowest Packet number in the subrange
uint64_t PreviousSmallestMissing = QuicRangeGetHigh(QuicRangeGet(&Tracker->PacketNumbersToAck, Index - 1)) + 1;
const uint64_t RangeStart = QuicRangeGet(&Tracker->PacketNumbersToAck, Index)->Low;

//
// Check if largest reported packet is missing. In that case, the smalles missing packet becomes the largest reported packet.
// Check if largest reported packet is missing. In that case, the smallest missing
// packet becomes the largest reported packet.
//
if (LargestReported > SmallestMissing) {
if (RangeStart > LargestReported) {
SmallestMissing = LargestReported;
} else {
return FALSE;
}

if (LargestReported >= RangeStart) {
//
// Since we are only looking for packets more than LargestReported, we return
// false here.
//
return FALSE;
}

if (LargestReported > PreviousSmallestMissing) {
PreviousSmallestMissing = LargestReported;

Check warning on line 157 in src/core/ack_tracker.c

View check run for this annotation

Codecov / codecov/patch

src/core/ack_tracker.c#L157

Added line #L157 was not covered by tests
}
if (LargestUnacked - SmallestMissing >= ReorderingThreshold) {
if (LargestUnacked - PreviousSmallestMissing >= ReorderingThreshold) {
return TRUE;
}
}

Check warning on line 162 in src/core/ack_tracker.c

View check run for this annotation

Codecov / codecov/patch

src/core/ack_tracker.c#L162

Added line #L162 was not covered by tests
return FALSE;
}

Expand Down Expand Up @@ -336,12 +345,11 @@

//
// Drop all packet numbers less than or equal to the largest acknowledged
// packet number - Reordering Threshold + 1. This is so that we dont lose
// memory of packets that are missing and are yet to be reported.
// packet number.
//
QuicRangeSetMin(
&Tracker->PacketNumbersToAck,
LargestAckedPacketNumber - Connection->ReorderingThreshold + 2);
LargestAckedPacketNumber + 1);

if (!QuicAckTrackerHasPacketsToAck(Tracker) &&
Tracker->AckElicitingPacketsToAcknowledge) {
Expand Down
56 changes: 32 additions & 24 deletions src/core/unittest/FrameTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,20 @@ TEST(FrameTest, ReliableResetStreamFrameEncodeDecode)
ASSERT_EQ(Frame.ReliableSize, DecodedFrame.ReliableSize);
}

BOOLEAN DidHitReorderingThreshold(
//
// Tests if the reordering threshold has been hit. This function initializes a
// QUIC_ACK_TRACKER and populates it with the provided packet numbers. It then
// calls QuicAckTrackerDidHitReorderingThreshold to determine if the reordering
// threshold has been hit.
//
//
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
bool TestReorderingThreshold(
uint8_t ReorderingThreshold,
uint64_t LargestPacketNumberAcknowledged,
const std::vector<std::vector<int>>& AckTrackerLists)
{
QUIC_ACK_TRACKER Tracker;
QuicAckTrackerInitialize(&Tracker);;
QuicAckTrackerInitialize(&Tracker);
for (const auto& List : AckTrackerLists) {
for (int i : List) {
QuicRangeAddValue(&Tracker.PacketNumbersToAck, i);
Expand All @@ -263,30 +270,31 @@ BOOLEAN DidHitReorderingThreshold(

TEST(FrameTest, TestQuicAckTrackerDidHitReorderingThreshold)
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
{

ASSERT_FALSE(DidHitReorderingThreshold(0, 0, {{100}}));

// Case 1

ASSERT_FALSE(DidHitReorderingThreshold(3, 0, {{0}}));
ASSERT_FALSE(DidHitReorderingThreshold(3, 0, {{0, 1}}));
ASSERT_FALSE(DidHitReorderingThreshold(3, 0, {{0, 1}, {3}}));
ASSERT_FALSE(DidHitReorderingThreshold(3, 0, {{0, 1}, {3, 4}}));
ASSERT_TRUE(DidHitReorderingThreshold(3, 0, {{0, 1}, {3, 4, 5}}));
ASSERT_FALSE(DidHitReorderingThreshold(3, 5, {{0, 1}, {3, 4, 5}, {8}}));
ASSERT_TRUE(DidHitReorderingThreshold(3, 5, {{0, 1}, {3, 4, 5}, {8, 9}}));
ASSERT_TRUE(DidHitReorderingThreshold(3, 9, {{0, 1}, {3, 4, 5}, {8, 9, 10}}));
ASSERT_FALSE(TestReorderingThreshold(0, 0, {{100}}));

// Case 1
ASSERT_FALSE(TestReorderingThreshold(3, 0, {{0}}));
ASSERT_FALSE(TestReorderingThreshold(3, 0, {{0, 1}}));
ASSERT_FALSE(TestReorderingThreshold(3, 0, {{0, 1}, {3}}));
ASSERT_FALSE(TestReorderingThreshold(3, 0, {{0, 1}, {3, 4}}));
ASSERT_TRUE(TestReorderingThreshold(3, 0, {{0, 1}, {3, 4, 5}}));
ASSERT_FALSE(TestReorderingThreshold(3, 5, {{0, 1}, {3, 4, 5}, {8}}));
ASSERT_TRUE(TestReorderingThreshold(3, 5, {{0, 1}, {3, 4, 5}, {8, 9}}));
ASSERT_TRUE(TestReorderingThreshold(3, 9, {{0, 1}, {3, 4, 5}, {8, 9, 10}}));
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved

// Case 2
ASSERT_FALSE(DidHitReorderingThreshold(5, 0, {{0}}));
ASSERT_FALSE(DidHitReorderingThreshold(5, 0, {{0, 1}}));
ASSERT_FALSE(DidHitReorderingThreshold(5, 0, {{0, 1}, {3}}));
ASSERT_FALSE(DidHitReorderingThreshold(5, 0, {{0, 1}, {3}, {5}}));
ASSERT_FALSE(DidHitReorderingThreshold(5, 0, {{0, 1}, {3}, {5, 6}}));
ASSERT_TRUE(DidHitReorderingThreshold(5, 0, {{0, 1}, {3}, {5, 6, 7}}));
ASSERT_FALSE(DidHitReorderingThreshold(5, 7, {{0, 1}, {3}, {5, 6, 7, 8}}));
ASSERT_TRUE(DidHitReorderingThreshold(5, 7, {{0, 1}, {3}, {5, 6, 7, 8, 9}}));

ASSERT_FALSE(TestReorderingThreshold(5, 0, {{0}}));
ASSERT_FALSE(TestReorderingThreshold(5, 0, {{0, 1}}));
ASSERT_FALSE(TestReorderingThreshold(5, 0, {{0, 1}, {3}}));
ASSERT_FALSE(TestReorderingThreshold(5, 0, {{0, 1}, {3}, {5}}));
ASSERT_FALSE(TestReorderingThreshold(5, 0, {{0, 1}, {3}, {5, 6}}));
ASSERT_TRUE(TestReorderingThreshold(5, 0, {{0, 1}, {3}, {5, 6, 7}}));
ASSERT_FALSE(TestReorderingThreshold(5, 7, {{0, 1}, {3}, {5, 6, 7, 8}}));
ASSERT_TRUE(TestReorderingThreshold(5, 7, {{0, 1}, {3}, {5, 6, 7, 8, 9}}));

ASSERT_TRUE(TestReorderingThreshold(5, 4, {{1, 2}, {4}, {10}}));
ASSERT_FALSE(TestReorderingThreshold(5, 0, {{1, 2}, {4}}));
ASSERT_FALSE(TestReorderingThreshold(5, 2, {{1, 2}, {4}}));
gaurav2699 marked this conversation as resolved.
Show resolved Hide resolved
}

struct ResetStreamFrameParams {
Expand Down
Loading