Skip to content

consolidate sysfs access

Stephen Hemminger dpdk-dev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 6 repliesIn review
  2. v29 patches 1 replySuperseded
  3. v19 patches 0 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9eal: add common sysfs value routinesapp/test/test_eal_fs.c drivers/bus/auxiliary/linux/auxiliary.c drivers/bus/cdx/cdx.c +15 more+503 -2140 replies
2/9dma/idxd: use common sysfs routinesdrivers/dma/idxd/idxd_bus.c+12 -680 replies
3/9common/ionic: use common sysfs routinesdrivers/common/ionic/ionic_common_uio.c+51 -510 replies
4/9bus/vmbus: use common sysfs routinesdrivers/bus/vmbus/linux/vmbus_uio.c+5 -191 reply
5/9power: use common sysfs routinesdrivers/power/acpi/acpi_cpufreq.c drivers/power/amd_pstate/amd_pstate_cpufreq.c drivers/power/cppc/cppc_cpufreq.c +5 more+87 -2840 replies
6/9drivers/bus: remove duplicate sysfs string helpersdrivers/bus/platform/platform.c drivers/bus/vmbus/linux/vmbus_bus.c+8 -640 replies
7/9common/mlx5: use common sysfs routinesdrivers/common/mlx5/linux/mlx5_common_os.c+14 -250 replies
8/9net/mlx5: use common sysfs routinesdrivers/net/mlx5/linux/mlx5_ethdev_os.c drivers/net/mlx5/linux/mlx5_os.c+10 -200 replies
9/9net/mana: use common sysfs routinesdrivers/net/mana/mana.c+4 -100 replies

Reviews trailers per patch

1 of 9 patches has a Reviewed-by or Acked-by.

PatchBruce RichardsonWei Hu
SeriesSeries-acked-by
1/9
2/9
3/9
4/9R-b
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/9] consolidate sysfs access

After reviewing lots of drivers and seeing sloppy string handling resorted to AI assistance to unify and consolidate the parsing of sysfs values. Many drivers open code this with similar pattern but lacked any coherent error handling. The kernel API is consistent and won't give bad data, but it make sense to check for garbage.

Add one set of routines in EAL that build the path from a printf style format and convert with strtoul()/strtol(), then convert the existing callers.

Since the new routines are Linux only, a driver that uses sysfs while advertising support on FreeBSD or Windows now fails to link. Two such cases turned up and are fixed here: the eal_fs test and common/ionic.

Note: existing eal_parse_sysfs_value() goes away with this. It was exported as a stable symbol, which was a mistake:
the eal_ prefix and the private eal_filesystem.h both say it is internal, and nothing outside the tree should have been calling it.
The new rte_sysfs_parse_XXX routines are exported, but marked as internal use only.

v3 - fix doxygen comments

Stephen Hemminger (9):
eal: add common sysfs value routines dma/idxd: use common sysfs routines common/ionic: use common sysfs routines bus/vmbus: use common sysfs routines
power: use common sysfs routines drivers/bus: remove duplicate sysfs string helpers common/mlx5: use common sysfs routines net/mlx5: use common sysfs routines net/mana: use common sysfs routines

 app/test/test_eal_fs.c                        | 148 ++++++++++----
 drivers/bus/auxiliary/linux/auxiliary.c       |  13 +-
 drivers/bus/cdx/cdx.c                         |   7 +-
 drivers/bus/pci/linux/pci.c                   |  44 ++--
 drivers/bus/platform/platform.c               |  43 +---
 drivers/bus/vmbus/linux/vmbus_bus.c           |  64 ++----
 drivers/bus/vmbus/linux/vmbus_uio.c           |  24 +--
 drivers/common/cnxk/roc_model.c               |  40 +---
 drivers/common/cnxk/roc_platform.h            |   3 +-
 drivers/common/ionic/ionic_common_uio.c       | 102 +++++-----
 .../common/mlx5/linux/mlx5_common_auxiliary.c |  13 +-
 drivers/common/mlx5/linux/mlx5_common_os.c    |  39 ++--
 drivers/dma/idxd/idxd_bus.c                   |  80 ++------
 drivers/net/af_xdp/rte_eth_af_xdp.c           |  13 +-
 drivers/net/mana/mana.c                       |  14 +-
 drivers/net/mlx5/linux/mlx5_ethdev_os.c       |  17 +-
 drivers/net/mlx5/linux/mlx5_os.c              |  13 +-
 drivers/power/acpi/acpi_cpufreq.c             |  21 +-
 drivers/power/amd_pstate/amd_pstate_cpufreq.c |  63 +-----
 drivers/power/cppc/cppc_cpufreq.c             |  69 +------
 .../power/intel_pstate/intel_pstate_cpufreq.c |  99 ++-------
 drivers/power/intel_uncore/intel_uncore.c     |  32 +--
 lib/eal/common/eal_filesystem.h               |   4 +-
 lib/eal/include/meson.build                   |   1 +
 lib/eal/include/rte_sysfs.h                   | 125 ++++++++++++
 lib/eal/linux/eal_hugepage_info.c             |  33 +--
 lib/eal/linux/eal_lcore.c                     |  18 +-
 lib/eal/linux/eal_sysfs.c                     | 188 ++++++++++++++++++
 lib/eal/linux/meson.build                     |   1 +
 lib/eal/unix/eal_filesystem.c                 |  31 ---
 lib/power/power_common.c                      |  52 +++--
 lib/power/power_common.h                      |   6 +
 lib/power/rte_power_qos.c                     |  29 +--
 33 files changed, 694 insertions(+), 755 deletions(-)
 create mode 100644 lib/eal/include/rte_sysfs.h
 create mode 100644 lib/eal/linux/eal_sysfs.c
Signature · 1 line
2.53.0