Packet capture in ASTF mode -- TCP drops

125 views
Skip to first unread message

Ananya Gopal

unread,
Apr 4, 2023, 8:48:52 PM4/4/23
to TRex Traffic Generator
Hi Trex Dev team, 

[Host1] port0 <-------> et13 [Switch] {client}
[Host1] port1 -------> et18 [Switch] {server}

I want to capture packets using the BPF filter that Trex provides, and here is my client program:

def astf_test(server, mult, duration, profile_path):
    # create client
    c = ASTFClient(server = server)

    # connect to server
    c.connect()

    passed = True

    try:
        # take all the ports
        c.reset()

        # load ASTF profile
        profile_path = os.path.join(astf_path.get_profiles_path(), 'http_simple.py')

        c.load_profile(profile_path)

        # clear the stats before injecting
        c.clear_stats()

        c.set_service_mode(ports = [port_0],  enabled = True)
        #c.ping_ip(src_port = port_0, dst_ip = '11.11.11.2', pkt_size = 200, count = 5)

        # start a capture
        idd = c.start_capture(tx_ports = [port_0], limit = 100)
        #print(idd)

        print("Injecting with multiplier of '%s' for %s seconds" % (mult, duration))
        c.start(mult = mult, duration = duration)
       
        # block until done
       
        c.wait_on_traffic()
        c.stop_capture(capture_id = idd['id'], output = '/tmp/pings.pcap')
        c.set_service_mode(ports = port_0, enabled = False)
        # read the stats after the test
        stats = c.get_stats()

        # use this for debug info on all the stats
        pprint(stats)

However I see all the server not responding at all, only with TCP traffic. Please tell me what I might be doing wrong.. 
If I send pings with the service mode, it works fine, I'm able to see /tmp/pings.pcap with proper pings. 

This happens only with c.set_service_mode(ports = [port_0],  enabled = True) 

Ruling out Switch side drops
If service mode is disabled, I don't see any drops, even at the switch: 
switch #show  platform  counters | grep 13 | grep "Good IPV4 L3.*nicast"
Ethernet13  RX - Good IPV4 L3 Unicast                          84            
Ethernet13  TX - Good IPV4 L3 unicast packets                  350            
switch #show  platform  counters | grep 18 | grep "Good IPV4 L3.*nicast"
Ethernet18  RX - Good IPV4 L3 Unicast                          350            
Ethernet18  TX - Good IPV4 L3 unicast packets                  84    

But if I run this test with service mode, I see the server not responding:
switch #show  platform  counters | grep 13 | grep "Good IPV4 L3.*nicast"
Ethernet13  RX - Good IPV4 L3 Unicast                          70            
Ethernet13  TX - Good IPV4 L3 unicast packets                  0              
switch #show  platform  counters | grep 18 | grep "Good IPV4 L3.*nicast"
Ethernet18  RX - Good IPV4 L3 Unicast                          0              
Ethernet18  TX - Good IPV4 L3 unicast packets                  70    

Server is started using: ./t-rex-64 -i --astf
Client is started using: ./trex-console

Connecting to RPC server on localhost:4501                   [SUCCESS]


Connecting to publisher server on localhost:4500             [SUCCESS]

[SUCCESS]


Acquiring ports [0, 1]:                                      [SUCCESS]


Server Info:

Server version:   v3.02 @ ASTF
Server mode:      Advanced Stateful
Server CPU:       1 x Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
Ports count:      2 x 10Gbps @ 82599ES 10-Gigabit SFI/SFP+ Network Connection

Please help! In essence I want to write a script that can capture traffic. 

Thanks, 
Ananya

Jeongseok Moon

unread,
Apr 6, 2023, 7:17:59 PM4/6/23
to TRex Traffic Generator
In ASTF mode, you should not enable service mode for capturing packets.

BR,
Jeongseok

Ananya Gopal

unread,
Apr 8, 2023, 11:00:49 PM4/8/23
to TRex Traffic Generator
Hi Jeongseok, 

Thank you for pointing me to CFlowTable::check_service_filter.
I do not understand this comment from Hanoch: "this is confusing, in ASTF there is no need to move to service mode for normal capturing you can just capture to memory ring."

I'm very new to the linux kernel networking stack, and with dpdk in the mix, it is a little hard to debug, or get the packets from the ring buffer with some instrumentation at this point. 
Is there a way to output a pcap file or get the packets transmitted with each run in ASTF mode? (some earlier documentation shows -o and -pcap flags but they are not there anymore in the client console)

Note: I was able to implement port mirroring on the switch to get these flows, however the CPU overhead in that case for high speeds is very high. 

Any help would be appreciated!
Thanks, 
Ananya

Ananya Gopal

unread,
Apr 8, 2023, 11:08:49 PM4/8/23
to TRex Traffic Generator
For some more context: 

Using Trex, (STL/STF/ASTF), the requirement is simply to generate TCP flows (1-10Gbps) on a link, and get packet captures for the end-to-end flows. What is the best way forward? 

Thanks, 
Ananya

Jeongseok Moon

unread,
Apr 9, 2023, 12:33:06 AM4/9/23
to TRex Traffic Generator
Simply say, in ASTF mode, please remove "c.set_service_mode(ports = [port_0],  enabled = True)" line.
But in STL mode, you need to use the line to capture TX packets.
ASTF mode acts like the service mode in STL. It means the service mode in ASTF is different from the one in STL.
Since I'm not familiar with STF mode, I have no comment about it.

BR,
Jeongseok
Reply all
Reply to author
Forward
0 new messages