Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nRhGQ-0006MD-DB for mharc-grub-devel@gnu.org; Tue, 08 Mar 2022 16:21:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRhGO-0006FL-If for grub-devel@gnu.org; Tue, 08 Mar 2022 16:21:00 -0500 Received: from [2607:f8b0:4864:20::82e] (port=41668 helo=mail-qt1-x82e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRhGN-0006fm-0G for grub-devel@gnu.org; Tue, 08 Mar 2022 16:21:00 -0500 Received: by mail-qt1-x82e.google.com with SMTP id o22so270153qta.8 for ; Tue, 08 Mar 2022 13:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qs5uqaPFTEnssW75DgDTWIHkJ7xdQjRsHP4m3F5A9YQ=; b=esA74zT+6VQu8DuUZc9Nj08sD6iW4xEV3hzTOvyGxZ+hoNST/21r780iT+6f0zn/eV Xr4Ur2azLwwVQCr6+NhH0NE+ZwcEMAceGO6nD39PbkL2kXSWWckq/5vVdTlZi2kFWSwr NyrA8sLRhJ7sK04T7MHN+aJVWfdXEyA2h+CFDzU/UoP2gbWG8OfVgJp7C22zi9BiOb97 rBQnFIsouVbAjqwDaT3DpHEf4sQIA4EEfeONu8Zad/SwZj0W7WcXzZbaA7oYHhGJEtpD /WbphLavDWBYREz5dGsV/qCM9S8BPdVAu9y7eylhu4PRAd1hu7hgyFtvlVs5kTOGZ7v9 NWyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qs5uqaPFTEnssW75DgDTWIHkJ7xdQjRsHP4m3F5A9YQ=; b=QQS0Me3hmkbo7iZbC3p+663ERYrDHwTcdyXrDX8WG2PZVQrzC/mboxBFgWSq5LEe7w LDh+VNnKuVTEDCBwpNXCpy+6lkz5N6U51+SYSmcs7KArpkMo7ijg+e4o6Jc6umMo1LT8 MXvV6crhQ0WpPpRvJfuwChnLwARCxf8D185ExOcfNBTqVcqk1QbQwVaS7foEXhC3+Hhq qr5s3tgnnt4rH418hR2J5hKCHFVN6sPmh5pcqYWL3u85kmk6hjWZMeR1KX2Dw5r99rex L39qKHtLegTZRxPw6wtUHC/XomQjL8Rx782TRHI1wQdsxDULKT4l8A7UklptIPqgaYWo XjFg== X-Gm-Message-State: AOAM532rbT82aArUGVaetx7U+HQW4tUgGXAXPK4ghRkDshCrYJiIR01p RswW5AAFdETwxV56Ax8osFKizA== X-Google-Smtp-Source: ABdhPJyuFCgm5epNVPxdge3K2LlcqVZG/FY0Z1QIQiveVWUtUWTRpszX6pE64Q1zwD4jQkUBbv2q9A== X-Received: by 2002:ac8:5d49:0:b0:2e0:74df:5576 with SMTP id g9-20020ac85d49000000b002e074df5576mr3268631qtx.418.1646774458040; Tue, 08 Mar 2022 13:20:58 -0800 (PST) Received: from localhost.localdomain (garza.riseup.net. [198.252.153.109]) by smtp.gmail.com with ESMTPSA id w17-20020ac857d1000000b002e19feda592sm38088qta.85.2022.03.08.13.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 13:20:57 -0800 (PST) From: Glenn Washburn To: Daniel Kiper , grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH 3/3] net/tcp: Only call grub_get_time_ms when there are sockets to potentially retransmit for Date: Tue, 8 Mar 2022 15:20:20 -0600 Message-Id: <7bef6e122fd4800a538414abd7537fe24c0b8aa4.1646679955.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::82e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::82e; envelope-from=development@efficientek.com; helo=mail-qt1-x82e.google.com X-Spam_score_int: -4 X-Spam_score: -0.5 X-Spam_bar: / X-Spam_report: (-0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2022 21:21:00 -0000 If there are no TCP sockets, this call to grub_get_time_ms is unneeded. This prevents a call into the firmware on some platforms. Signed-off-by: Glenn Washburn --- grub-core/net/tcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c index e8ad34b84d..75461eb54e 100644 --- a/grub-core/net/tcp.c +++ b/grub-core/net/tcp.c @@ -362,8 +362,13 @@ void grub_net_tcp_retransmit (void) { grub_net_tcp_socket_t sock; - grub_uint64_t ctime = grub_get_time_ms (); - grub_uint64_t limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT; + grub_uint64_t ctime = 0, limit_time = 0; + + if (tcp_sockets) + { + ctime = grub_get_time_ms (); + limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT; + } FOR_TCP_SOCKETS (sock) { -- 2.27.0