Add initial devlink support for idpf and a matching selftest.
Patch 1 consolidates the drvdata clear into idpf_decfg_device(), the
declared inverse of idpf_cfg_device() which sets it.
Patch 2 adds the devlink instance. It is registered once the virtchnl
handshake has completed rather than from idpf_probe(), so the instance
is not exposed to userspace while the adapter is still coming up.
Patch 3 implements .info_get and reports:
- serial_number: PCI Device Serial Number, for NIPA CI identification
- fw.mgmt.api (running): driver-device communication protocol version
This follows a phased approach and reports stable, readily-available
information. Firmware version support will be added in future patches as
it becomes available through virtchnl.
Patch 4 adds a hardware selftest that logs devlink info in the format
NIPA CI consumes.
v1 -> v2:
- Patch 1:
- Reworked: instead of adding a second, redundant pci_set_drvdata(NULL)
at idpf_probe()'s err_free label, move the clear into
idpf_decfg_device() so it pairs with the set in idpf_cfg_device(),
and drop the now-redundant explicit clear in idpf_remove().
- Patch 2 (new, split out of the old patch 2):
- Register the devlink instance from idpf_init_hard_reset() once
idpf_vc_core_init() has succeeded, instead of from idpf_probe().
Registration is guarded by IDPF_DEVLINK_REGISTERED since
idpf_init_hard_reset() also runs on every function and PCI reset.
- Unregister only after the init/reset worker is quiesced, and only if
registration actually happened.
- Patch 3:
- Select NET_DEVLINK in Kconfig.
- Omit serial_number when the device reports no PCI DSN, instead of
reporting an all-zero serial number.
- Pass the buffer size to the DSN helper rather than hardcoding it.
- The version guard is no longer needed now that the instance is only
registered after the virtchnl handshake has completed.
- Patch 4:
- Read NETIF from drivers/net/net.config as documented in
drivers/net/README.rst, in addition to the environment.
- Skip, rather than fail, devices that report no versions and no serial
number; implementing devlink info is optional and devlink reports a
driver name even when info_get is absent.
- Count and log board.serial_number.
- Treat a devlink/ethtool driver name difference as informational; it
is legitimate for e.g. mlx4 and DSA user ports.
- Do not require ethtool; it is only used for an optional fallback
handle lookup and the driver name comparison.
- Query devlink dev info once and validate a single snapshot.
- Log the reported versions.
Paul Greenwalt (4):
idpf: clear drvdata in idpf_decfg_device()
idpf: add devlink support
idpf: add devlink info support
selftests: net: hw: add devlink info test
Documentation/networking/devlink/idpf.rst | 30 ++++
Documentation/networking/devlink/index.rst | 1 +
drivers/net/ethernet/intel/idpf/Kconfig | 1 +
drivers/net/ethernet/intel/idpf/Makefile | 1 +
drivers/net/ethernet/intel/idpf/idpf.h | 4 +-
.../net/ethernet/intel/idpf/idpf_devlink.c | 94 ++++++++++
.../net/ethernet/intel/idpf/idpf_devlink.h | 45 +++++
drivers/net/ethernet/intel/idpf/idpf_lib.c | 8 +
drivers/net/ethernet/intel/idpf/idpf_main.c | 19 ++-
.../testing/selftests/drivers/net/hw/Makefile | 1 +
.../selftests/drivers/net/hw/devlink_info.sh | 160 ++++++++++++++++++
11 files changed, 359 insertions(+), 5 deletions(-)
create mode 100644 Documentation/networking/devlink/idpf.rst
create mode 100644 drivers/net/ethernet/intel/idpf/idpf_devlink.c
create mode 100644 drivers/net/ethernet/intel/idpf/idpf_devlink.h
create mode 100755 tools/testing/selftests/drivers/net/hw/devlink_info.sh
--
2.52.0