]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
add mtu information
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 8 Jul 2011 16:49:35 +0000 (18:49 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 8 Jul 2011 16:49:35 +0000 (18:49 +0200)
grub-core/net/drivers/efi/efinet.c
grub-core/net/drivers/emu/emunet.c
grub-core/net/drivers/i386/pc/pxe.c
grub-core/net/drivers/ieee1275/ofnet.c
include/grub/net.h

index 5c6aac608c12e9ab2aeabb23f0280e6c9252b876..0fc7799660145ec25df125af214b0139e8ac8fac 100644 (file)
@@ -136,6 +136,7 @@ grub_efinet_findcards (void)
       card->driver = &efidriver;
       card->flags = 0;
       card->default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
+      card->mtu = net->mode->max_packet_size;
       grub_memcpy (card->default_address.mac,
                   net->mode->current_address,
                   sizeof (card->default_address.mac));
index d1e49a2f4f031c121e6f317784b72b9ca8fcb434..96f773340abd7f2f2fd295c9c2305a7fc90bcbe9 100644 (file)
@@ -1,3 +1,20 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2010,2011  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
 
 #include <grub/dl.h>
 #include <grub/net/netbuff.h>
@@ -52,6 +69,7 @@ static struct grub_net_card emucard =
   {
     .name = "emu0",
     .driver = &emudriver,
+    .mtu = 1500,
     .default_address = {
                         .type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET,
                         {.mac = {0, 1, 2, 3, 4, 5}}
index cd598ea72fe4861f58f57768e74731c2c77a9bce..588673177bda85f20d5dd6034503996eb5fc23ee 100644 (file)
@@ -345,6 +345,7 @@ GRUB_MOD_INIT(pxe)
   if (i == sizeof (grub_pxe_card.default_address.mac))
     grub_memcpy (grub_pxe_card.default_address.mac, ui->permanent_addr,
                 sizeof (grub_pxe_card.default_address.mac));
+  grub_pxe_card.mtu = ui->mtu;
 
   grub_pxe_card.default_address.type = GRUB_NET_LINK_LEVEL_PROTOCOL_ETHERNET;
 
index 20d45ee3db56dc89b4629a68e2216e966d345bed..035a9622034688801dafa6c1a773a8353e3e64fc 100644 (file)
@@ -28,7 +28,6 @@ struct grub_ofnetcard_data
 {
   char *path;
   grub_ieee1275_ihandle_t handle;
-  grub_uint32_t mtu;
 };
 
 static grub_err_t
@@ -85,7 +84,7 @@ get_card_packet (const struct grub_net_card *dev, struct grub_net_buff *nb)
   grub_netbuff_clear (nb);
   start_time = grub_get_time_ms ();
   do
-    rc = grub_ieee1275_read (data->handle, nb->data, data->mtu, &actual);
+    rc = grub_ieee1275_read (data->handle, nb->data, dev->mtu, &actual);
   while ((actual <= 0 || rc < 0) && (grub_get_time_ms () - start_time < 200));
   if (actual)
     {
@@ -228,12 +227,15 @@ grub_ofnet_findcards (void)
 
        grub_ieee1275_finddevice (ofdata->path, &devhandle);
 
-       if (grub_ieee1275_get_integer_property
-           (devhandle, "max-frame-size", &(ofdata->mtu),
-            sizeof (ofdata->mtu), 0))
-         {
-           ofdata->mtu = 1500;
-         }
+       {
+         grub_uint32_t t;
+         if (grub_ieee1275_get_integer_property (devhandle,
+                                                 "max-frame-size", &t,
+                                                 sizeof (t), 0))
+           card->mtu = 1500;
+         else
+           card->mtu = t;
+       }
 
        if (grub_ieee1275_get_property (devhandle, "mac-address",
                                        &(lla.mac), 6, 0)
index f6600690a8989af0b04df4a369f6025aaf337a7a..f3c0489e20a66905e0ee33f75d5909835de926fd 100644 (file)
@@ -97,6 +97,7 @@ struct grub_net_card
   int opened;
   unsigned idle_poll_delay_ms;
   grub_uint64_t last_poll;
+  grub_size_t mtu;
   union
   {
 #ifdef GRUB_MACHINE_EFI