Subject: RE: [PATCH v3 3/4] of_net: add mac-address-increment support

From: <[email-masked]>
Date: Fri, 25 Sep 2020 20:39:30 +0200

> -----Original Message-----
> From: Rob Herring <[email-masked]>
> Sent: Friday, September 25, 2020 8:24 PM
> To: Ansuel Smith <[email-masked]>
> Cc: Miquel Raynal <[email-masked]>; Richard Weinberger
> <[email-masked]>; Vignesh Raghavendra <[email-masked]>; David S.
> Miller <[email-masked]>; Jakub Kicinski <[email-masked]>;
> Andrew Lunn <[email-masked]>; Heiner Kallweit
> <[email-masked]>; Russell King <[email-masked]>; Frank
> Rowand <[email-masked]>; Boris Brezillon
> <[email-masked]>; MTD Maling List <[email-masked]>;
> [email-masked]; [email-masked]; netdev
> <[email-masked]>
> Subject: Re: [PATCH v3 3/4] of_net: add mac-address-increment support
> 
> On Sun, Sep 20, 2020 at 3:57 AM Ansuel Smith <[email-masked]>
> wrote:
> >
> > Lots of embedded devices use the mac-address of other interface
> > extracted from nvmem cells and increments it by one or two. Add two
> > bindings to integrate this and directly use the right mac-address for
> > the interface. Some example are some routers that use the gmac
> > mac-address stored in the art partition and increments it by one for the
> > wifi. mac-address-increment-byte bindings is used to tell what byte of
> > the mac-address has to be increased (if not defined the last byte is
> > increased) and mac-address-increment tells how much the byte decided
> > early has to be increased.
> 
> I'm inclined to say if there's a platform specific way to transform
> MAC addresses, then there should be platform specific code to do that
> which then stuffs the DT using standard properties. Otherwise, we have
> a never ending stream of 'generic' properties to try to handle
> different platforms' cases.
> 
> Rob

I agree about the 'never ending stream'... But I think the increment feature
is not that platform specific. I will quote some number by another patch
that tried to implement the same feature in a different way, [1]

* mtd-mac-address                used 497 times in 357 device tree files
* mtd-mac-address-increment      used  74 times in  58 device tree files
* mtd-mac-address-increment-byte used   1 time  in   1 device tree file

The mtd-mac-address is what this patchset is trying to fix with the nvmem
support. The increment is much more than 74 times since it doesn't count
SoC that have wifi integrated (it's common practice for SoC with integrated
wifi to take the switch mac and use it to set the wifi mac)
Actually what is really specific is the increment-byte that can be dropped
if we really want to.
I still think the increment feature would be very useful to add full support
for mac-address extracted from nvmem cell.

[1] https://patchwork.ozlabs.org/project/netdev/patch/[email-masked]/