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

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