]> git.pld-linux.org Git - packages/grub2.git/blame - efi-net-fix.patch
- more platforms (arm/aarch64, arc for mipsel)
[packages/grub2.git] / efi-net-fix.patch
CommitLineData
c287192d
JK
1From 886d93184b894a29b0bef1f2467230a20c7a33ce Mon Sep 17 00:00:00 2001
2From: Mark Salter <msalter@redhat.com>
3Date: Tue, 8 Apr 2014 10:58:11 -0400
4Subject: [PATCH] reopen SNP protocol for exclusive use by grub
5
6While working with pxeboot of grub on an ARM platform, I noticed
7very poor network performance while grub was loading a kernel
8and initramfs. The performance during the loading of grub itself
9seemed reasonable. Digging into the issue, I found that the UEFI
10firmware was periodically polling for network packets while grub
11was downloading files. This was causing timeouts and retries in
12the grub network stack.
13
14The solution I found was to reopen the SNP protocol for exclusive
15use. This forces UEFI to shutdown its use of SNP so that grub is
16not competing for incoming packets.
17
18Signed-off-by: Mark Salter <msalter@redhat.com>
19---
20 grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
21 1 file changed, 16 insertions(+)
22
23diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
24index 2b344d6..a6e4c79 100644
25--- a/grub-core/net/drivers/efi/efinet.c
26+++ b/grub-core/net/drivers/efi/efinet.c
27@@ -223,6 +223,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
28 {
29 struct grub_net_card *card;
30 grub_efi_device_path_t *dp;
31+ grub_efi_simple_network_t *net;
32
33 dp = grub_efi_get_device_path (hnd);
34 if (! dp)
35@@ -250,6 +251,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
36 &pxe_mode->dhcp_ack,
37 sizeof (pxe_mode->dhcp_ack),
38 1, device, path);
39+ net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
40+ GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
41+ if (net) {
42+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
43+ && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
44+ continue;
45+
46+ if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
47+ continue;
48+
49+ if (net->mode->state == GRUB_EFI_NETWORK_STARTED
50+ && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
51+ continue;
52+ card->efi_net = net;
53+ }
54 return;
55 }
56 }
57--
581.8.5.3
59
This page took 0.077624 seconds and 4 git commands to generate.