MoonGen
 All Files Functions Variables Pages
device.lua File Reference

Device ... More...

Go to the source code of this file.

Functions

function mod config (...)
 Configure a device. More...
 
function mod waitForLinks (...)
 Waits until all given devices are initialized by calling wait() on them.
 
function dev wait (maxWait)
 Wait until the device is fully initialized and up to maxWait seconds to establish a link.
 
function dev getRxStats ()
 get the number of packets received since the last call to this function
 
function dev getRxStatsAll ()
 TODO: figure out how to actually acquire statistics in a meaningful way for dropped packets :/.
 
function txQueue setRate (rate)
 Set the tx rate of a queue in MBit/s. More...
 
function mod reclaimTxBuffers ()
 Restarts all tx queues that were actively used by this task. More...
 
function rxQueue recv (bufArray)
 Receive packets from a rx queue. More...
 
function rxQueue tryRecv (bufArray, maxWait)
 Receive packets from a rx queue with a timeout.
 
function rxQueue tryRecvIdle (bufArray, maxWait)
 Receive packets from a rx queue with a timeout. More...
 

Detailed Description

Device ...

Todo:
TODO docu

Definition in file device.lua.

Function Documentation

function mod config (   ...)

Configure a device.

Parameters
argsA table containing the following named arguments port Port to configure mempool optional (default = create a new mempool) Mempool to associate to the device rxQueues optional (default = 1) Number of RX queues to configure txQueues optional (default = 1) Number of TX queues to configure rxDescs optional (default = 512) txDescs optional (default = 256) speed optional (default = 0) dropEnable optional (default = true) rssNQueues optional (default = 0) If this is >0 RSS will be activated for this device. Incomming packates will be distributed to the rxQueues number 0 to (rssNQueues - 1). For a fair distribution use one of the following values (1, 2, 4, 8, 16). Values greater than 16 are not allowed. rssFunctions optional (default = all supported functions) A Table, containing hashing methods, which can be used for RSS. Possible methods are: dev.RSS_FUNCTION_IPV4 dev.RSS_FUNCTION_IPV4_TCP dev.RSS_FUNCTION_IPV4_UDP dev.RSS_FUNCTION_IPV6 dev.RSS_FUNCTION_IPV6_TCP dev.RSS_FUNCTION_IPV6_UDP
Todo:
FIXME: add description for speed and dropEnable parameters.
Examples:
l2-poisson-load-latency.lua, l3-tcp-syn-flood.lua, quality-of-service-test.lua, and timestamps.lua.
function mod reclaimTxBuffers ( )

Restarts all tx queues that were actively used by this task.

'Actively used' means that either :send() or :sendWithDelay() was called from the current task.

function rxQueue recv ( bufArray  )

Receive packets from a rx queue.

Returns as soon as at least one packet is available.

Examples:
quality-of-service-test.lua.
function txQueue setRate ( rate  )

Set the tx rate of a queue in MBit/s.

This sets the payload rate, not to the actual wire rate, i.e. preamble, SFD, and IFG are ignored. The X540 and 82599 chips seem to have a hardware bug (?): they seem use the wire rate in some point of the throttling process. This causes erratic behavior for rates >= 64/84 * WireRate when using small packets. The function is non-linear (not even monotonic) for such rates. The function prints a warning if such a rate is configured. A simple work-around for this is using two queues with 50% of the desired rate. Note that this changes the inter-arrival times as the rate control of both queues is independent.

Examples:
l2-poisson-load-latency.lua, l3-tcp-syn-flood.lua, and quality-of-service-test.lua.
function rxQueue tryRecvIdle ( bufArray  ,
maxWait   
)

Receive packets from a rx queue with a timeout.

Does not perform a busy wait, this is not suitable for high-throughput applications.