Don't create implicit packet sets for Tx
As part of Turbo changes, we made changes to create explicit packet sets, but for the base code we continued creating implicit packet sets for some cases. With this change we don't create any implicit packet set. This change needs to be tested thoroughly for multiple cases.
This commit is contained in:
parent
5dc1b851cc
commit
2104936b69
@ -109,6 +109,7 @@ void PcapTxThread::clearPacketList()
|
|||||||
void PcapTxThread::loopNextPacketSet(qint64 size, qint64 repeats,
|
void PcapTxThread::loopNextPacketSet(qint64 size, qint64 repeats,
|
||||||
long repeatDelaySec, long repeatDelayNsec)
|
long repeatDelaySec, long repeatDelayNsec)
|
||||||
{
|
{
|
||||||
|
#if 0 // Don't let implicit packet sets be created
|
||||||
// XXX: The below change was done as part of Turbo code
|
// XXX: The below change was done as part of Turbo code
|
||||||
// implementation alongwith calls to this function from
|
// implementation alongwith calls to this function from
|
||||||
// AbstractPort::updatePacketListSequential(). Turbo to
|
// AbstractPort::updatePacketListSequential(). Turbo to
|
||||||
@ -125,6 +126,7 @@ void PcapTxThread::loopNextPacketSet(qint64 size, qint64 repeats,
|
|||||||
// mentioned above
|
// mentioned above
|
||||||
if (repeats == 1)
|
if (repeats == 1)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
currentPacketSequence_ = new PacketSequence(trackStreamStats_);
|
currentPacketSequence_ = new PacketSequence(trackStreamStats_);
|
||||||
currentPacketSequence_->repeatCount_ = repeats;
|
currentPacketSequence_->repeatCount_ = repeats;
|
||||||
@ -148,24 +150,17 @@ bool PcapTxThread::appendToPacketList(long sec, long nsec,
|
|||||||
pktHdr.ts.tv_sec = sec;
|
pktHdr.ts.tv_sec = sec;
|
||||||
pktHdr.ts.tv_usec = nsec/1000;
|
pktHdr.ts.tv_usec = nsec/1000;
|
||||||
|
|
||||||
if (currentPacketSequence_ == NULL ||
|
// loopNextPacketSet should have created a seq
|
||||||
!currentPacketSequence_->hasFreeSpace(2*sizeof(pcap_pkthdr)+length))
|
Q_ASSERT(currentPacketSequence_ != NULL);
|
||||||
{
|
|
||||||
if (currentPacketSequence_ != NULL)
|
|
||||||
{
|
|
||||||
long usecs;
|
|
||||||
|
|
||||||
usecs = (pktHdr.ts.tv_sec
|
// If not enough space, update usecDelay and alloc a new seq
|
||||||
- currentPacketSequence_->lastPacket_->ts.tv_sec)
|
if (!currentPacketSequence_->hasFreeSpace(2*sizeof(pcap_pkthdr)+length))
|
||||||
* long(1e6);
|
{
|
||||||
usecs += (pktHdr.ts.tv_usec
|
currentPacketSequence_->usecDelay_ = udiffTimeStamp(
|
||||||
- currentPacketSequence_->lastPacket_->ts.tv_usec);
|
¤tPacketSequence_->lastPacket_->ts, &pktHdr.ts);
|
||||||
currentPacketSequence_->usecDelay_ = usecs;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \todo (LOW): calculate sendqueue size
|
//! \todo (LOW): calculate sendqueue size
|
||||||
currentPacketSequence_ = new PacketSequence(trackStreamStats_);
|
currentPacketSequence_ = new PacketSequence(trackStreamStats_);
|
||||||
|
|
||||||
packetSequenceList_.append(currentPacketSequence_);
|
packetSequenceList_.append(currentPacketSequence_);
|
||||||
|
|
||||||
// Validate that the pkt will fit inside the new currentSendQueue_
|
// Validate that the pkt will fit inside the new currentSendQueue_
|
||||||
@ -181,6 +176,8 @@ bool PcapTxThread::appendToPacketList(long sec, long nsec,
|
|||||||
packetCount_++;
|
packetCount_++;
|
||||||
packetListSize_ += repeatSize_ ?
|
packetListSize_ += repeatSize_ ?
|
||||||
currentPacketSequence_->repeatCount_ : 1;
|
currentPacketSequence_->repeatCount_ : 1;
|
||||||
|
|
||||||
|
// Last packet of packet-set?
|
||||||
if (repeatSize_ > 0 && packetCount_ == repeatSize_)
|
if (repeatSize_ > 0 && packetCount_ == repeatSize_)
|
||||||
{
|
{
|
||||||
qDebug("repeatSequenceStart_=%d, repeatSize_ = %llu",
|
qDebug("repeatSequenceStart_=%d, repeatSize_ = %llu",
|
||||||
@ -202,7 +199,7 @@ bool PcapTxThread::appendToPacketList(long sec, long nsec,
|
|||||||
|
|
||||||
repeatSize_ = 0;
|
repeatSize_ = 0;
|
||||||
|
|
||||||
// End current pktSeq and trigger a new pktSeq allocation for next pkt
|
// End current pktSeq
|
||||||
currentPacketSequence_ = NULL;
|
currentPacketSequence_ = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user