dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0183-efinet-retransmit-if-our-device-is-busy.patch

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