From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Michael Chang <mchang@suse.com>
Cc: grub-devel@gnu.org
Subject: Re: [PATCH 3/3] Use UEFI MAC device as default configured by net_bootp6
Date: Thu, 16 Apr 2015 22:58:19 +0300 [thread overview]
Message-ID: <20150416225819.7819ee12@opensuse.site> (raw)
In-Reply-To: <1429088709-924-4-git-send-email-mchang@suse.com>
В Wed, 15 Apr 2015 17:05:09 +0800
Michael Chang <mchang@suse.com> пишет:
> The grub_efinet_findcards will register cards by checking if it can support EFI
> Simple Netowork Protocol which create more than one device to a physical NIC
> device.
>
Yes, indeed.
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/EndEntire
28be27e5-66cc-4a31-a315-db14c3744d85
fa3cde4c-87c2-427d-aede-7dd096c88c58
b95e9fda-26de-48d2-8807-1f9107ac5e3a
d9760ff3-3cca-4267-80f9-7527fafa4223
9fb9a8a1-2f4a-43a6-889c-d0f7b6c47ad5
66ed4721-3c98-4d3e-81e3-d03dd39a7254
ec20eb79-6c1a-4664-9a0d-d2e4cc16d664
00720665-67eb-4a99-baf7-d3c33a1c7cc9
937fe521-95ae-4d1a-8929-48bcd90ad31a
ec835dd3-fe0f-617b-a621-b350c3e13388
2fe800be-8f01-4aa6-946b-d71388e1833f
9d9a39d8-bd42-4a73-a4d5-8ee94be11380
83f01464-99bd-45e5-b383-af6305d8e9e6
c51711e7-b4bf-404a-bfb8-0a048ef1ffe4
3b95aa31-3793-434b-8667-c8070892e05e
f44c00ee-1f2c-4a00-aa09-1c9f3e0800a3
e4f61863-fe2c-4b56-a8f4-08519bc439df
f36ff770-a7e1-42cf-9ed2-56f0f271f44c (Managed Network Protocol)
9e23d768-d2f3-4366-9fc3-3a7aba864374 (VLAN Configuration Protocol)
device path
network
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/HardwareVendor(d79df6b0-ef44-43bd-9797-43e93bcf5fa8)[0:
]/EndEntire HII configuration access
device path
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/HardwareVendor(d8944553-c4dd-41f4-9b30-e1397cfb267b)[0:
]/EndEntire HII configuration access
device path
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/HardwareVendor(5bedb5cc-d830-4eb2-8742-2d4cc9b54f2c)[0:
]/EndEntire HII configuration access
device path
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/IPv4(0.0.0.0,0.0.0.0,0,0,0,0)/EndEntire
network
pxe
load file
device path
/ACPI(a0341d0,0)/PCI(0,3)/MacAddr(52:54:00:12:34:56,1)/IPv6(0:0:0:0:0:0:0:0,0:0:0:0:0:0:0:0,0,0,0,0)/EndEntire
network
pxe
load file
device path
> If without specifying any device to be configured by net_bootp6, it should pick
> up one from them but not all.
Right now I am not even able to netboot in QEMU. Booting from CD and
attempting to read anything over net results in random failure.
There are multiple reports of similar problem in EFI. One of possible
explanations is that EFI drivers are active and steal some packets from
GRUB.
There is patch suggested in bug report
https://savannah.gnu.org/bugs/index.php?41731 but it currently crashes
OVMF so I cannot test it. Also it effectively makes multiple efinet on
single HW card useless anyway (it will open exclusively IPv4 instance
thus blocking any access to MAC device using SNP).
So it looks like efinet needs redesign anyway.
> In my case three firmware device are listed.
> IPv4, IPv6 and MAC device. Both IPv4 and IPv6 are derived from MAC device for
> providing PXE Base Code Protocol. I think we should use MAC device instead of
> those two to avoid collision, because net_bootp6 command does not depend on PXE
> Base Code but only Simple Network Protocol to work
> ---
> grub-core/net/bootp.c | 8 +++++++
> grub-core/net/drivers/efi/efinet.c | 40 ++++++++++++++++++++++++++++++++++++
> include/grub/net.h | 1 +
> 3 files changed, 49 insertions(+), 0 deletions(-)
>
> diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c
> index 477f205..c4963ca 100644
> --- a/grub-core/net/bootp.c
> +++ b/grub-core/net/bootp.c
> @@ -1290,6 +1290,10 @@ grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)),
> {
> if (argc > 0 && grub_strcmp (card->name, args[0]) != 0)
> continue;
> +#ifdef GRUB_MACHINE_EFI
> + else if (!card->is_efi_mac_device (card))
> + continue;
> +#endif
> ncards++;
> }
>
> @@ -1299,6 +1303,10 @@ grub_cmd_bootp6 (struct grub_command *cmd __attribute__ ((unused)),
>
> if (argc > 0 && grub_strcmp (card->name, args[0]) != 0)
> continue;
> +#ifdef GRUB_MACHINE_EFI
> + else if (!card->is_efi_mac_device (card))
> + continue;
> +#endif
>
> ifaces = grub_net_ipv6_get_link_local (card, &card->default_address);
> if (!ifaces)
> diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
> index b1837e3..900384f 100644
> --- a/grub-core/net/drivers/efi/efinet.c
> +++ b/grub-core/net/drivers/efi/efinet.c
> @@ -157,6 +157,45 @@ grub_efinet_get_device_handle (struct grub_net_card *card)
> return card->efi_handle;
> }
>
> +static int
> +grub_efinet_is_mac_device (struct grub_net_card *card)
> +{
> + grub_efi_handle_t efi_handle;
> + grub_efi_device_path_t *dp;
> + grub_efi_device_path_t *next, *p;
> + grub_efi_uint8_t type;
> + grub_efi_uint8_t subtype;
> +
> + efi_handle = grub_efinet_get_device_handle (card);
> +
> + if (!efi_handle)
> + return 0;
> +
> + dp = grub_efi_get_device_path (efi_handle);
> +
> + if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
> + return 0;
> +
> + for (p = (grub_efi_device_path_t *) dp, next = GRUB_EFI_NEXT_DEVICE_PATH (p);
> + ! GRUB_EFI_END_ENTIRE_DEVICE_PATH (next);
> + p = next, next = GRUB_EFI_NEXT_DEVICE_PATH (next))
> + ;
> +
> + if (p)
> + {
> + type = GRUB_EFI_DEVICE_PATH_TYPE (p);
> + subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (p);
> +
> + if (type == GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
> + && subtype == GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE)
> + {
> + return 1;
> + }
> + }
> +
> + return 0;
> +}
> +
> static void
> grub_efinet_findcards (void)
> {
> @@ -223,6 +262,7 @@ grub_efinet_findcards (void)
> sizeof (card->default_address.mac));
> card->efi_net = net;
> card->efi_handle = *handle;
> + card->is_efi_mac_device = grub_efinet_is_mac_device;
>
> grub_net_card_register (card);
> }
> diff --git a/include/grub/net.h b/include/grub/net.h
> index 71dc243..4571b72 100644
> --- a/include/grub/net.h
> +++ b/include/grub/net.h
> @@ -140,6 +140,7 @@ struct grub_net_card
> struct grub_efi_simple_network *efi_net;
> grub_efi_handle_t efi_handle;
> grub_size_t last_pkt_size;
> + int (*is_efi_mac_device) (struct grub_net_card* card);
> };
> #endif
> void *data;
next prev parent reply other threads:[~2015-04-16 19:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 9:05 [RFC] Support DHCPv6 and UEFI IPv6 PXE Michael Chang
2015-04-15 9:05 ` [PATCH 1/3] Added net_bootp6 command Michael Chang
2015-04-16 14:40 ` Andrei Borzenkov
2015-04-17 5:04 ` Michael Chang
2015-04-19 8:15 ` Andrei Borzenkov
2015-04-20 3:09 ` Michael Chang
2015-04-20 3:38 ` Andrei Borzenkov
2015-04-15 9:05 ` [PATCH 2/3] UEFI IPv6 PXE support Michael Chang
2015-04-15 9:05 ` [PATCH 3/3] Use UEFI MAC device as default configured by net_bootp6 Michael Chang
2015-04-16 19:58 ` Andrei Borzenkov [this message]
2015-04-17 6:41 ` Michael Chang
2015-04-17 9:01 ` Andrei Borzenkov
2015-04-17 9:48 ` [RFC] Support DHCPv6 and UEFI IPv6 PXE Andrei Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150416225819.7819ee12@opensuse.site \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=mchang@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).