From: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
This series brings support for port priority in the PSE subsystem.
PSE controllers can set priorities to decide which ports should be
turned off in case of special events like over-current.
I have added regulator maintainers to have their opinion on adding power
budget regulator constraint see patches 11 and 12.
This patch series adds support for two mode port priority modes.
1. Static Method:
This method involves distributing power based on PD classification.
It’s straightforward and stable, the PSE core keeping track of the
budget and subtracting the power requested by each PD’s class.
Advantages: Every PD gets its promised power at any time, which
guarantees reliability.
Disadvantages: PD classification steps are large, meaning devices
request much more power than they actually need. As a result, the power
supply may only operate at, say, 50% capacity, which is inefficient and
wastes money.
2. Dynamic Method:
To address the inefficiencies of the static method, vendors like
Microchip have introduced dynamic power budgeting, as seen in the
PD692x0 firmware. This method monitors the current consumption per port
and subtracts it from the available power budget. When the budget is
exceeded, lower-priority ports are shut down.
Advantages: This method optimizes resource utilization, saving costs.
Disadvantages: Low-priority devices may experience instability.
The UAPI allows adding support for software port priority mode managed from
userspace later if needed.
This patch series is currently untested and still lacks driver-level
support for port priority. I would appreciate your feedback on the current
implementation of port priority in the PSE core before proceeding further.
Several Reviewed-by have been removed due to the changes.
Thanks Oleksij for your pointers.
Patches 1-3: Cosmetics.
Patch 4: Adds support for last supported features in the TPS23881 drivers.
Patches 5,6: Add support for PSE index in PSE core and ethtool.
Patches 7-9: Add support for interrupt event report in PSE core, ethtool
and ethtool specs.
Patch 10: Adds support for interrupt and event report in TPS23881 driver.
Patches 11,12: Add support for power budget in regulator framework.
Patches 13,14: Add support for PSE power domain in PSE core and ethtool.
Patches 15-17: Add support for port priority in PSE core, ethtool and
ethtool specs.
Patches 18: Add support for port priority in PD692x0 drivers.
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
Changes in v2:
- Rethink the port priority management.
- Add PSE id.
- Add support for PSE power domains.
- Add get power budget regulator constraint.
- Link to v1: https://lore.kernel.org/r/20241002-feature_poe_port_prio-v1-0-787054f74ed5@bootlin.com
---
Kory Maincent (18):
net: pse-pd: Remove unused pse_ethtool_get_pw_limit function declaration
net: pse-pd: tps23881: Simplify function returns by removing redundant checks
net: pse-pd: tps23881: Use helpers to calculate bit offset for a channel
net: pse-pd: tps23881: Add support for power limit and measurement features
net: pse-pd: Add support for PSE device index
net: ethtool: Add support for new PSE device index description
net: ethtool: Add support for ethnl_info_init_ntf helper function
net: pse-pd: Add support for reporting events
netlink: specs: Add support for PSE netlink notifications
net: pse-pd: tps23881: Add support for PSE events and interrupts
regulator: Add support for power budget description
regulator: dt-bindings: Add regulator-power-budget property
net: pse-pd: Add support for PSE power domains
net: ethtool: Add support for new power domains index description
net: pse-pd: Add support for getting and setting port priority
net: ethtool: Add PSE new port priority support feature
netlink: specs: Expand the PSE netlink command with newly supported features
net: pse-pd: pd692x0: Add support for PSE PI priority feature
.../devicetree/bindings/regulator/regulator.yaml | 3 +
Documentation/netlink/specs/ethtool.yaml | 53 ++
Documentation/networking/ethtool-netlink.rst | 71 +++
drivers/net/mdio/fwnode_mdio.c | 26 +-
drivers/net/pse-pd/pd692x0.c | 24 +
drivers/net/pse-pd/pse_core.c | 568 ++++++++++++++++++++-
drivers/net/pse-pd/tps23881.c | 529 ++++++++++++++++---
drivers/regulator/core.c | 11 +
drivers/regulator/of_regulator.c | 3 +
include/linux/ethtool_netlink.h | 9 +
include/linux/pse-pd/pse.h | 75 ++-
include/linux/regulator/consumer.h | 6 +
include/linux/regulator/machine.h | 2 +
include/uapi/linux/ethtool.h | 35 ++
include/uapi/linux/ethtool_netlink.h | 17 +
net/ethtool/netlink.c | 5 +
net/ethtool/netlink.h | 2 +
net/ethtool/pse-pd.c | 93 ++++
18 files changed, 1442 insertions(+), 90 deletions(-)
---
base-commit: 982a5437362e09def6c3152a9ec1392b9da16ece
change-id: 20240913-feature_poe_port_prio-a51aed7332ec
Best regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com