net: pse-pd: Add support for budget evaluation strategies

This patch introduces the ability to configure the PSE PI budget evaluation
strategies. Budget evaluation strategies is utilized by PSE controllers to
determine which ports to turn off first in scenarios such as power budget
exceedance.

The pis_prio_max value is used to define the maximum priority level
supported by the controller. Both the current priority and the maximum
priority are exposed to the user through the pse_ethtool_get_status call.

This patch add support for two mode of budget evaluation strategies.
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.

   Priority max value is matching the number of PSE PIs within the PSE.

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.

   Priority max value is set by the PSE controller driver.

For now, budget evaluation methods are not configurable and cannot be
mixed. They are hardcoded in the PSE driver itself, as no current PSE
controller supports both methods.

Signed-off-by: Kory Maincent (Dent Project) <kory.maincent@bootlin.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20250617-feature_poe_port_prio-v14-7-78a1a645e2ee@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Kory Maincent (Dent Project)
2025-06-17 14:12:06 +02:00
committed by Jakub Kicinski
parent c394e757de
commit ffef61d6d2
4 changed files with 816 additions and 41 deletions

View File

@@ -122,13 +122,39 @@ definitions:
name: pse-event
doc: PSE event list for the PSE controller
type: flags
name-prefix: ethtool-
entries:
-
name: over-current
name: pse-event-over-current
doc: PSE output current is too high
-
name: over-temp
name: pse-event-over-temp
doc: PSE in over temperature state
-
name: c33-pse-event-detection
doc: |
detection process occur on the PSE. IEEE 802.3-2022 33.2.5 and
145.2.6 PSE detection of PDs. IEEE 802.3-202 30.9.1.1.5
aPSEPowerDetectionStatus
-
name: c33-pse-event-classification
doc: |
classification process occur on the PSE. IEEE 802.3-2022 33.2.6
and 145.2.8 classification of PDs mutual identification.
IEEE 802.3-2022 30.9.1.1.8 aPSEPowerClassification.
-
name: c33-pse-event-disconnection
doc: |
PD has been disconnected on the PSE. IEEE 802.3-2022 33.3.8
and 145.3.9 PD Maintain Power Signature. IEEE 802.3-2022
33.5.1.2.9 MPS Absent. IEEE 802.3-2022 30.9.1.1.20
aPSEMPSAbsentCounter.
-
name: pse-event-over-budget
doc: PSE turned off due to over budget situation
-
name: pse-event-sw-pw-control-error
doc: PSE faced an error managing the power control from software
attribute-sets:
-