mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[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:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user