grub2/0134-efinet-retransmit-if-our-device-is-busy.patch
Peter Jones ec4acbbd98 Update grub2 for f28
- Try to fix things for new compiler madness.
  I really don't know why gcc decided __attribute__((packed)) on a "typedef
  struct" should imply __attribute__((align (1))) and that it should have a
  warning that it does so.  The obvious behavior would be to keep the alignment
  of the first element unless it's used in another object or type that /also/
  hask the packed attribute.  Why should it change the default alignment at
  all?
- Merge in the BLS patches Javier and I wrote.
- Attempt to fix pmtimer initialization failures to not be super duper slow.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-02-28 10:08:00 -05:00

49 lines
1.7 KiB
Diff

From f0d62522c10f25e2e9fc9bcd51bc0dbf14b6d9c7 Mon Sep 17 00:00:00 2001
From: Josef Bacik <jbacik@fb.com>
Date: Mon, 31 Aug 2015 13:34:35 -0400
Subject: [PATCH 134/206] 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"));
--
2.15.0