Strange behavior on Apalis iMX8QM on-board Wifi communication

Hi Support Team,

We are testing apalis imx8qm on-board wifi module with latest ycoto linux reference multimedia image v5.1.0, there is some strange behavior on ping delay on imx8 receive way communication, please find details test process and log as below, kindly please check if there is any clue or solution on this?

  1. connect dual antenna to apalis imx8 on-board wifi module.

  2. set up wifi connection according to here.

  3. interface mlan0 is successfully connected to AP and assigned ip address.

    root@apalis-imx8:~# ifconfig mlan0
    mlan0 Link encap:Ethernet HWaddr C0:E4:34:2F:C4:A1
    inet addr:10.20.1.134 Bcast:10.20.1.255 Mask:255.255.255.0
    inet6 addr: fe80::c2e4:34ff:fe2f:c4a1/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:251052 errors:0 dropped:103 overruns:0 frame:0
    TX packets:119956 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:378139502 (360.6 MiB) TX bytes:11199741 (10.6 MiB)

  4. start ping to my PC which conected to same LAN network with apalis imx8 wifi connection, all work well, the ping latency is less than 10ms consistently.

    root@apalis-imx8:~# ping 10.20.1.150
    PING 10.20.1.150 (10.20.1.150): 56 data bytes
    64 bytes from 10.20.1.150: seq=0 ttl=64 time=4.667 ms
    64 bytes from 10.20.1.150: seq=1 ttl=64 time=4.309 ms
    64 bytes from 10.20.1.150: seq=2 ttl=64 time=4.460 ms
    64 bytes from 10.20.1.150: seq=3 ttl=64 time=4.298 ms
    64 bytes from 10.20.1.150: seq=4 ttl=64 time=4.293 ms
    64 bytes from 10.20.1.150: seq=5 ttl=64 time=4.516 ms
    64 bytes from 10.20.1.150: seq=6 ttl=64 time=4.445 ms
    64 bytes from 10.20.1.150: seq=7 ttl=64 time=4.422 ms
    64 bytes from 10.20.1.150: seq=8 ttl=64 time=4.326 ms

  5. but when testing ping from my PC to apalis imx8, the ping latency becomes high and unstable with range from several tens ms to more than 1000ms.

    simon@simon-Latitude-5300:~$ ping 10.20.1.134
    PING 10.20.1.134 (10.20.1.134) 56(84) bytes of data.
    64 bytes from 10.20.1.134: icmp_seq=1 ttl=64 time=104 ms
    64 bytes from 10.20.1.134: icmp_seq=2 ttl=64 time=329 ms
    64 bytes from 10.20.1.134: icmp_seq=3 ttl=64 time=556 ms
    64 bytes from 10.20.1.134: icmp_seq=4 ttl=64 time=784 ms
    64 bytes from 10.20.1.134: icmp_seq=5 ttl=64 time=1012 ms
    64 bytes from 10.20.1.134: icmp_seq=6 ttl=64 time=3.39 ms
    64 bytes from 10.20.1.134: icmp_seq=7 ttl=64 time=230 ms
    64 bytes from 10.20.1.134: icmp_seq=8 ttl=64 time=460 ms
    64 bytes from 10.20.1.134: icmp_seq=9 ttl=64 time=685 ms
    64 bytes from 10.20.1.134: icmp_seq=10 ttl=64 time=914 ms

  6. strange thing is when testing the ping action with an iperf3 tcp bandwidth testing between my PC and apalis imx8 running simultaneously, the ping latency result become low and stable with several tens ms, the test process and comparison log is as below

    ./ first start iperf3 server on apalis imx8
    root@apalis-imx8:~# iperf3 -s
    ./ then start ping from my pc to imx8

    simon@simon-Latitude-5300:~$ ping 10.20.1.134
    ./ then start iperf3 client testing on my pc

    $ iperf3 -c 10.20.1.134 -t 20
    ./ waiting for iperf3 testing done and stop ping command

whloe ping permance log is as below. BTW, has also tried setting imx8 cpu governor to performance mode to make all cpu cores work under max frequency, but the test result is same, no difference.

Finally found that due to power save for wifi module is enable by default, disable it with below iw command fix above issue.

    root@apalis-imx8:~# iw mlan0 get power_save
    Power save: on
    root@apalis-imx8:~# iw mlan0 set power_save off
    root@apalis-imx8:~# iw mlan0 get power_save
    Power save: off

Thanks