[ipxe-devel] [PATCH 2/3] igbvf: Assign random MAC address if none is set
Michael Brown
mcb30 at ipxe.org
Mon Jun 2 19:50:50 UTC 2014
On 02/06/14 07:02, Hannes Reinecke wrote:
> On 06/02/2014 12:36 AM, Michael Brown wrote:
>>
>> + if ( is_valid_ether_addr( netdev->hw_addr )) {
>> + memcpy ( adapter->hw.mac.addr, netdev->hw_addr, ETH_ALEN);
>> + }
>> +
>> mac->ops.init_hw ( hw );
>>
>> if ( is_valid_ether_addr(adapter->hw.mac.addr) ) {
>>
>> What does this code do?
>>
> Well, in theory it should be possible to change the mac address via
> commands; the doc says something like
>
> ifclose net0
> set net0/mac XXX
> ifopen net0
OK, understood. The expected data flow is:
- the probe() function fills in netdev->hw_addr
- when the probe function calls register_netdev(), the contents of
netdev->hw_addr are used to populate netdev->ll_addr
- netdev->ll_addr is exposed as ${net0/mac}, and can be updated while
the network device is closed via iPXE commands
- when the network device is opened, the open() function should program
the receiver with the current MAC address taken from netdev->ll_addr.
Therefore:
- netdev->hw_addr holds the "hardware address" (i.e. the address
retrieved from the EEPROM or equivalent). The driver's probe() function
should fill in this address before calling register_netdev().
- netdev->ll_addr holds the current link-layer address. The driver's
open() function should apply this address to the NIC.
Michael
More information about the ipxe-devel
mailing list