]> git.ipfire.org Git - thirdparty/grub.git/commit
net/tcp: Only call grub_get_time_ms() when there are sockets to potentially retransmi...
authorGlenn Washburn <development@efficientek.com>
Fri, 18 Mar 2022 06:51:33 +0000 (01:51 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 4 Apr 2022 17:59:49 +0000 (19:59 +0200)
commitc2e5dc6916cbdd97d1c10f42fed2c4ba15c32736
treebaff135425500155844b32fb45691bb5f65853a4
parent848724273e4c3bac7ff88b21a8abd764ada57b9c
net/tcp: Only call grub_get_time_ms() when there are sockets to potentially retransmit for

If the machine has network cards found, but there are no tcp open sockets
(because the user doesn't use the network to boot), then grub_net_tcp_retransmit()
should be a noop. Thus GRUB doesn't need to call grub_get_time_ms(), which
does a call into firmware on powerpc-ieee1275, and probably other targets.
So only call grub_get_time_ms() if there are tcp sockets.

Aside from improving performance, its also useful to stay out of the firmware
as much as possible when debugging via QEMU because its a pain to get back
in to GRUB execution. grub_net_tcp_retransmit() can get called very frequently
via grub_net_poll_cards_idle() when GRUB is waiting for a keypress
(grub_getkey_noblock() calls grub_net_poll_cards_idle()). This can be annoying
when debugging an issue in GRUB on PowerPC in QEMU with GDB when GRUB is waiting
for a keypress because interrupting via GDB nearly always lands in the OpenBIOS
firmware's milliseconds call.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/net/tcp.c