Skip to main content
Explorer II
February 21, 2024
Solved

STM32H573i-DK: Poor TCP TX Performance, iperf

  • February 21, 2024
  • 3 replies
  • 2982 views

Hey, 

i have ported the iperf2 example(https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/NUCLEO-H563ZI/Applications/NetXDuo/Nx_Iperf) of the H563 board to the H573i-DK Board.

It pretty much works as expected now, but the TX performance is a little bit poor. I expected >95Mbit/Sec for all tests. I got the following results (I ran each test about 10 times and took the average values). 

- TCP TX: 85.00 Mbits/sec
- TCP RX: 93.41 Mbits/sec
- UDP TX: 95.20 Mbits/sec
- UDP RX: 99 Mbits/sec

 

Executed Commands on the host system (Ubuntu22.04, iperf version 2.1.5 (3 December 2021) pthreads)

- TCP TX: `iperf -s`
- TCP RX: `iperf -c 192.168.1.101`
- UDP TX: `iperf -s -u`
- UDP RX: `iperf -c 192.168.1.101 -u -b 200M`

 

 

I'm currently trying to benchmark another setup with modified ethernet settings and got even poorer results for TCP TX.
Because of that  I'm wondering whats the bottleneck here. Is it the CPU?

I'd appreciate any hints or suggestions on how to find the bottleneck and improve this number.

 

Best, 

funkii

    This topic has been closed for replies.
    Best answer by Idr

    Hello @funkii 

     

    Thank you for providing the project.

    This is indeed a limitation in the current driver.

    Could you please try this workaround:

    In nx_stm32_eth_driver.c, change 

     if(HAL_ETH_Transmit_IT(&eth_handle, &TxPacketCfg))
     {
     return(NX_DRIVER_ERROR);
     }

    To

    while(HAL_ETH_Transmit_IT(&eth_handle, &TxPacketCfg))
    {
     if(HAL_ETH_GetError(&eth_handle) & HAL_ETH_ERROR_BUSY)
     {
    
     if(nx_driver_information.nx_driver_information_deferred_events &
     NX_DRIVER_DEFERRED_PACKET_TRANSMITTED)
     {
     HAL_ETH_ReleaseTxPacket(&eth_handle);
     }
     else
     {
     tx_thread_relinquish();
     }
     }
     else
     {
     return(NX_DRIVER_ERROR);
     }
    }

     Kind regards

    3 replies

    ST Employee
    February 22, 2024

    Hello @funkii ,

    can you provide the ported version of your firmware i'll try to investigate the issue with TCP TX .

    just need more clarification about the modified Ethernet settings you tried which had poorer results :

    "I'm currently trying to benchmark another setup with modified Ethernet settings and got even poorer results for TCP TX."

    BR

    funkiiAuthor
    Explorer II
    February 24, 2024

    Hi, 

    thanks for your reply.

    I created a git repo with a diff file containing the relevant changes. See https://github.com/funkii7/Iperf-STM32H573I-DK.

     


    @STea wrote:

    just need more clarification about the modified Ethernet settings you tried which had poorer results :


    I added a sort of network filter, but currently my issue is primarily the 'poor' result without it.

     

    I appreciate your help!

    Best,

    funkii

    IdrAnswer
    ST Employee
    February 27, 2024

    Hello @funkii 

     

    Thank you for providing the project.

    This is indeed a limitation in the current driver.

    Could you please try this workaround:

    In nx_stm32_eth_driver.c, change 

     if(HAL_ETH_Transmit_IT(&eth_handle, &TxPacketCfg))
     {
     return(NX_DRIVER_ERROR);
     }

    To

    while(HAL_ETH_Transmit_IT(&eth_handle, &TxPacketCfg))
    {
     if(HAL_ETH_GetError(&eth_handle) & HAL_ETH_ERROR_BUSY)
     {
    
     if(nx_driver_information.nx_driver_information_deferred_events &
     NX_DRIVER_DEFERRED_PACKET_TRANSMITTED)
     {
     HAL_ETH_ReleaseTxPacket(&eth_handle);
     }
     else
     {
     tx_thread_relinquish();
     }
     }
     else
     {
     return(NX_DRIVER_ERROR);
     }
    }

     Kind regards

    funkiiAuthor
    Explorer II
    March 1, 2024

    Hey,

    thank you for your reply!

    The fix works, the results are now as expected (I reran each test 10 times):

    - TCP TX: 94.9 Mbits/Ssec
    - TCP RX. 93.0 Mbits/Sec
    - UDP TX: 91.2 Mbits/Sec
    - UDP RX: 95.0 Mbits/Sec

     

    Best,

    funkii

    Graduate II
    February 27, 2024

    - TCP TX: 85.00 Mbits/sec
    - TCP RX: 93.41 Mbits/sec

    Not too bad for HAL, and considering that the H5 series is not as fast as H7.

    Have you enabled all hardware options concerning checksums (IP, TCP)?