]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Resend a packet if we got the wrong buffer in status.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 17 Mar 2013 12:33:16 +0000 (13:33 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 17 Mar 2013 12:33:16 +0000 (13:33 +0100)
ChangeLog
grub-core/net/drivers/efi/efinet.c
include/grub/net.h

index 4f5a281f2c65340f9f18ad2a3d65147ad7b04e52..ad84d27f757f7d67e0058db5f86883a3918a1f19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-03-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Resend a packet if we got the wrong buffer in status.
+
 2013-03-10  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/loader/i386/bsdXX.c (grub_openbsd_find_ramdisk): Use
index 28f2db27f75c353ba1c4c6230e645e6e8a648a95..2b344d6ef78f50cc0d2dad1263fc72f81dc95781 100644 (file)
@@ -37,7 +37,6 @@ send_card_buffer (struct grub_net_card *dev,
   grub_efi_status_t st;
   grub_efi_simple_network_t *net = dev->efi_net;
   grub_uint64_t limit_time = grub_get_time_ms () + 4000;
-  grub_size_t len;
 
   if (dev->txbusy)
     while (1)
@@ -52,17 +51,26 @@ send_card_buffer (struct grub_net_card *dev,
            dev->txbusy = 0;
            break;
          }
+       if (txbuf)
+         {
+           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"));
+         }
        if (limit_time < grub_get_time_ms ())
-         return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet"));
+         return grub_error (GRUB_ERR_TIMEOUT,
+                            N_("couldn't send network packet"));
       }
 
-  len = (pack->tail - pack->data);
-  if (len > dev->mtu)
-    len = dev->mtu;
+  dev->last_pkt_size = (pack->tail - pack->data);
+  if (dev->last_pkt_size > dev->mtu)
+    dev->last_pkt_size = dev->mtu;
 
-  grub_memcpy (dev->txbuf, pack->data, len);
+  grub_memcpy (dev->txbuf, pack->data, dev->last_pkt_size);
 
-  st = efi_call_7 (net->transmit, net, 0, len,
+  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"));
index 3877451da1f405222d284db826818ce33774f490..1bd7af2f6d4ef5d7fe03d707e5e1b4ffb7eda50d 100644 (file)
@@ -139,6 +139,7 @@ struct grub_net_card
     {
       struct grub_efi_simple_network *efi_net;
       grub_efi_handle_t efi_handle;
+      grub_size_t last_pkt_size;
     };
 #endif
     void *data;