
This patch adds the workaround for the timeout error in the NETSEC driver when sending packets.
The NETSEC driver occasionally shows a "netsec_wait_while_busy" error and fails to send packets like the below:
==================== U-Boot 2023.01 (Jan 09 2023 - 16:07:33 +0000)
CPU: SC2A11:Cortex-A53 MPCore 24cores Model: Socionext Developer Box DRAM: 1.9 GiB (effective 63.9 GiB) optee optee: OP-TEE: revision 3.20 (8e74d476) I/TC: Reserved shared memory is enabled I/TC: Dynamic shared memory is enabled I/TC: Normal World virtualization support is disabled I/TC: Asynchronous notifications are disabled Core: 24 devices, 19 uclasses, devicetree: separate MMC: sdhci@52300000: 0 Loading Environment from nowhere... OK PCI: Failed autoconfig bar 14 In: uart@2a400000 Out: uart@2a400000 Err: uart@2a400000 Net: SF: Detected mx25u51245g with page size 256 Bytes, erase size 4 KiB, total 64 MiB eth0: ethernet@522d0000 starting USB... Bus xhci_pci: Register 8000820 NbrPorts 8 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found scanning bus for devices... SATA link 0 timeout. SATA link 1 timeout. AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl SATA mode flags: 64bit ncq stag led clo pmp pio slum part ccc sxs Hit any key to stop autoboot: 2 0 => setenv serverip 192.168.1.109 => dhcp BOOTP broadcast 1 BOOTP broadcast 2 BOOTP broadcast 3 BOOTP broadcast 4 *** Unhandled DHCP Option in OFFER/ACK: 125 *** Unhandled DHCP Option in OFFER/ACK: 125 DHCP client bound to address 192.168.1.111 (2131 ms) *** Warning: no boot file name; using 'C0A8016F.img' Using ethernet@522d0000 device TFTP from server 192.168.1.109; our IP address is 192.168.1.111 Filename 'C0A8016F.img'. Load address: 0x80000000 Loading: * TFTP error: 'File not found' (1) Not retrying... => ping 192.168.1.1 Using ethernet@522d0000 device host 192.168.1.1 is alive => ping 192.168.1.1 ethernet@522d0000 Waiting for PHY auto negotiation to complete... done Using ethernet@522d0000 device host 192.168.1.1 is alive => ping 192.168.1.1
(...skipping...)
=> ping 192.168.1.1 ethernet@522d0000 Waiting for PHY auto negotiation to complete... done netsec_wait_while_busy: timeout Using ethernet@522d0000 device
ARP Retry count exceeded; starting again ping failed; host 192.168.1.1 is not alive ====================
This could be occurred by, e.g., tftp and dhcp as well.
After investigation, it turns out it's waiting for MAC_REG_DESC_SOFT_RST to be cleared to 0 after writing 1. The NETSEC firmware normally clears it, but sometimes it seems to enter a weird state where it's never been cleared until the next NETSEC software reset. The reproducibility seems to vary on the environment (for example, 100 ping tries would cause the issue in my environment.); however, we faced the issue on at least three different boards in three different networking environments.
We have already reported the issue to Socionext, the supplier of NETSEC firmware, but it will take longer to find the root cause and fix the issue. Meanwhile, we can add a workaround for the problematic state by software resetting NETSEC.
Ryosuke Saito (1): net: sni_netsec: Add workaround for timeout error
drivers/net/sni_netsec.c | 50 ++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 9 deletions(-)