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

CoDel seems to be incorrectly dropping packets #165

Open
Centaurus99 opened this issue Mar 1, 2024 · 0 comments
Open

CoDel seems to be incorrectly dropping packets #165

Centaurus99 opened this issue Mar 1, 2024 · 0 comments

Comments

@Centaurus99
Copy link

In the CODELPacketQueue::dequeue function, dodequeue_result r is redefined at Line 74 and Line 84. Therefore, it seems that this function finally returns the packet obtained from dodequeue at line 65, which may have been intended to be dropped.

QueuedPacket CODELPacketQueue::dequeue( void )
{
const uint64_t now = timestamp();
dodequeue_result r = std::move( dodequeue ( now ) );
uint32_t delta;
if ( dropping_ ) {
if ( !r.ok_to_drop ) {
dropping_ = false;
}
while ( now >= drop_next_ && dropping_ ) {
dodequeue_result r = std::move( dodequeue ( now ) );
count_++;
if ( ! r.ok_to_drop ) {
dropping_ = false;
} else {
drop_next_ = control_law(drop_next_, count_);
}
}
}
else if ( r.ok_to_drop ) {
dodequeue_result r = std::move( dodequeue ( now ) );
dropping_ = true;
delta = count_ - lastcount_;
count_ = ( ( delta > 1 ) && ( now - drop_next_ < 16 * interval_ ))?
delta : 1;
drop_next_ = control_law ( now, count_ );
lastcount_ = count_;
}
return r.p;
}

This does not seem to affect the number of dropped packets, but rather which specific packet is dropped.

If this is indeed a bug, perhaps this patch should work.

diff --git a/src/packet/codel_packet_queue.cc b/src/packet/codel_packet_queue.cc
index 047d2c1..d33b86e 100755
--- a/src/packet/codel_packet_queue.cc
+++ b/src/packet/codel_packet_queue.cc
@@ -71,7 +71,7 @@ QueuedPacket CODELPacketQueue::dequeue( void )
     }
 
     while ( now >= drop_next_ && dropping_ ) {
-      dodequeue_result r = std::move( dodequeue ( now ) );
+      r = std::move( dodequeue ( now ) );
       count_++;
       if ( ! r.ok_to_drop ) {
 	dropping_ = false;
@@ -81,7 +81,7 @@ QueuedPacket CODELPacketQueue::dequeue( void )
     }
   }
   else if ( r.ok_to_drop ) {
-    dodequeue_result r = std::move( dodequeue ( now ) );
+    r = std::move( dodequeue ( now ) );
     dropping_ = true;
     delta = count_ - lastcount_;
     count_ = ( ( delta > 1 ) && ( now - drop_next_ < 16 * interval_ ))? 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant