Drop two efinet patches that were causing issues and a bunch of other fixes

Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
Javier Martinez Canillas 2018-12-01 03:12:09 +01:00
parent f92a00c4b3
commit 1f092caba7
No known key found for this signature in database
GPG Key ID: C751E590D63F3D69
208 changed files with 559 additions and 532 deletions

View File

@ -8,10 +8,10 @@ Subject: [PATCH] efinet: add filter for the first exclusive reopen of SNP
1 file changed, 39 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index a3ce4c67cce..b870d3f1938 100644
index 5388f952ba9..d15a799f29a 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -465,6 +465,45 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -383,6 +383,45 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);

View File

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Josef Bacik <jbacik@fb.com>
Date: Mon, 31 Aug 2015 13:34:35 -0400
Subject: [PATCH] efinet: retransmit if our device is busy
When I fixed the txbuf handling I ripped out the retransmission code since it
was flooding our network when we had the buggy behavior. Turns out this was too
heavy handed as we can still have transient tx timeouts. So instead make sure
we retry our transmission once per timeout. This way we can deal with transient
transmission problems without flooding the box. This fixes an issue we were
seeing in production. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
grub-core/net/drivers/efi/efinet.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 5388f952ba9..3f112438a93 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -38,6 +38,7 @@ send_card_buffer (struct grub_net_card *dev,
grub_efi_simple_network_t *net = dev->efi_net;
grub_uint64_t limit_time = grub_get_time_ms () + 4000;
void *txbuf;
+ int retry = 0;
if (dev->txbusy)
while (1)
@@ -60,6 +61,15 @@ send_card_buffer (struct grub_net_card *dev,
dev->txbusy = 0;
break;
}
+ if (!retry)
+ {
+ st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
+ dev->txbuf, NULL, NULL, NULL);
+ if (st != GRUB_EFI_SUCCESS)
+ return grub_error (GRUB_ERR_IO,
+ N_("couldn't send network packet"));
+ retry = 1;
+ }
if (limit_time < grub_get_time_ms ())
return grub_error (GRUB_ERR_TIMEOUT,
N_("couldn't send network packet"));

View File

@ -1,221 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 11 Sep 2015 17:30:49 -0400
Subject: [PATCH] Be more aggro about actually using the *configured* network
device.
Right now we use any SNP device with the same mac+IP block, but when
it's discovered there will be more than one of them. We need to pick
the same one we were loaded with, so that it'll be configured the same
way as it was before, and won't be re-used by the system firmware later.
Resolves: rhbz#1257475
Signed-off-by: Peter Jones <example@example.com>
---
grub-core/net/drivers/efi/efinet.c | 124 +++++++++++++++++++++++++++++--------
include/grub/efi/api.h | 4 ++
2 files changed, 102 insertions(+), 26 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 3f112438a93..a3ce4c67cce 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -239,46 +239,85 @@ grub_efinet_get_device_handle (struct grub_net_card *card)
return card->efi_handle;
}
-static void
-grub_efinet_findcards (void)
+static int
+grub_efinet_find_snp_cards (int preferred_only, grub_efi_handle_t preferred,
+ int *i)
{
- grub_efi_uintn_t num_handles;
- grub_efi_handle_t *handles;
+ grub_efi_uintn_t num_handles = 0;
+ grub_efi_handle_t *handles = NULL;
grub_efi_handle_t *handle;
- int i = 0;
+ grub_efi_device_path_t *pdp = NULL, *pp = NULL, *pc = NULL;
+ int ret = 0;
- /* Find handles which support the disk io interface. */
+ if (preferred)
+ {
+ grub_efi_device_path_t *pdpc;
+ pdpc = pdp = grub_efi_get_device_path (preferred);
+ if (pdp == NULL)
+ {
+ grub_print_error ();
+ return -1;
+ }
+
+ for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (pdpc);
+ pdpc = GRUB_EFI_NEXT_DEVICE_PATH (pdpc))
+ {
+ pp = pc;
+ pc = pdpc;
+ }
+ }
+
+ /* Find handles which support the SNP interface. */
handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &net_io_guid,
0, &num_handles);
- if (! handles)
- return;
- for (handle = handles; num_handles--; handle++)
+
+ for (handle = handles; handle && num_handles--; handle++)
{
grub_efi_simple_network_t *net;
struct grub_net_card *card;
grub_efi_device_path_t *dp, *parent = NULL, *child = NULL;
- /* EDK2 UEFI PXE driver creates IPv4 and IPv6 messaging devices as
- children of main MAC messaging device. We only need one device with
- bound SNP per physical card, otherwise they compete with each other
- when polling for incoming packets.
- */
+ /* if we're looking for only the preferred handle, skip anything that
+ isn't it. */
+ if (preferred_only && preferred != NULL && *handle != preferred)
+ continue;
+
+ /* if we're not looking for the preferred handle, skip it if it's
+ found. */
+ if (!preferred_only && *handle == preferred)
+ continue;
+
dp = grub_efi_get_device_path (*handle);
if (!dp)
continue;
- for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp); dp = GRUB_EFI_NEXT_DEVICE_PATH (dp))
+
+ for (; ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp);
+ dp = GRUB_EFI_NEXT_DEVICE_PATH (dp))
{
parent = child;
child = dp;
}
- if (child
- && GRUB_EFI_DEVICE_PATH_TYPE (child) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
- || GRUB_EFI_DEVICE_PATH_SUBTYPE (child) == GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE)
- && parent
- && GRUB_EFI_DEVICE_PATH_TYPE (parent) == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
- && GRUB_EFI_DEVICE_PATH_SUBTYPE (parent) == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)
- continue;
+
+ if (!preferred_only)
+ {
+ if (pp && pc
+ && grub_efi_compare_device_paths (pp, parent) == 0
+ && grub_efi_compare_device_paths (pc, child) == 0)
+ continue;
+
+ if (child
+ && (GRUB_EFI_DEVICE_PATH_IS_TYPE(child,
+ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE,
+ GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE) ||
+ GRUB_EFI_DEVICE_PATH_IS_TYPE(child,
+ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE,
+ GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE))
+ && parent
+ && (GRUB_EFI_DEVICE_PATH_IS_TYPE(parent,
+ GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE,
+ GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)))
+ continue;
+ }
net = grub_efi_open_protocol (*handle, &net_io_guid,
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
@@ -302,7 +341,7 @@ grub_efinet_findcards (void)
{
grub_print_error ();
grub_free (handles);
- return;
+ return -1;
}
card->mtu = net->mode->max_packet_size;
@@ -313,13 +352,14 @@ grub_efinet_findcards (void)
grub_print_error ();
grub_free (handles);
grub_free (card);
- return;
+ return -1;
}
card->txbusy = 0;
card->rcvbufsize = ALIGN_UP (card->mtu, 64) + 256;
- card->name = grub_xasprintf ("efinet%d", i++);
+ card->name = grub_xasprintf ("efinet%d", *i);
+ *i = (*i)+1;
card->driver = &efidriver;
card->flags = 0;
card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
@@ -330,8 +370,38 @@ grub_efinet_findcards (void)
card->efi_handle = *handle;
grub_net_card_register (card);
+ ret++;
}
grub_free (handles);
+
+ return ret;
+}
+
+static void
+grub_efinet_findcards (void)
+{
+ grub_efi_loaded_image_t *image = NULL;
+ int rc;
+ int efinet_number = 0;
+
+ image = grub_efi_get_loaded_image (grub_efi_image_handle);
+
+ if (image && image->device_handle)
+ {
+ rc = grub_efinet_find_snp_cards (1, image->device_handle, &efinet_number);
+ if (rc < 0)
+ return;
+
+ rc = grub_efinet_find_snp_cards (0, image->device_handle, &efinet_number);
+ if (rc < 0)
+ return;
+ }
+ else
+ {
+ rc = grub_efinet_find_snp_cards (0, NULL, &efinet_number);
+ if (rc < 0)
+ return;
+ }
}
static void
@@ -352,6 +422,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
struct grub_efi_pxe_mode *pxe_mode;
if (card->driver != &efidriver)
continue;
+ if (hnd != card->efi_handle)
+ continue;
cdp = grub_efi_get_device_path (card->efi_handle);
if (! cdp)
continue;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index c7c9f0e1db1..97b9aa7a4d7 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -622,6 +622,10 @@ typedef struct grub_efi_device_path grub_efi_device_path_t;
It seems to be identical to EFI_DEVICE_PATH. */
typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
+#define GRUB_EFI_DEVICE_PATH_IS_TYPE(dp, type, subtype) \
+ ((GRUB_EFI_DEVICE_PATH_TYPE(dp) == (type)) && \
+ (GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) == (subtype)))
+
#define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f)
#define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype)
#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length)

View File

@ -14,10 +14,10 @@ This reverts commit 147daeab22db793978f952b6f0d832919a1b0081.
1 file changed, 39 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index b870d3f1938..a3ce4c67cce 100644
index d15a799f29a..5388f952ba9 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -465,45 +465,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -383,45 +383,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
&pxe_mode->dhcp_ack,
sizeof (pxe_mode->dhcp_ack),
1, device, path);

View File

@ -6,12 +6,12 @@ Subject: [PATCH] efinet and bootp: add support for dhcpv6
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/net/bootp.c | 174 +++++++++++++++++++++++++++++++++++++
grub-core/net/drivers/efi/efinet.c | 55 ++++++++++--
grub-core/net/drivers/efi/efinet.c | 54 ++++++++++--
grub-core/net/net.c | 72 +++++++++++++++
grub-core/net/tftp.c | 4 +
include/grub/efi/api.h | 129 +++++++++++++++++++++++++--
include/grub/net.h | 60 +++++++++++++
6 files changed, 480 insertions(+), 14 deletions(-)
6 files changed, 479 insertions(+), 14 deletions(-)
diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
index f03eeab2fb4..da3e454466b 100644
@ -206,7 +206,7 @@ index f03eeab2fb4..da3e454466b 100644
grub_net_process_dhcp (struct grub_net_buff *nb,
struct grub_net_card *card)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index a3ce4c67cce..329024b6f2c 100644
index 5388f952ba9..a57189e8bb3 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -18,11 +18,15 @@
@ -225,7 +225,7 @@ index a3ce4c67cce..329024b6f2c 100644
GRUB_MOD_LICENSE ("GPLv3+");
@@ -409,7 +413,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -329,7 +333,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
char **path)
{
struct grub_net_card *card;
@ -234,16 +234,13 @@ index a3ce4c67cce..329024b6f2c 100644
dp = grub_efi_get_device_path (hnd);
if (! dp)
@@ -420,16 +424,22 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -340,14 +344,19 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
grub_efi_device_path_t *cdp;
struct grub_efi_pxe *pxe;
struct grub_efi_pxe_mode *pxe_mode;
+
if (card->driver != &efidriver)
continue;
+
if (hnd != card->efi_handle)
continue;
+
cdp = grub_efi_get_device_path (card->efi_handle);
if (! cdp)
@ -258,7 +255,7 @@ index a3ce4c67cce..329024b6f2c 100644
int match;
/* EDK2 UEFI PXE driver creates pseudo devices with type IPv4/IPv6
@@ -438,7 +448,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -356,7 +365,6 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
devices. We skip them when enumerating cards, so here we need to
find matching MAC device.
*/
@ -266,7 +263,7 @@ index a3ce4c67cce..329024b6f2c 100644
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) != GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
|| (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
&& GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) != GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE))
@@ -455,16 +464,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
@@ -373,16 +381,46 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
if (!match)
continue;
}
@ -430,7 +427,7 @@ index 7d90bf66e76..1157524fc50 100644
grub_free (data);
return grub_errno;
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 97b9aa7a4d7..02488ec35ae 100644
index c7c9f0e1db1..28b6adf7648 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -572,10 +572,16 @@ typedef void *grub_efi_handle_t;
@ -454,7 +451,7 @@ index 97b9aa7a4d7..02488ec35ae 100644
typedef grub_efi_uint64_t grub_efi_physical_address_t;
typedef grub_efi_uint64_t grub_efi_virtual_address_t;
@@ -1454,16 +1460,127 @@ struct grub_efi_simple_text_output_interface
@@ -1450,16 +1456,127 @@ struct grub_efi_simple_text_output_interface
};
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;

View File

@ -26,7 +26,7 @@ index 106eb10a362..3630b0cbf2d 100644
efi_status = grub_efi_free_pool (buffer);
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 02488ec35ae..ddc5ecfb03d 100644
index 28b6adf7648..e5b521bd9be 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -527,6 +527,14 @@ typedef grub_uint8_t grub_efi_char8_t;

Some files were not shown because too many files have changed in this diff Show More