Hi,

Sorry, the previous patch missed a similar bug.

On Sun, Apr 29, 2012 at 4:22 PM, Bean <bean12...@gmail.com> wrote:
> Hi,
>
> This patch fix a few bugs in efinet.
>
> It also change the tftp block size from 1024 to 8192, which would
> result in HUGE speed difference. In my previous testing, the larger
> the block size, the faster the speed. It can reach up to 60-70MB/s in
> 1Gb ethernet when block size is about 60K, therefore it would be a
> good idea to allow user to configure this parameter. The native tftp
> service in UEFI use a default block size of 8192.
>
> --
> Best wishes
> Bean



-- 
Best wishes
Bean
=== modified file 'grub-core/net/drivers/efi/efinet.c'
--- grub-core/net/drivers/efi/efinet.c  2012-03-10 19:41:28 +0000
+++ grub-core/net/drivers/efi/efinet.c  2012-04-29 08:23:58 +0000
@@ -63,14 +63,13 @@
   grub_efi_uintn_t bufsize = 1536;
   struct grub_net_buff *nb;
 
-  nb = grub_netbuff_alloc (bufsize);
+  nb = grub_netbuff_alloc (bufsize + 2);
   if (!nb)
     return NULL;
 
   /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is divisible
      by 4. So that IP header is aligned on 4 bytes. */
-  grub_netbuff_reserve (nb, 2);
-  if (!nb)
+  if (grub_netbuff_reserve (nb, 2))
     {
       grub_netbuff_free (nb);
       return NULL;
@@ -84,14 +83,13 @@
 
       bufsize = ALIGN_UP (bufsize, 32);
 
-      nb = grub_netbuff_alloc (bufsize);
+      nb = grub_netbuff_alloc (bufsize + 2);
       if (!nb)
        return NULL;
 
       /* Reserve 2 bytes so that 2 + 14/18 bytes of ethernet header is 
divisible
         by 4. So that IP header is aligned on 4 bytes. */
-      grub_netbuff_reserve (nb, 2);
-      if (!nb)
+      if (grub_netbuff_reserve (nb, 2))
        {
          grub_netbuff_free (nb);
          return NULL;

=== modified file 'grub-core/net/tftp.c'
--- grub-core/net/tftp.c        2012-02-12 18:11:06 +0000
+++ grub-core/net/tftp.c        2012-04-29 08:10:29 +0000
@@ -320,9 +320,9 @@
   rrqlen += grub_strlen ("blksize") + 1;
   rrq += grub_strlen ("blksize") + 1;
 
-  grub_strcpy (rrq, "1024");
-  rrqlen += grub_strlen ("1024") + 1;
-  rrq += grub_strlen ("1024") + 1;
+  grub_strcpy (rrq, "8192");
+  rrqlen += grub_strlen ("8192") + 1;
+  rrq += grub_strlen ("8192") + 1;
 
   grub_strcpy (rrq, "tsize");
   rrqlen += grub_strlen ("tsize") + 1;

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to