diff options
author | Michael Brown | 2009-08-12 00:40:27 +0200 |
---|---|---|
committer | Michael Brown | 2009-08-12 01:23:38 +0200 |
commit | 4eab5bc8ca6b66dc965cf188dd4577ad19c5b879 (patch) | |
tree | 840f354a2f0efa010368118729e8f16315abc1c4 /src/include/gpxe/netdevice.h | |
parent | [netdevice] Separate out the concept of hardware and link-layer addresses (diff) | |
download | ipxe-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/include/gpxe/netdevice.h')
-rw-r--r-- | src/include/gpxe/netdevice.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h index 5ac2f629..fd77d893 100644 --- a/src/include/gpxe/netdevice.h +++ b/src/include/gpxe/netdevice.h @@ -21,6 +21,12 @@ struct net_protocol; struct ll_protocol; struct device; +/** Maximum length of a hardware address + * + * The longest currently-supported link-layer address is for IPoIB. + */ +#define MAX_HW_ADDR_LEN 8 + /** Maximum length of a link-layer address * * The longest currently-supported link-layer address is for IPoIB. @@ -113,6 +119,13 @@ struct ll_protocol { const void **ll_dest, const void **ll_source, uint16_t *net_proto ); /** + * Initialise link-layer address + * + * @v hw_addr Hardware address + * @v ll_addr Link-layer address to fill in + */ + void ( * init_addr ) ( const void *hw_addr, void *ll_addr ); + /** * Transcribe link-layer address * * @v ll_addr Link-layer address @@ -124,7 +137,7 @@ struct ll_protocol { * The buffer used to hold the transcription is statically * allocated. */ - const char * ( * ntoa ) ( const void * ll_addr ); + const char * ( * ntoa ) ( const void *ll_addr ); /** * Hash multicast address * @@ -140,6 +153,8 @@ struct ll_protocol { * This is an ARPHRD_XXX constant, in network byte order. */ uint16_t ll_proto; + /** Hardware address length */ + uint8_t hw_addr_len; /** Link-layer address length */ uint8_t ll_addr_len; /** Link-layer header length */ @@ -258,8 +273,11 @@ struct net_device { * * This is an address which is an intrinsic property of the * hardware, e.g. an address held in EEPROM. + * + * Note that the hardware address may not be the same length + * as the link-layer address. */ - uint8_t hw_addr[MAX_LL_ADDR_LEN]; + uint8_t hw_addr[MAX_HW_ADDR_LEN]; /** Link-layer address * * This is the current link-layer address assigned to the |