All of lore.kernel.org
 help / color / mirror / Atom feed
* Assigning MAC addrs to PCI based NIC's
@ 2020-07-17 15:58 Tim Harvey
  2020-07-17 17:08 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Harvey @ 2020-07-17 15:58 UTC (permalink / raw)
  To: netdev

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?

Best regards,

Tim

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Assigning MAC addrs to PCI based NIC's
  2020-07-17 15:58 Assigning MAC addrs to PCI based NIC's Tim Harvey
@ 2020-07-17 17:08 ` Andrew Lunn
  2020-07-17 22:04   ` Tim Harvey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2020-07-17 17:08 UTC (permalink / raw)
  To: Tim Harvey; +Cc: netdev

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Assigning MAC addrs to PCI based NIC's
  2020-07-17 17:08 ` Andrew Lunn
@ 2020-07-17 22:04   ` Tim Harvey
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Harvey @ 2020-07-17 22:04 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

On Fri, Jul 17, 2020 at 10:08 AM Andrew Lunn <andrew@lunn.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-17 22:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 15:58 Assigning MAC addrs to PCI based NIC's Tim Harvey
2020-07-17 17:08 ` Andrew Lunn
2020-07-17 22:04   ` Tim Harvey

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.