Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Fix inaccurate low tx rates (~1000pps) in seq mode
Browse files Browse the repository at this point in the history
Creation of explicit packet sets had both a packet set delay and a list loop
delay set leading to lower than configured rate at tx. Earlier implicit
packet set always had set delay as 0 and only list loop delay was used.

Fix is to always set list loop delay to 0 in sequential mode as packet set
will have the correct delay set due to explicit packet sets.
  • Loading branch information
pstavirs committed Jun 22, 2023
1 parent 2941c7e commit c044880
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 12 additions & 6 deletions server/abstractport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ int AbstractPort::updatePacketListSequential()

if (n >= 1) {
loopNextPacketSet(x, n, 0, loopDelay);
qDebug("PacketSet: n = %lu, x = %lu", n, x);
qDebug("PacketSet: n = %lu, x = %lu, delay = %llu ns",
n, x, loopDelay);
}
else if (n == 0)
x = 0;
Expand All @@ -365,7 +366,8 @@ int AbstractPort::updatePacketListSequential()
// Create a packet set for 'y' with repeat = 1
if (j == x) {
loopNextPacketSet(y, 1, 0, loopDelay);
qDebug("PacketSet: n = 1, y = %lu", y);
qDebug("PacketSet: n = 1, y = %lu, delay = %llu",
y, loopDelay);
}

qDebug("q(%d, %d) sec = %lu nsec = %lu",
Expand Down Expand Up @@ -440,9 +442,10 @@ int AbstractPort::updatePacketListSequential()
returnToQIdx = 0;
*/

setPacketListLoopMode(true, 0,
streamList_[i]->sendUnit() ==
StreamBase::e_su_bursts ? ibg1 : ipg1);
// XXX: no list loop delay required since we don't create
// any implicit packet sets now
setPacketListLoopMode(true, 0, 0);
qDebug("Seq mode list loop true with 0 delay");
goto _stop_no_more_pkts;

case StreamBase::e_nw_goto_next:
Expand Down Expand Up @@ -735,7 +738,10 @@ int AbstractPort::updatePacketListInterleaved()
} while ((sec < durSec) || ((sec == durSec) && (nsec < durNsec)));

// XXX: For interleaved mode, we ALWAYS have a single packet set with
// one repeat and 0n set loop delay
// one repeat and 0 set delay
// TODO: Since we now create an explicit packet set, we can also calc
// the actual packet set delay and set it here and set list loop delay
// as 0
loopNextPacketSet(totalPkts, 1, 0, 0);
qDebug("Interleaved single PacketSet of size %lld, duration %llu.%09llu "
"repeat 1 and delay 0",
Expand Down
2 changes: 2 additions & 0 deletions server/pcaptxthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ void PcapTxThread::run()
packetSequenceList_.at(i)->ttagL4CksumOffset_);
}

qDebug() << "Loop:" << (returnToQIdx_ >= 0)
<< "LoopDelay:" << loopDelay_;
qDebug() << "First Ttag: " << firstTtagPkt_
<< "Ttag Markers:" << ttagDeltaMarkers_;

Expand Down

0 comments on commit c044880

Please sign in to comment.