summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c')
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c128
1 files changed, 69 insertions, 59 deletions
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c b/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c
index 6c5bf15..00c80eb 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Mcast_ip_to_mac.c
@@ -1,29 +1,24 @@
/** @file
-Copyright (c) 2004 - 2007, 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
-http://opensource.org/licenses/bsd-license.php
+ Implementation of converting an multicast IP address to multicast HW MAC
+ address.
+
+Copyright (c) 2004 - 2007, Intel Corporation. <BR>
+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
+http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-Module name:
- mcast_ip_to_mac.c
-
-Abstract:
-
-Revision history:
- 2000-Feb-17 M(f)J Genesis.
-
**/
#include "Snp.h"
/**
- this routine calls undi to convert an multicast IP address to a MAC address
+ this routine calls undi to convert an multicast IP address to a MAC address.
- @param snp pointer to snp driver structure
+ @param Snp pointer to snp driver structure
@param IPv6 flag to indicate if this is an ipv6 address
@param IP multicast IP address
@param MAC pointer to hold the return MAC address
@@ -31,41 +26,41 @@ Revision history:
**/
EFI_STATUS
-pxe_ip2mac (
- IN SNP_DRIVER *snp,
+PxeIp2Mac (
+ IN SNP_DRIVER *Snp,
IN BOOLEAN IPv6,
IN EFI_IP_ADDRESS *IP,
IN OUT EFI_MAC_ADDRESS *MAC
)
{
- PXE_CPB_MCAST_IP_TO_MAC *cpb;
- PXE_DB_MCAST_IP_TO_MAC *db;
+ PXE_CPB_MCAST_IP_TO_MAC *Cpb;
+ PXE_DB_MCAST_IP_TO_MAC *Db;
- cpb = snp->cpb;
- db = snp->db;
- snp->cdb.OpCode = PXE_OPCODE_MCAST_IP_TO_MAC;
- snp->cdb.OpFlags = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);
- snp->cdb.CPBsize = sizeof (PXE_CPB_MCAST_IP_TO_MAC);
- snp->cdb.DBsize = sizeof (PXE_DB_MCAST_IP_TO_MAC);
+ Cpb = Snp->Cpb;
+ Db = Snp->Db;
+ Snp->Cdb.OpCode = PXE_OPCODE_MCAST_IP_TO_MAC;
+ Snp->Cdb.OpFlags = (UINT16) (IPv6 ? PXE_OPFLAGS_MCAST_IPV6_TO_MAC : PXE_OPFLAGS_MCAST_IPV4_TO_MAC);
+ Snp->Cdb.CPBsize = sizeof (PXE_CPB_MCAST_IP_TO_MAC);
+ Snp->Cdb.DBsize = sizeof (PXE_DB_MCAST_IP_TO_MAC);
- snp->cdb.CPBaddr = (UINT64)(UINTN) cpb;
- snp->cdb.DBaddr = (UINT64)(UINTN) db;
+ Snp->Cdb.CPBaddr = (UINT64)(UINTN) Cpb;
+ Snp->Cdb.DBaddr = (UINT64)(UINTN) Db;
- snp->cdb.StatCode = PXE_STATCODE_INITIALIZE;
- snp->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
- snp->cdb.IFnum = snp->if_num;
- snp->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
+ Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
+ Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
+ Snp->Cdb.IFnum = Snp->IfNum;
+ Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
- CopyMem (&cpb->IP, IP, sizeof (PXE_IP_ADDR));
+ CopyMem (&Cpb->IP, IP, sizeof (PXE_IP_ADDR));
//
// Issue UNDI command and check result.
//
- DEBUG ((EFI_D_NET, "\nsnp->undi.mcast_ip_to_mac() "));
+ DEBUG ((EFI_D_NET, "\nSnp->undi.mcast_ip_to_mac() "));
- (*snp->issue_undi32_command) ((UINT64)(UINTN) &snp->cdb);
+ (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);
- switch (snp->cdb.StatCode) {
+ switch (Snp->Cdb.StatCode) {
case PXE_STATCODE_SUCCESS:
break;
@@ -75,9 +70,9 @@ pxe_ip2mac (
case PXE_STATCODE_UNSUPPORTED:
DEBUG (
(EFI_D_NET,
- "\nsnp->undi.mcast_ip_to_mac() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
+ "\nSnp->undi.mcast_ip_to_mac() %xh:%xh\n",
+ Snp->Cdb.StatFlags,
+ Snp->Cdb.StatCode)
);
return EFI_UNSUPPORTED;
@@ -88,49 +83,64 @@ pxe_ip2mac (
//
DEBUG (
(EFI_D_NET,
- "\nsnp->undi.mcast_ip_to_mac() %xh:%xh\n",
- snp->cdb.StatFlags,
- snp->cdb.StatCode)
+ "\nSnp->undi.mcast_ip_to_mac() %xh:%xh\n",
+ Snp->Cdb.StatFlags,
+ Snp->Cdb.StatCode)
);
return EFI_DEVICE_ERROR;
}
- CopyMem (MAC, &db->MAC, sizeof (PXE_MAC_ADDR));
+ CopyMem (MAC, &Db->MAC, sizeof (PXE_MAC_ADDR));
return EFI_SUCCESS;
}
/**
- This is the SNP interface routine for converting a multicast IP address to
- a MAC address.
- This routine basically retrieves snp structure, checks the SNP state and
- calls the pxe_ip2mac routine to actually do the conversion
-
- @param this context pointer
- @param IPv6 flag to indicate if this is an ipv6 address
- @param IP multicast IP address
- @param MAC pointer to hold the return MAC address
-
+ Converts a multicast IP address to a multicast HW MAC address.
+
+ This function converts a multicast IP address to a multicast HW MAC address
+ for all packet transactions. If the mapping is accepted, then EFI_SUCCESS will
+ be returned.
+
+ @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.
+ @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460].
+ Set to FALSE if the multicast IP address is IPv4 [RFC 791].
+ @param IP The multicast IP address that is to be converted to a multicast
+ HW MAC address.
+ @param MAC The multicast HW MAC address that is to be generated from IP.
+
+ @retval EFI_SUCCESS The multicast IP address was mapped to the
+ multicast HW MAC address.
+ @retval EFI_NOT_STARTED The Simple Network Protocol interface has not
+ been started by calling Start().
+ @retval EFI_INVALID_PARAMETER IP is NULL.
+ @retval EFI_INVALID_PARAMETER MAC is NULL.
+ @retval EFI_INVALID_PARAMETER IP does not point to a valid IPv4 or IPv6
+ multicast address.
+ @retval EFI_DEVICE_ERROR The Simple Network Protocol interface has not
+ been initialized by calling Initialize().
+ @retval EFI_UNSUPPORTED IPv6 is TRUE and the implementation does not
+ support IPv6 multicast to MAC address conversion.
**/
EFI_STATUS
EFIAPI
-snp_undi32_mcast_ip_to_mac (
- IN EFI_SIMPLE_NETWORK_PROTOCOL *this,
+SnpUndi32McastIpToMac (
+ IN EFI_SIMPLE_NETWORK_PROTOCOL *This,
IN BOOLEAN IPv6,
IN EFI_IP_ADDRESS *IP,
OUT EFI_MAC_ADDRESS *MAC
)
{
- SNP_DRIVER *snp;
+ SNP_DRIVER *Snp;
EFI_TPL OldTpl;
EFI_STATUS Status;
//
// Get pointer to SNP driver instance for *this.
//
- if (this == NULL) {
+ if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -138,11 +148,11 @@ snp_undi32_mcast_ip_to_mac (
return EFI_INVALID_PARAMETER;
}
- snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (this);
+ Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
- switch (snp->mode.State) {
+ switch (Snp->Mode.State) {
case EfiSimpleNetworkInitialized:
break;
@@ -155,7 +165,7 @@ snp_undi32_mcast_ip_to_mac (
goto ON_EXIT;
}
- Status = pxe_ip2mac (snp, IPv6, IP, MAC);
+ Status = PxeIp2Mac (Snp, IPv6, IP, MAC);
ON_EXIT:
gBS->RestoreTPL (OldTpl);