Saturday, July 25, 2020

Receiving packets mismatch using Cisco's T-Rex and Intel X540-AT2

I'm generating linerate traffic at 64, 128, ...1024B packets with T-Rex on one interface on one server, which is connected via an Ethernet cable to another server which receives the traffic.

I'm having problems with calculating the received traffic.

The traffic is generated using the STL part of T-Rex - the config file is the following:

from trex_stl_lib.api import *

class STLS1(object):

def create_stream (self):

return STLStream(

packet =

STLPktBuilder(

pkt = Ether()/IP(src="192.168.1.1",dst="192.168.1.4")/UDP(dport=12,sport=1025)

),

mode = STLTXCont())

def get_streams (self, direction = 0, **kwargs):

# create 1 stream

return [ self.create_stream() ]

# dynamic load - used for trex console or simulator

def register():

return STLS1()

The 128B config is the same, except for this line:

pkt = Ether()/IP(src="192.168.1.1",dst="192.168.1.4")/UDP(dport=12,sport=1025)/(82*'x')

, which (hopefully?) creates a packet of 128B size (I was checking these in Wireshark, they were of correct size, i successfully created .pcaps of required size).

I have made the calculations on the receiving side by getting ethtool statistics every 0.1 seconds and then getting a sum every 10 time segments of 0.1 secs, so there's higher precision (so for 60 seconds of incoming traffic, 600 datapoints which are then summed to 60 datapoints to have packets per second information).

What I'm putting in the results file are the rx_packets and rx_no_dma_resources fields. Those when added together when ethtool is called ad-hoc (after testing) get me the exact number for rx_pkts_nic. I supposed:

rx_packets: processed packets by the kernel

rx_no_dma_resources: dropped packets by the kernel since it has no memory/cpu cycles to process them

rx_pkts_nic: total received packets on the interface

Now, what's my problem?

When I add rx_packets and rx_no_dma_resources fields from the results file, at 64B the result is 15360462 packets, which is 15.36 Mpps. Linerate with 64B packets is 14.88 Mpps. Same thing is happening with 128B as well, the result is 8678046 packets, where there should be 8.45 Mpps. 256B added value is 4659059, 4.53 Mpps is expected (AFAIK).

Am I adding something up incorrectly? Are the config files for T-Rex incorrect? Is it something else? Are the lines I'm grepping from ethtool not representing what I think they do?

If needed, I can provide the .pcaps on which I based the configs and the results files.



No comments:

Post a Comment