add mtu information
This commit is contained in:
parent
5438143da6
commit
6a1af81a97
5 changed files with 31 additions and 8 deletions
|
@ -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));
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue