nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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