grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efinet: retransmit if our device is busy
@ 2015-08-31 17:34 Josef Bacik
  2015-09-11 16:49 ` Andrei Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Josef Bacik @ 2015-08-31 17:34 UTC (permalink / raw
  To: kernel-team, grub-devel

When I fixed the txbuf handling I ripped out the retransmission code since it
was flooding our network when we had the buggy behavior.  Turns out this was too
heavy handed as we can still have transient tx timeouts.  So instead make sure
we retry our transmission once per timeout.  This way we can deal with transient
transmission problems without flooding the box.  This fixes an issue we were
seeing in production.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 grub-core/net/drivers/efi/efinet.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 692d5ad..c8f80a1 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -38,6 +38,7 @@ send_card_buffer (struct grub_net_card *dev,
   grub_efi_simple_network_t *net = dev->efi_net;
   grub_uint64_t limit_time = grub_get_time_ms () + 4000;
   void *txbuf;
+  int retry = 0;
 
   if (dev->txbusy)
     while (1)
@@ -60,6 +61,15 @@ send_card_buffer (struct grub_net_card *dev,
 	    dev->txbusy = 0;
 	    break;
 	  }
+	if (!retry)
+	  {
+	    st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
+			     dev->txbuf, NULL, NULL, NULL);
+	    if (st != GRUB_EFI_SUCCESS)
+	      return grub_error (GRUB_ERR_IO,
+				 N_("couldn't send network packet"));
+	    retry = 1;
+	  }
 	if (limit_time < grub_get_time_ms ())
 	  return grub_error (GRUB_ERR_TIMEOUT,
 			     N_("couldn't send network packet"));
-- 
2.1.0



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

* Re: [PATCH] efinet: retransmit if our device is busy
  2015-08-31 17:34 [PATCH] efinet: retransmit if our device is busy Josef Bacik
@ 2015-09-11 16:49 ` Andrei Borzenkov
  2015-09-11 19:08   ` Josef Bacik
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2015-09-11 16:49 UTC (permalink / raw
  To: The development of GNU GRUB, kernel-team

31.08.2015 20:34, Josef Bacik пишет:
> When I fixed the txbuf handling I ripped out the retransmission code since it
> was flooding our network when we had the buggy behavior.  Turns out this was too
> heavy handed as we can still have transient tx timeouts.  So instead make sure
> we retry our transmission once per timeout.  This way we can deal with transient
> transmission problems without flooding the box.  This fixes an issue we were
> seeing in production.  Thanks,
>

You mean you get timeout in efi send_card_buffer, not higher level? That 
sounds like something steals completion status. Could you send lsefi 
after network interface was opened?

> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
>   grub-core/net/drivers/efi/efinet.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
> index 692d5ad..c8f80a1 100644
> --- a/grub-core/net/drivers/efi/efinet.c
> +++ b/grub-core/net/drivers/efi/efinet.c
> @@ -38,6 +38,7 @@ send_card_buffer (struct grub_net_card *dev,
>     grub_efi_simple_network_t *net = dev->efi_net;
>     grub_uint64_t limit_time = grub_get_time_ms () + 4000;
>     void *txbuf;
> +  int retry = 0;
>
>     if (dev->txbusy)
>       while (1)
> @@ -60,6 +61,15 @@ send_card_buffer (struct grub_net_card *dev,
>   	    dev->txbusy = 0;
>   	    break;
>   	  }
> +	if (!retry)
> +	  {
> +	    st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
> +			     dev->txbuf, NULL, NULL, NULL);
> +	    if (st != GRUB_EFI_SUCCESS)
> +	      return grub_error (GRUB_ERR_IO,
> +				 N_("couldn't send network packet"));
> +	    retry = 1;
> +	  }
>   	if (limit_time < grub_get_time_ms ())
>   	  return grub_error (GRUB_ERR_TIMEOUT,
>   			     N_("couldn't send network packet"));
>



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

* Re: [PATCH] efinet: retransmit if our device is busy
  2015-09-11 16:49 ` Andrei Borzenkov
@ 2015-09-11 19:08   ` Josef Bacik
  0 siblings, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2015-09-11 19:08 UTC (permalink / raw
  To: Andrei Borzenkov, The development of GNU GRUB, kernel-team

On 09/11/2015 12:49 PM, Andrei Borzenkov wrote:
> 31.08.2015 20:34, Josef Bacik пишет:
>> When I fixed the txbuf handling I ripped out the retransmission code
>> since it
>> was flooding our network when we had the buggy behavior.  Turns out
>> this was too
>> heavy handed as we can still have transient tx timeouts.  So instead
>> make sure
>> we retry our transmission once per timeout.  This way we can deal with
>> transient
>> transmission problems without flooding the box.  This fixes an issue
>> we were
>> seeing in production.  Thanks,
>>
>
> You mean you get timeout in efi send_card_buffer, not higher level? That
> sounds like something steals completion status. Could you send lsefi
> after network interface was opened?

No i get a timeout at a higher level.  We try to transmit, we never get 
the txbuf thing from getstatus, and we never redo the transmit.  This 
just adds the retransmit back in.  Thanks,

Josef



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

end of thread, other threads:[~2015-09-11 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-31 17:34 [PATCH] efinet: retransmit if our device is busy Josef Bacik
2015-09-11 16:49 ` Andrei Borzenkov
2015-09-11 19:08   ` Josef Bacik

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 read-only IMAP folder(s) and NNTP newsgroup(s).