From 87f89c0840a042a683b966d2be8ecb015886cb39 Mon Sep 17 00:00:00 2001 From: tye Date: Thu, 22 Oct 2009 06:29:51 +0000 Subject: [PATCH] 1. Fix timer unit bug in MNP: default rx/tx timeout value should be 10,000,000 (10s) according to UEFI spec. 2. Enable the mapping from IPv6 multicast address to MAC address in MnpMcastIpToMac(). 3. Remove 2 tabs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9355 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Network/MnpDxe/MnpConfig.c | 4 +- .../Universal/Network/MnpDxe/MnpMain.c | 56 ++++++++++++------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c index 838765de74..381f8b87b8 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpConfig.c @@ -32,8 +32,8 @@ EFI_MANAGED_NETWORK_PROTOCOL mMnpProtocolTemplate = { }; EFI_MANAGED_NETWORK_CONFIG_DATA mMnpDefaultConfigData = { - 10000, - 10000, + 10000000, + 10000000, 0, FALSE, FALSE, diff --git a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c index 79ea478914..86004cda84 100644 --- a/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c +++ b/MdeModulePkg/Universal/Network/MnpDxe/MnpMain.c @@ -1,7 +1,7 @@ /** @file Implementation of Managed Network Protocol public services. -Copyright (c) 2005 - 2007, Intel Corporation.
+Copyright (c) 2005 - 2009, Intel Corporation.
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -226,22 +226,20 @@ MnpMcastIpToMac ( MNP_INSTANCE_DATA *Instance; EFI_SIMPLE_NETWORK_PROTOCOL *Snp; EFI_TPL OldTpl; + EFI_IPv6_ADDRESS *Ip6Address; if ((This == NULL) || (IpAddress == NULL) || (MacAddress == NULL)) { return EFI_INVALID_PARAMETER; } - if (Ipv6Flag) { - // - // Currently IPv6 isn't supported. - // - return EFI_UNSUPPORTED; - } + Ip6Address = &IpAddress->v6; - if (!IP4_IS_MULTICAST (EFI_NTOHL (*IpAddress))) { + if ((Ipv6Flag && !IP6_IS_MULTICAST (Ip6Address)) || + (!Ipv6Flag && !IP4_IS_MULTICAST (EFI_NTOHL (*IpAddress))) + ) { // - // The IPv4 address passed in is not a multicast address. + // The IP address passed in is not a multicast address. // return EFI_INVALID_PARAMETER; } @@ -259,17 +257,33 @@ MnpMcastIpToMac ( Snp = Instance->MnpServiceData->Snp; ASSERT (Snp != NULL); + ZeroMem (MacAddress, sizeof (EFI_MAC_ADDRESS)); + if (Snp->Mode->IfType == NET_IFTYPE_ETHERNET) { - // - // Translate the IPv4 address into a multicast MAC address if the NIC is an - // ethernet NIC. - // - MacAddress->Addr[0] = 0x01; - MacAddress->Addr[1] = 0x00; - MacAddress->Addr[2] = 0x5E; - MacAddress->Addr[3] = (UINT8) (IpAddress->v4.Addr[1] & 0x7F); - MacAddress->Addr[4] = IpAddress->v4.Addr[2]; - MacAddress->Addr[5] = IpAddress->v4.Addr[3]; + if (!Ipv6Flag) { + // + // Translate the IPv4 address into a multicast MAC address if the NIC is an + // ethernet NIC according to RFC1112.. + // + MacAddress->Addr[0] = 0x01; + MacAddress->Addr[1] = 0x00; + MacAddress->Addr[2] = 0x5E; + MacAddress->Addr[3] = (UINT8) (IpAddress->v4.Addr[1] & 0x7F); + MacAddress->Addr[4] = IpAddress->v4.Addr[2]; + MacAddress->Addr[5] = IpAddress->v4.Addr[3]; + } else { + // + // Translate the IPv6 address into a multicast MAC address if the NIC is an + // ethernet NIC according to RFC2464. + // + + MacAddress->Addr[0] = 0x33; + MacAddress->Addr[1] = 0x33; + MacAddress->Addr[2] = Ip6Address->Addr[12]; + MacAddress->Addr[3] = Ip6Address->Addr[13]; + MacAddress->Addr[4] = Ip6Address->Addr[14]; + MacAddress->Addr[5] = Ip6Address->Addr[15]; + } Status = EFI_SUCCESS; } else { @@ -454,7 +468,7 @@ ON_EXIT: @param[in] This Pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance. @param[in] Token Pointer to a token associated with the transmit data descriptor. Type EFI_MANAGED_NETWORK_COMPLETION_TOKEN - is defined in "Related Definitions" below. + is defined in "Related Definitions" below. @retval EFI_SUCCESS The transmit completion token was cached. @retval EFI_NOT_STARTED This MNP child driver instance has not been @@ -655,7 +669,7 @@ ON_EXIT: @param[in] Token Pointer to a token that has been issued by EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If NULL, all - pending tokens are aborted. + pending tokens are aborted. @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event was signaled. When Token is NULL,