[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJ+vNU0vyUnatC0Lkjw8yFCsZT+GJV+cqPeUfN0=-LDat5_AWg@mail.gmail.com>
Date: Fri, 17 Jul 2020 15:04:19 -0700
From: Tim Harvey <tharvey@...eworks.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev <netdev@...r.kernel.org>
Subject: Re: Assigning MAC addrs to PCI based NIC's
On Fri, Jul 17, 2020 at 10:08 AM Andrew Lunn <andrew@...n.ch> wrote:
>
> On Fri, Jul 17, 2020 at 08:58:26AM -0700, Tim Harvey wrote:
> > Greetings,
> >
> > We make embedded boards that often have on-board PCIe based NIC's that
> > have MAC addresses stored in an EEPROM (not within NIC's NVRAM). I've
> > struggled with a way to have boot firmware assign the mac's via
> > device-tree and I find that only some drivers support getting the MAC
> > from device-tree anyway.
> >
> > What is the appropriate way to assign vendor MAC's to a NIC from boot
> > firmware, or even in userspace?
>
> Hi Tim
>
> From user space you can always use
>
> ip link set address XX:XX:XX:XX:XX:XX dev enp42s0
>
> But that assumes the MAC driver actually supports setting its MAC
> address. As with getting the MAC address from DT, this is also
> optional in the driver. But i guess it is more often implemented.
>
> I don't know of any universal method. So i think you probably do need
> to work on each of the MAC drivers you are interested in, and add DT
> support.
>
Andrew,
Doing it from device-tree becomes very complicated for example in the
case where a NIC is behind a on-board switch and the PCI bus topology
changes if an add-in card on a port before the NIC ends up having a
switch on it (as the NIC's bus/device changes). Such a situation
requires that boot firmware enumerates the PCI bus and rebuild's the
nested topology to properly place/update the 'local-mac-address'
property.
I realize in userspace you can use 'ip' to set a hwaddr I'm just not
clear if there is a common pattern like a udev hook or something that
helps assign MAC addr that might be present in a common location.
Maybe the norm is to skip assigning board vendor mac's and let the
drivers choose a random addr?
Tim
Powered by blists - more mailing lists