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) 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" QString("The portgroup %1:%2 does not contain any ports!\n\n"
"Packet Transmit/Capture requires elevated privileges. " "Packet Transmit/Capture requires elevated privileges. "
"Please ensure that you are running 'drone' - the server " "Please ensure that you are running 'drone' - the server "

View File

@ -257,8 +257,9 @@ void StreamConfigDialog::setupUiExtra()
** Setup Validators ** Setup Validators
*/ */
// Meta Data // 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 ** Setup Connections

View File

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

View File

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

View File

@ -453,6 +453,7 @@ int StreamBase::frameValue(uchar *buf, int bufMaxSize, int frameIndex) const
bool StreamBase::preflightCheck(QString &result) const bool StreamBase::preflightCheck(QString &result) const
{ {
bool pass = true;
int count = isFrameSizeVariable() ? frameCount() : 1; int count = isFrameSizeVariable() ? frameCount() : 1;
for (int i = 0; i < count; i++) 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 - " result += QString("One or more frames may be truncated - "
"frame length should be at least %1.\n") "frame length should be at least %1.\n")
.arg(frameProtocolLength(i) + kFcsSize); .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 pass;
return false;
} }
bool StreamBase::StreamLessThan(StreamBase* stream1, StreamBase* stream2) bool StreamBase::StreamLessThan(StreamBase* stream1, StreamBase* stream2)

View File

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

View File

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

View File

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