dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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