summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_snp.c
diff options
context:
space:
mode:
authorMichael Brown2009-08-12 00:40:27 +0200
committerMichael Brown2009-08-12 01:23:38 +0200
commit4eab5bc8ca6b66dc965cf188dd4577ad19c5b879 (patch)
tree840f354a2f0efa010368118729e8f16315abc1c4 /src/interface/efi/efi_snp.c
parent[netdevice] Separate out the concept of hardware and link-layer addresses (diff)
downloadipxe-4eab5bc8ca6b66dc965cf188dd4577ad19c5b879.tar.gz
ipxe-4eab5bc8ca6b66dc965cf188dd4577ad19c5b879.tar.xz
ipxe-4eab5bc8ca6b66dc965cf188dd4577ad19c5b879.zip
[netdevice] Allow the hardware and link-layer addresses to differ in size
IPoIB has a 20-byte link-layer address, of which only eight bytes represent anything relating to a "hardware address". The PXE and EFI SNP APIs expect the permanent address to be the same size as the link-layer address, so fill in the "permanent address" field with the initial link layer address (as generated by register_netdev() based upon the real hardware address).
Diffstat (limited to 'src/interface/efi/efi_snp.c')
-rw-r--r--src/interface/efi/efi_snp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/interface/efi/efi_snp.c b/src/interface/efi/efi_snp.c
index 00830343..b5241e54 100644
--- a/src/interface/efi/efi_snp.c
+++ b/src/interface/efi/efi_snp.c
@@ -119,10 +119,11 @@ static EFI_GUID efi_pci_io_protocol_guid
static void efi_snp_set_mode ( struct efi_snp_device *snpdev ) {
struct net_device *netdev = snpdev->netdev;
EFI_SIMPLE_NETWORK_MODE *mode = &snpdev->mode;
- unsigned int ll_addr_len = netdev->ll_protocol->ll_addr_len;
+ struct ll_protocol *ll_protocol = netdev->ll_protocol;
+ unsigned int ll_addr_len = ll_protocol->ll_addr_len;
mode->HwAddressSize = ll_addr_len;
- mode->MediaHeaderSize = netdev->ll_protocol->ll_header_len;
+ mode->MediaHeaderSize = ll_protocol->ll_header_len;
mode->MaxPacketSize = netdev->max_pkt_len;
mode->ReceiveFilterMask = ( EFI_SIMPLE_NETWORK_RECEIVE_UNICAST |
EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST |
@@ -130,8 +131,8 @@ static void efi_snp_set_mode ( struct efi_snp_device *snpdev ) {
assert ( ll_addr_len <= sizeof ( mode->CurrentAddress ) );
memcpy ( &mode->CurrentAddress, netdev->ll_addr, ll_addr_len );
memcpy ( &mode->BroadcastAddress, netdev->ll_broadcast, ll_addr_len );
- memcpy ( &mode->PermanentAddress, netdev->hw_addr, ll_addr_len );
- mode->IfType = ntohs ( netdev->ll_protocol->ll_proto );
+ ll_protocol->init_addr ( netdev->hw_addr, &mode->PermanentAddress );
+ mode->IfType = ntohs ( ll_protocol->ll_proto );
mode->MacAddressChangeable = TRUE;
mode->MediaPresentSupported = TRUE;
mode->MediaPresent = ( netdev_link_ok ( netdev ) ? TRUE : FALSE );