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

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