From patchwork Thu Aug 3 14:56:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryosuke Saito X-Patchwork-Id: 709594 Delivered-To: patch@linaro.org Received: by 2002:ab3:5b92:0:b0:238:c968:2573 with SMTP id j18csp1675529ltf; Thu, 3 Aug 2023 07:57:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlGG92svxyyItCxuQ5CRP4drpG1M4aivSc+POn7SMGcOAcfJEMpFl2xsI0aKvbKwOe4nZ3o1 X-Received: by 2002:a05:600c:3b0f:b0:3fe:18e0:2fc6 with SMTP id m15-20020a05600c3b0f00b003fe18e02fc6mr7641043wms.3.1691074648308; Thu, 03 Aug 2023 07:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691074648; cv=none; d=google.com; s=arc-20160816; b=Y/zbFDx5uo5E6u/jzeyZBHRNnU/th+vLUNzgAbuISVwbJ4o2HnOInt/siHxjha5XeJ I9NS4qG2Iyp01uGnpfAZdJZkPcqJtcMU+GhD8Hwo0nMovlFrCh/ZBj1UiQVIvXWLrH0p mrj8nSVIqwS8O0yH+nwgiuXWDIPGlv/zn0oFepbfJvj2tbQ7aEdqG3eCos7ivnRQHdeX Bp4yk+ABdeiBdQ1ns3jw6YPxuub7gENlsYQljvJUGl0oYnjbCMdcVHiNGTyQwGOGwYjw mEJgNbdeEc9RtbYio0R2tMvfI9A4kz9nbiLHljPAiWaEhwBQMD55FqS60Yvmrz4HPxVa nrcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=oEkPf2tB4SH1wmHB4mdIRbT/uG5E2TYWyalokZneP5I=; fh=H7kAERvUgUiO5yUYops8YZmxxhUUandgrV94Y9pWQfQ=; b=AaeKfSKFRJmhBzzL+RLzsrLaaVVDymGbdWkKkKlTwiRihprOjRW+3fQTcvnfKF9qeH c6f//w5UZwM3kuntbGw7fztZfSNziANyRkqLOHQI4K4qbVbeeSC7K/ltgVwH0Rlu5/ti E8I/+3T4YCQJdcSsnPjwdc3baHg6m5NEGDO63B63/gu4e2a12AAvdSdImUML0jp5YqaO 8qLANGzuWMs0f9fjWg6ENW+EcgWxY/jLMza0X488rZnoCgIlKI5j+jKwVuS2V6ULm8tD S9s+9EiiGVoVtvSTUaGTMv7giF5OmHnuypRgXq9ZIl9DnIbLysXRaNItbUuZDUPqcGo5 YdjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rSrmkxRr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f14-20020a7bc8ce000000b003fa8fb2e235si61649wml.75.2023.08.03.07.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 07:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rSrmkxRr; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23FD5867EA; Thu, 3 Aug 2023 16:57:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="rSrmkxRr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E92C8686A; Thu, 3 Aug 2023 16:56:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AFBE9867BC for ; Thu, 3 Aug 2023 16:56:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ryosuke.saito@linaro.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1b7dfb95761so1772235ad.1 for ; Thu, 03 Aug 2023 07:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691074613; x=1691679413; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oEkPf2tB4SH1wmHB4mdIRbT/uG5E2TYWyalokZneP5I=; b=rSrmkxRrzXwdxwOxjeYMJGqRZ6NK1JJOWF8oX0URpftBduw8Jnxf5pPCR1lPGz3bEF PUNjxIarsADqlSemdsz71vMRUzqJqEJV3tMsTAJFRa8jvVgPKIfkFeZxFrFNQlNCmF8D BFO/HH1ymSRwQDNLDm+Iu6VGdNrrEUtG1c+VHswyjRWAn+xskbB65fCjHQkrL1llZHx/ JgaxsYRKqMs0FfwZEh0dsvoDuUBGBYoiWLjzYWnOQ1pzzwxgNnsfPE+EiSqXpWbWHRpu BE+Ls6h/Yn3OnMwaokhf2IOREqOnERZnwX/J7cpuwBwgIiIsXNnnUm+rPJlCOesT/1oA dhaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691074613; x=1691679413; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oEkPf2tB4SH1wmHB4mdIRbT/uG5E2TYWyalokZneP5I=; b=ANHT+W0OzCFPhGbuKbt/d+xWrZtbo0G3bbH1FaQd9VayzPvIFgEPei+8YUXRZCz8dj 4RI18PrO6krzpfY4h8YHYhxGlC6knlDbmP6RmtbkqvFtLxiQKOBhNQnAVD1N072AzXLt 99OhBWFxOS0gf8cSO2iQpzD87W0UHBEJwYBwcqLMrV+o6KHvrQ7g8pDs771zW0P/qYPY A/AltX5KFxCVP2uUREcs0XvTUn8YL8tCugHEXtiiQOQDK8gFB1Jqzku3E32PffYSTmRx vGhnDK9SOK7wSQIHEJbXbC8jq22Jm70E3lvi4zGqgeS9WY22ziZnqK26MjA9uG53do7v +K2Q== X-Gm-Message-State: ABy/qLbRQ3Bz4+jp43rytXuoFPTycKyFm3W2UfPGjUGQYem8w27A4LDh Ek8wJH1TsvnwbQ2XRyrRAoToOw== X-Received: by 2002:a17:903:1c7:b0:1b8:b55d:4cff with SMTP id e7-20020a17090301c700b001b8b55d4cffmr20413314plh.2.1691074612922; Thu, 03 Aug 2023 07:56:52 -0700 (PDT) Received: from fedora.. ([240d:1a:3a7:a400:9a57:aa11:487a:b54f]) by smtp.gmail.com with ESMTPSA id m1-20020a170902db0100b001b869410ed2sm14476842plx.72.2023.08.03.07.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 07:56:52 -0700 (PDT) From: Ryosuke Saito To: jaswinder.singh@linaro.org, joe.hershberger@ni.com, rfried.dev@gmail.com Cc: masahisa.kojima@linaro.org, u-boot@lists.denx.de Subject: [PATCH 0/1] Workaround for timeout error in NETSEC driver Date: Thu, 3 Aug 2023 23:56:47 +0900 Message-ID: <20230803145648.1023981-1-ryosuke.saito@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 03 Aug 2023 16:57:26 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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(-)