grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] increase network try interval gradually
@ 2014-01-20 19:29 Paulo Flabiano Smorigo
  2014-01-21  7:23 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 2+ messages in thread
From: Paulo Flabiano Smorigo @ 2014-01-20 19:29 UTC (permalink / raw)
  To: grub-devel

Hi all,

This patch changes GRUB net interval gradually over time to avoid timeout
problems. I'm currently doing tests in a network with heavy traffic. In this
network GRUB fails with the original timeout value.

---
 grub-core/net/arp.c   | 3 ++-
 grub-core/net/icmp6.c | 3 ++-
 grub-core/net/net.c   | 5 +++--
 grub-core/net/tftp.c  | 3 ++-
 include/grub/net.h    | 1 +
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
index 3076b18..248bd4b 100644
--- a/grub-core/net/arp.c
+++ b/grub-core/net/arp.c
@@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
 	return GRUB_ERR_NONE;
       pending_req = proto_addr->ipv4;
       have_pending = 0;
-      grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending);
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
+                           &have_pending);
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
 	return GRUB_ERR_NONE;
       nb.data = nbd;
diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
index 2741e6f..bbc9020 100644
--- a/grub-core/net/icmp6.c
+++ b/grub-core/net/icmp6.c
@@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
     {
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
 	break;
-      grub_net_poll_cards (GRUB_NET_INTERVAL, 0);
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
+                           0);
       if (grub_net_link_layer_resolve_check (inf, proto_addr))
 	break;
       nb->data = nbd;
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 8f9d183..683ab28 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1596,8 +1596,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len)
       if (!net->eof)
 	{
 	  try++;
-	  grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall);
-	}
+	  grub_net_poll_cards (GRUB_NET_INTERVAL +
+                               (try * GRUB_NET_INTERVAL_ADDITION), &net->stall);
+        }
       else
 	return total;
     }
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
index 9c489f1..5173614 100644
--- a/grub-core/net/tftp.c
+++ b/grub-core/net/tftp.c
@@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename)
 	  destroy_pq (data);
 	  return err;
 	}
-      grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack);
+      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
+                           &data->have_oack);
       if (data->have_oack)
 	break;
     }
diff --git a/include/grub/net.h b/include/grub/net.h
index 843f74f..538baa3 100644
--- a/include/grub/net.h
+++ b/include/grub/net.h
@@ -536,5 +536,6 @@ extern char *grub_net_default_server;
 
 #define GRUB_NET_TRIES 40
 #define GRUB_NET_INTERVAL 400
+#define GRUB_NET_INTERVAL_ADDITION 20
 
 #endif /* ! GRUB_NET_HEADER */
-- 
1.8.2.1


-- 
Paulo Flabiano Smorigo
IBM Linux Technology Center



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] increase network try interval gradually
  2014-01-20 19:29 [PATCH] increase network try interval gradually Paulo Flabiano Smorigo
@ 2014-01-21  7:23 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-01-21  7:23 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 3276 bytes --]

Go ahead for trunk.
On 20.01.2014 20:29, Paulo Flabiano Smorigo wrote:
> Hi all,
> 
> This patch changes GRUB net interval gradually over time to avoid timeout
> problems. I'm currently doing tests in a network with heavy traffic. In this
> network GRUB fails with the original timeout value.
> 
> ---
>  grub-core/net/arp.c   | 3 ++-
>  grub-core/net/icmp6.c | 3 ++-
>  grub-core/net/net.c   | 5 +++--
>  grub-core/net/tftp.c  | 3 ++-
>  include/grub/net.h    | 1 +
>  5 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c
> index 3076b18..248bd4b 100644
> --- a/grub-core/net/arp.c
> +++ b/grub-core/net/arp.c
> @@ -110,7 +110,8 @@ grub_net_arp_send_request (struct grub_net_network_level_interface *inf,
>  	return GRUB_ERR_NONE;
>        pending_req = proto_addr->ipv4;
>        have_pending = 0;
> -      grub_net_poll_cards (GRUB_NET_INTERVAL, &have_pending);
> +      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
> +                           &have_pending);
>        if (grub_net_link_layer_resolve_check (inf, proto_addr))
>  	return GRUB_ERR_NONE;
>        nb.data = nbd;
> diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c
> index 2741e6f..bbc9020 100644
> --- a/grub-core/net/icmp6.c
> +++ b/grub-core/net/icmp6.c
> @@ -518,7 +518,8 @@ grub_net_icmp6_send_request (struct grub_net_network_level_interface *inf,
>      {
>        if (grub_net_link_layer_resolve_check (inf, proto_addr))
>  	break;
> -      grub_net_poll_cards (GRUB_NET_INTERVAL, 0);
> +      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
> +                           0);
>        if (grub_net_link_layer_resolve_check (inf, proto_addr))
>  	break;
>        nb->data = nbd;
> diff --git a/grub-core/net/net.c b/grub-core/net/net.c
> index 8f9d183..683ab28 100644
> --- a/grub-core/net/net.c
> +++ b/grub-core/net/net.c
> @@ -1596,8 +1596,9 @@ grub_net_fs_read_real (grub_file_t file, char *buf, grub_size_t len)
>        if (!net->eof)
>  	{
>  	  try++;
> -	  grub_net_poll_cards (GRUB_NET_INTERVAL, &net->stall);
> -	}
> +	  grub_net_poll_cards (GRUB_NET_INTERVAL +
> +                               (try * GRUB_NET_INTERVAL_ADDITION), &net->stall);
> +        }
>        else
>  	return total;
>      }
> diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
> index 9c489f1..5173614 100644
> --- a/grub-core/net/tftp.c
> +++ b/grub-core/net/tftp.c
> @@ -398,7 +398,8 @@ tftp_open (struct grub_file *file, const char *filename)
>  	  destroy_pq (data);
>  	  return err;
>  	}
> -      grub_net_poll_cards (GRUB_NET_INTERVAL, &data->have_oack);
> +      grub_net_poll_cards (GRUB_NET_INTERVAL + (i * GRUB_NET_INTERVAL_ADDITION),
> +                           &data->have_oack);
>        if (data->have_oack)
>  	break;
>      }
> diff --git a/include/grub/net.h b/include/grub/net.h
> index 843f74f..538baa3 100644
> --- a/include/grub/net.h
> +++ b/include/grub/net.h
> @@ -536,5 +536,6 @@ extern char *grub_net_default_server;
>  
>  #define GRUB_NET_TRIES 40
>  #define GRUB_NET_INTERVAL 400
> +#define GRUB_NET_INTERVAL_ADDITION 20
>  
>  #endif /* ! GRUB_NET_HEADER */
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 274 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-21  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 19:29 [PATCH] increase network try interval gradually Paulo Flabiano Smorigo
2014-01-21  7:23 ` Vladimir 'φ-coder/phcoder' Serbinenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).