[ipxe-devel] [PATCH 2/3] igbvf: Assign random MAC address if none is set
Hannes Reinecke
hare at suse.de
Mon Jun 2 06:02:37 UTC 2014
On 06/02/2014 12:36 AM, Michael Brown wrote:
> On 30/05/14 15:19, Hannes Reinecke wrote:
>>> This is something which is probably generic enough to justify a
>>> function such as eth_random_addr() in net/ethernet.c. Would you be
>>> willing to reimplement your patch in that way (and without the
>>> current whitespace-only changes)?
>>>
>> Updated patch attached.
>
> Thanks! I've pushed the generic parts:
>
> http://git.ipxe.org/ipxe.git/commitdiff/d630052
>
> but there is one part of the igbvf driver change which I don't
> understand:
>
> if ( mac->ops.reset_hw(hw) )
> DBG ("PF still resetting\n");
>
> + 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
When doing so the new mac address should land in hw_addr
and the above line should copy it back into the adapter
structure.
In theory. Not that I've tested it myself.
Nor am I entirely clear _where_ the new mac address will end up if
being set via the above commandline.
But I'm fairly certain we need to copy it into the adapter structure
at one point :-)
Can you shed some light here?
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare at suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
More information about the ipxe-devel
mailing list