NAME = "Pktgen test"
AUTHOR = "Martin Bligh <mbligh@google.com>"
TIME = "MEDIUM"
TEST_CATEGORY = "FUNCTIONAL"
TEST_CLASS = "HARDWARE"
TEST_TYPE = "CLIENT"
DOC = """
pktgen is a high-performance testing tool included in the Linux kernel. Being
part of the kernel is currently best way to test the TX process of device driver
and NIC. pktgen can also be used to generate ordinary packets to test other
network devices. Especially of interest is the use of pktgen to test routers or
bridges which use the Linux network stack. Because pktgen is "in-kernel", it can
generate very high packet rates and with few systems saturate network devices as
routers or bridges.
"""

interface='eth0'
count=50000

# Parse comma-separated args.
for arg in args:
    for item in arg.split(','):
        key, val = item.split('=')
        if key == 'interface':
            interface = val
        if key == 'count':
            count = int(val)
        if key == 'num_iterations':
            num_iterations = int(val)

job.run_test('pktgen', eth=interface, count=count, clone_skb=0,
             tag='clone_skb_off', num_iterations=num_iterations)
job.run_test('pktgen', eth=interface, count=count, clone_skb=1,
             tag='clone_skb_on', num_iterations=num_iterations)