OSDN Git Service

net: mvpp2: Consider NVMEM cells as possible MAC address source
authorMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 24 Nov 2022 11:15:56 +0000 (12:15 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 29 Nov 2022 09:45:54 +0000 (10:45 +0100)
commit7a74c1265ab4340b0fd5223084151003ef4c394a
tree6ee34dba450f4bbfbb37ee524a394ee2f2b04747
parenta48acad789ff33d90e079311ed0323e5e5fc5cbd
net: mvpp2: Consider NVMEM cells as possible MAC address source

The ONIE standard describes the organization of tlv (type-length-value)
arrays commonly stored within NVMEM devices on common networking
hardware.

Several drivers already make use of NVMEM cells for purposes like
retrieving a default MAC address provided by the manufacturer.

What made ONIE tables unusable so far was the fact that the information
where "dynamically" located within the table depending on the
manufacturer wishes, while Linux NVMEM support only allowed statically
defined NVMEM cells. Fortunately, this limitation was eventually tackled
with the introduction of discoverable cells through the use of NVMEM
layouts, making it possible to extract and consistently use the content
of tables like ONIE's tlv arrays.

Parsing this table at runtime in order to get various information is now
possible. So, because many Marvell networking switches already follow
this standard, let's consider using NVMEM cells as a new valid source of
information when looking for a base MAC address, which is one of the
primary uses of these new fields. Indeed, manufacturers following the
ONIE standard are encouraged to provide a default MAC address there, so
let's eventually use it if no other MAC address has been found using the
existing methods.

Link: https://opencomputeproject.github.io/onie/design-spec/hw_requirements.html
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c