From patchwork Fri Mar 9 14:29:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Iziumtsev X-Patchwork-Id: 883696 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lVtgxzwI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zyWCZ5l99z9sc2 for ; Sat, 10 Mar 2018 02:15:22 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 48B86C21DD4; Fri, 9 Mar 2018 15:15:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 74874C21C3F; Fri, 9 Mar 2018 15:15:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5835BC21E15; Fri, 9 Mar 2018 14:29:52 +0000 (UTC) Received: from mail-qt0-f196.google.com (mail-qt0-f196.google.com [209.85.216.196]) by lists.denx.de (Postfix) with ESMTPS id 75CD8C21DFD for ; Fri, 9 Mar 2018 14:29:48 +0000 (UTC) Received: by mail-qt0-f196.google.com with SMTP id g60so10813180qtd.11 for ; Fri, 09 Mar 2018 06:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=UioaVABrKtsERdcJHrpajG25ZT7MFwkW1/Cf08Hyk5U=; b=lVtgxzwIJEG2i3jq+g503vHPusAJb4sYwURoeLeJEEOxg1zVh4YG3jqHvEwLDuPcuG vdxhL0Ne8wPee+WHNFC5It5vTXrXdWgFb42qRxx+aC6s4dJm7xow6v7VxOktvw7nBQg5 wYg6exOMGb1cYbpLNEe8XsMHXjgQa941whI4Vpc57f+dYJk8tStwh3E8MpEQHe6jDE5g Ux0KM7hwiqFdL13ZdFW9vJDyMmnTpCg2dQ5vVB29PHDFUs+ajX4KJSeNVrVKPMXyL2dX aARuKxGXiZM9sSpnUq1eFgLQHMsMWb1SIOTc2nldhzNG4K70KZJW7NmbBWJ5WLPHPLAz fhJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=UioaVABrKtsERdcJHrpajG25ZT7MFwkW1/Cf08Hyk5U=; b=Mwqf/p6di8c9rAacl5EPWnEX40PPacN8I8D5LBa0yfF+5zLbaYkViTsomyCWojm113 J/d/0rFsE70qwJDlz1rkJbbs0bh7fe9omxonLY5QxQzxMs+L564ApfAmM4RLBtckjWtS Btz+lBBMc3i+IhoudlkiD1yUgAomu0A7cRt8lqpJmGM4hrUK4bLjWcuxnUN1q8Vj9i6m BxbxE2qSpuJnbBaJSG8byZ1aTm5ADklA/ALtig6pHdrPwS0/1nD/pkfUKVRK/zHV5h6i 5TQ8CWp1dJ7Fzt5opCjnsrTsjntHe6fgbgn2O7DCOj2gC4MRZdsN01s5nmtG+EXfJpqV T8Mg== X-Gm-Message-State: AElRT7HhJm8CstaL/cIOWPIaTGw/TsZQK9eQIz86UheE/sU/2EIUo8aw jZKZMBg6b1A85ikD4o0yy2cx2dw1uFt6pB1pZ0YXqQ== X-Google-Smtp-Source: AG47ELuyW8BHGnIhg1WjcZ6arn99alBMvEOlLLSNK7VhO0QotRKoIag/GxKk6lkpvdeK/7tPiCL8TXJpPq4y3qkOw5Y= X-Received: by 10.200.7.134 with SMTP id l6mr43781997qth.219.1520605786962; Fri, 09 Mar 2018 06:29:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.41.135 with HTTP; Fri, 9 Mar 2018 06:29:06 -0800 (PST) From: Leonid Iziumtsev Date: Fri, 9 Mar 2018 15:29:06 +0100 Message-ID: To: u-boot@lists.denx.de X-Mailman-Approved-At: Fri, 09 Mar 2018 15:15:14 +0000 X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: Joe Hershberger Subject: [U-Boot] [PATCH] net: Fix netretry condition X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The "net_try_count" counter starts from "1". And the "retrycnt" contains requested amount of retries. With current logic, that means that the actual retry amount will be one time less then what we set in "netretry" env. For example setting "netretry" to "once" will make "retrycnt" equal "1", so no retries will be triggered at all. Fix the logic by changing the statement of "if" condition. Signed-off-by: Leonid Iziumtsev Acked-by: Joe Hershberger --- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index 4259c9e..8a9b69c 100644 --- a/net/net.c +++ b/net/net.c @@ -683,7 +683,7 @@ int net_start_again(void) retry_forever = 0; } - if ((!retry_forever) && (net_try_count >= retrycnt)) { + if ((!retry_forever) && (net_try_count > retrycnt)) { eth_halt(); net_set_state(NETLOOP_FAIL); /*