dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0037-increase-network-try-interval-gradually.patch

4fe85b
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
4fe85b
From: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
4fe85b
Date: Tue, 21 Jan 2014 11:03:51 -0200
4fe85b
Subject: [PATCH] increase network try interval gradually
4fe85b
4fe85b
* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
4fe85b
interval gradually.
4fe85b
* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise.
4fe85b
* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
4fe85b
* grub-core/net/tftp.c (tftp_open): Likewise.
4fe85b
* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define.
4fe85b
---
4fe85b
 grub-core/net/arp.c   | 3 ++-
4fe85b
 grub-core/net/icmp6.c | 3 ++-
4fe85b
 grub-core/net/net.c   | 5 +++--
4fe85b
 grub-core/net/tftp.c  | 3 ++-
4fe85b
 include/grub/net.h    | 1 +
4fe85b
 ChangeLog             | 9 +++++++++
4fe85b
 6 files changed, 19 insertions(+), 5 deletions(-)
4fe85b
4fe85b
diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
4fe85b
index e92c7e7daec..d62d0cc1e01 100644
4fe85b
--- a/grub-core/net/arp.c
4fe85b
+++ b/grub-core/net/arp.c
4fe85b
@@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
4fe85b
 	return GRUB_ERR_NONE;
4fe85b
       pending_req = proto_addr->ipv4;
4fe85b
       have_pending = 0;
4fe85b
-      grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending);
4fe85b
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
4fe85b
+                           &have_pending);
4fe85b
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
4fe85b
 	return GRUB_ERR_NONE;
4fe85b
       nb.data = nbd;
4fe85b
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
4fe85b
index 2741e6f11fb..bbc902014fe 100644
4fe85b
--- a/grub-core/net/icmp6.c
4fe85b
+++ b/grub-core/net/icmp6.c
4fe85b
@@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
4fe85b
     {
4fe85b
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
4fe85b
 	break;
4fe85b
-      grub_net_poll_cards (GRUB_NET_INTERVAL, 0);
4fe85b
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
4fe85b
+                           0);
4fe85b
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
4fe85b
 	break;
4fe85b
       nb->data = nbd;
4fe85b
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
4fe85b
index 56355f3c98c..1521d8d2c87 100644
4fe85b
--- a/grub-core/net/net.c
4fe85b
+++ b/grub-core/net/net.c
4fe85b
@@ -1558,8 +1558,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len)
4fe85b
       if (!net->eof)
4fe85b
 	{
4fe85b
 	  try++;
4fe85b
-	  grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall);
4fe85b
-	}
4fe85b
+	  grub_net_poll_cards (GRUB_NET_INTERVAL +
4fe85b
+                               (try * GRUB_NET_INTERVAL_ADDITION), &net->stall);
4fe85b
+        }
4fe85b
       else
4fe85b
 	return total;
4fe85b
     }
4fe85b
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
4fe85b
index 9c489f1fc94..51736142764 100644
4fe85b
--- a/grub-core/net/tftp.c
4fe85b
+++ b/grub-core/net/tftp.c
4fe85b
@@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename)
4fe85b
 	  destroy_pq (data);
4fe85b
 	  return err;
4fe85b
 	}
4fe85b
-      grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack);
4fe85b
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
4fe85b
+                           &data->have_oack);
4fe85b
       if (data->have_oack)
4fe85b
 	break;
4fe85b
     }
4fe85b
diff --git a/include/grub/net.h b/include/grub/net.h
4fe85b
index de6259ee1a0..0e0a605c5a6 100644
4fe85b
--- a/include/grub/net.h
4fe85b
+++ b/include/grub/net.h
4fe85b
@@ -532,5 +532,6 @@ extern char *grub_net_default_server;
4fe85b
 
4fe85b
 #define GRUB_NET_TRIES 40
4fe85b
 #define GRUB_NET_INTERVAL 400
4fe85b
+#define GRUB_NET_INTERVAL_ADDITION 20
4fe85b
 
4fe85b
 #endif /* ! GRUB_NET_HEADER */
4fe85b
diff --git a/ChangeLog b/ChangeLog
4fe85b
index f69d8c7e042..f5618a6eb70 100644
4fe85b
--- a/ChangeLog
4fe85b
+++ b/ChangeLog
4fe85b
@@ -1,3 +1,12 @@
4fe85b
+2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
4fe85b
+
4fe85b
+	* grub-core/net/arp.c (grub_net_arp_send_request): Increase network try
4fe85b
+	interval gradually.
4fe85b
+	* grub-core/net/icmp6.c (grub_net_icmp6_send_request): Likewise.
4fe85b
+	* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
4fe85b
+	* grub-core/net/tftp.c (tftp_open): Likewise.
4fe85b
+	* include/grub/net.h (GRUB_NET_INTERVAL_ADDITION): New define.
4fe85b
+
4fe85b
 2014-01-21  Paulo Flabiano Smorigo  <pfsmorigo@br.ibm.com>
4fe85b
 
4fe85b
 	* grub-core/net/net.c (receive_packets): Change stop condition to avoid