mbox series

[net-next,v4,0/8] devlink: add device (driver) information API

Message ID 20190131185047.27685-1-jakub.kicinski@netronome.com
Headers show
Series devlink: add device (driver) information API | expand

Message

Jakub Kicinski Jan. 31, 2019, 6:50 p.m. UTC
Hi!

fw_version field in ethtool -i does not suit modern needs with 31
characters being quite limiting on more complex systems.  There is
also no distinction between the running and flashed versions of
the firmware.

Since the driver information pertains to the entire device, rather
than a particular netdev, it seems wise to move it do devlink, at
the same time fixing the aforementioned issues.

The new API allows exposing the device serial number and versions
of the components of the card - both hardware, firmware (running
and flashed).  Driver authors can choose descriptive identifiers
for the version fields.  A few version identifiers which seemed
relevant for most devices have been added to the global devlink
header.

Example:
$ devlink dev info pci/0000:05:00.0
pci/0000:05:00.0:
  driver nfp
  serial_number 16240145
  versions:
    fixed:
      board.id AMDA0099-0001
      board.rev 07
      board.vendor SMA
      board.model carbon
    running:
      fw.mgmt: 010156.010156.010156
      fw.cpld: 0x44
      fw.app: sriov-2.1.16
    stored:
      fw.mgmt: 010158.010158.010158
      fw.cpld: 0x44
      fw.app: sriov-2.1.20

Last patch also includes a compat code for ethtool.  If driver
reports no fw_version via the traditional ethtool API, ethtool
can call into devlink and try to cram as many versions as possible
into the 31 characters.

v4:
 - use IS_REACHABLE instead of IS_ENABLED in last patch.

v3 (Jiri):
 - rename various functions and attributes;
 - break out the version helpers per-type;
 - make the compat code parse a dump instead of special casing
   in each helper;
 - move generic version defines to a separate patch.
 
v2:
 - rebase.

this non-RFC, v3 some would say:
 - add three more versions in the NFP patches;
 - add last patch (ethool compat) - Andrew & Michal.

RFCv2:
 - use one driver op;
 - allow longer serial number;
 - wrap the skb into an opaque request struct;
 - add some common identifier into the devlink header.

Jakub Kicinski (8):
  devlink: add device information API
  devlink: add version reporting to devlink info API
  devlink: add generic info version names
  nfp: devlink: report driver name and serial number
  nfp: devlink: report fixed versions
  nfp: nsp: add support for versions command
  nfp: devlink: report the running and flashed versions
  ethtool: add compat for devlink info

 .../networking/devlink-info-versions.rst      |  38 +++
 Documentation/networking/index.rst            |   1 +
 .../net/ethernet/netronome/nfp/nfp_devlink.c  | 145 +++++++++++
 .../ethernet/netronome/nfp/nfpcore/nfp_nsp.c  |  61 +++++
 .../ethernet/netronome/nfp/nfpcore/nfp_nsp.h  |  20 ++
 include/net/devlink.h                         |  75 ++++++
 include/uapi/linux/devlink.h                  |  10 +
 net/core/devlink.c                            | 232 ++++++++++++++++++
 net/core/ethtool.c                            |   7 +
 9 files changed, 589 insertions(+)
 create mode 100644 Documentation/networking/devlink-info-versions.rst

Comments

David Miller Feb. 1, 2019, 11:36 p.m. UTC | #1
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Thu, 31 Jan 2019 10:50:39 -0800

> fw_version field in ethtool -i does not suit modern needs with 31
> characters being quite limiting on more complex systems.  There is
> also no distinction between the running and flashed versions of
> the firmware.
> 
> Since the driver information pertains to the entire device, rather
> than a particular netdev, it seems wise to move it do devlink, at
> the same time fixing the aforementioned issues.
> 
> The new API allows exposing the device serial number and versions
> of the components of the card - both hardware, firmware (running
> and flashed).  Driver authors can choose descriptive identifiers
> for the version fields.  A few version identifiers which seemed
> relevant for most devices have been added to the global devlink
> header.
> 
> Example:
 ...
> Last patch also includes a compat code for ethtool.  If driver
> reports no fw_version via the traditional ethtool API, ethtool
> can call into devlink and try to cram as many versions as possible
> into the 31 characters.
 ...

Series applied.