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