Jumbo frames support added. Max packet size currently is set to 16K - underlying OS and hardware needs to support jumbo frames to be able to actually use this feature.

Fixes issue 27
This commit is contained in:
Srivats P. 2011-01-17 18:38:45 +05:30
parent 71a8140abf
commit 8d85fd30de
8 changed files with 26 additions and 41 deletions

View File

@ -162,7 +162,7 @@ void PortGroup::when_portListChanged(quint32 /*portGroupId*/)
{
if (state() == QAbstractSocket::ConnectedState && numPorts() <= 0)
{
QMessageBox::warning(NULL, tr("Ostinato"),
QMessageBox::warning(NULL, tr("No ports in portgroup"),
QString("The portgroup %1:%2 does not contain any ports!\n\n"
"Packet Transmit/Capture requires elevated privileges. "
"Please ensure that you are running 'drone' - the server "

View File

@ -257,8 +257,9 @@ void StreamConfigDialog::setupUiExtra()
** Setup Validators
*/
// Meta Data
//! \todo - doesn't seem to work - range validator needs a spinbox?
//lePktLen->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN, this));
lePktLen->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN, this));
lePktLenMin->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN,this));
lePktLenMax->setValidator(new QIntValidator(MIN_PKT_LEN, MAX_PKT_LEN,this));
/*
** Setup Connections

View File

@ -27,9 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include "packetmodel.h"
#include "modeltest.h"
#define MAX_MAC_ITER_COUNT 256
#define MAX_MAC_ITER_COUNT 256
#define MIN_PKT_LEN 64
#define MAX_PKT_LEN 1522
#define MAX_PKT_LEN 16384
/*
** TODO

View File

@ -104,15 +104,6 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="enabled" >
<bool>false</bool>
</property>
<property name="inputMask" >
<string>0099; </string>
</property>
<property name="text" >
<string/>
</property>
<property name="maxLength" >
<number>4</number>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
@ -120,15 +111,6 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</item>
<item row="1" column="0" >
<widget class="QLineEdit" name="lePktLen" >
<property name="inputMask" >
<string/>
</property>
<property name="text" >
<string/>
</property>
<property name="maxLength" >
<number>32767</number>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
@ -146,15 +128,6 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="enabled" >
<bool>false</bool>
</property>
<property name="inputMask" >
<string>0099; </string>
</property>
<property name="text" >
<string/>
</property>
<property name="maxLength" >
<number>4</number>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>

View File

@ -453,6 +453,7 @@ int StreamBase::frameValue(uchar *buf, int bufMaxSize, int frameIndex) const
bool StreamBase::preflightCheck(QString &result) const
{
bool pass = true;
int count = isFrameSizeVariable() ? frameCount() : 1;
for (int i = 0; i < count; i++)
@ -462,13 +463,18 @@ bool StreamBase::preflightCheck(QString &result) const
result += QString("One or more frames may be truncated - "
"frame length should be at least %1.\n")
.arg(frameProtocolLength(i) + kFcsSize);
goto _fail;
pass = false;
}
if (frameLen(i) > 1522)
{
result += QString("Jumbo frames may be truncated or dropped "
"if not supported by the hardware\n");
pass = false;
}
}
return true;
_fail:
return false;
return pass;
}
bool StreamBase::StreamLessThan(StreamBase* stream1, StreamBase* stream2)

View File

@ -113,7 +113,6 @@ void AbstractPort::updatePacketList()
{
int len;
bool isVariable;
uchar pktBuf[2000];
long sec = 0;
long usec = 0;
@ -162,7 +161,7 @@ void AbstractPort::updatePacketList()
else
{
isVariable = false;
len = streamList_[i]->frameValue(pktBuf, sizeof(pktBuf), 0);
len = streamList_[i]->frameValue(pktBuf_, sizeof(pktBuf_), 0);
}
for (int j = 0; j < numBursts; j++)
@ -171,8 +170,8 @@ void AbstractPort::updatePacketList()
{
if (isVariable)
{
len = streamList_[i]->frameValue(pktBuf,
sizeof(pktBuf), j * numPackets + k);
len = streamList_[i]->frameValue(pktBuf_,
sizeof(pktBuf_), j * numPackets + k);
}
if (len <= 0)
continue;
@ -180,7 +179,7 @@ void AbstractPort::updatePacketList()
qDebug("q(%d, %d, %d) sec = %lu usec = %lu",
i, j, k, sec, usec);
appendToPacketList(sec, usec, pktBuf, len);
appendToPacketList(sec, usec, pktBuf_, len);
usec += ipg;
if (usec > 1000000)

View File

@ -94,6 +94,10 @@ protected:
private:
bool isSendQueueDirty_;
static const int kMaxPktSize = 16384;
uchar pktBuf_[kMaxPktSize];
/*! \note StreamBase::id() and index into streamList[] are NOT same! */
QList<StreamBase*> streamList_;

View File

@ -315,6 +315,8 @@ void PcapPort::PortTransmitter::run()
int i;
qDebug("sendQueueList_.size = %d", sendQueueList_.size());
if (sendQueueList_.size() <= 0)
return;
for(i = 0; i < sendQueueList_.size(); i++)
{