[netdevice] Separate out the concept of hardware and link-layer addresses

The hardware address is an intrinsic property of the hardware, while
the link-layer address can be changed at runtime.  This separation is
exposed via APIs such as PXE and EFI, but is currently elided by gPXE.

Expose the hardware and link-layer addresses as separate properties
within a net device.  Drivers should now fill in hw_addr, which will
be used to initialise ll_addr at the time of calling
register_netdev().
This commit is contained in:
Michael Brown
2009-08-11 20:19:53 +01:00
parent b3db99a38d
commit 37a0aab4ff
22 changed files with 71 additions and 82 deletions

View File

@@ -254,9 +254,16 @@ struct net_device {
/** Link-layer protocol */
struct ll_protocol *ll_protocol;
/** Hardware address
*
* This is an address which is an intrinsic property of the
* hardware, e.g. an address held in EEPROM.
*/
uint8_t hw_addr[MAX_LL_ADDR_LEN];
/** Link-layer address
*
* For Ethernet, this is the MAC address.
* This is the current link-layer address assigned to the
* device. It can be changed at runtime.
*/
uint8_t ll_addr[MAX_LL_ADDR_LEN];
/** Link-layer broadcast address */
@@ -337,12 +344,12 @@ static inline void netdev_nullify ( struct net_device *netdev ) {
}
/**
* Get printable network device hardware address
* Get printable network device link-layer address
*
* @v netdev Network device
* @ret name Hardware address
* @ret name Link-layer address
*/
static inline const char * netdev_hwaddr ( struct net_device *netdev ) {
static inline const char * netdev_addr ( struct net_device *netdev ) {
return netdev->ll_protocol->ntoa ( netdev->ll_addr );
}