public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Kyle Swenson <kyle.swenson@est.tech>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Donald Hunter <donald.hunter@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Dent Project <dentproject@linuxfoundation.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: [PATCH net-next 00/12] Add support for PSE port priority
Date: Fri, 18 Oct 2024 14:37:06 +0200	[thread overview]
Message-ID: <20241018143706.33d49872@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <ZxH8wpm_kptHBFQG@pengutronix.de>

On Fri, 18 Oct 2024 08:14:26 +0200
Oleksij Rempel <o.rempel@pengutronix.de> wrote:

> On Thu, Oct 17, 2024 at 12:35:57PM +0200, Kory Maincent wrote:
> > On Tue, 15 Oct 2024 11:43:52 +0200
> > Kory Maincent <kory.maincent@bootlin.com> wrote:
> >   
>  [...]  
> > > 
> > > Indeed we will have only static method for PSE controllers not supporting
> > > system power budget management like the TPS2388x or LTC426.
> > > Both method could be supported for "smart" PSE controller like PD692x0.
> > > 
> > > Let's begin with the static method implementation in the PSE framework for
> > > now. It will need the power domain notion you have talked about.  
> > 
> > While developing the software support for port priority in static method, I
> > faced an issue.
> > 
> > Supposing we are exceeding the power budget when we plug a new PD.
> > The port power should not be enabled directly or magic smoke will appear.
> > So we have to separate the detection part to know the needs of the PD from
> > the power enable part.
> > 
> > Currently the port power is enabled on the hardware automatically after the
> > detection process. There is no way to separate power port process and
> > detection process with the PD692x0 controller and it could be done on the
> > TPS23881 by configuring it to manual mode but: "The use of this mode is
> > intended for system diagnostic purposes only in the event that ports cannot
> > be powered in accordance with the IEEE 802.3bt standard from semiauto or
> > auto modes." Not sure we want that.
> > 
> > So in fact the workaround you talked about above will be needed for the two
> > PSE controllers.  
> 
> For the TPS23881, "9.1.1.2 Semiauto", seems to be exactly what we wont:
> "The port performs detection and classification (if valid detection
> occurs) continuously. Registers are updated each time a detection or
> classification occurs. The port power is not automatically turned on. A
> Power Enable command is required to turn on the port"

I tested reading the assigned class and not the requested class register so I
thought it was not working but indeed it detects the class even if the port
power is off. That's what I was looking for, nice!
Just figured out also that calling pwoff is reseting detection, classification,
power policy... So the port need to be setup again after a pwoff.
 
> For PD692x0 controller, i'm not 100% sure. There is "4.3.5 Set Enable/Disable
> Channels" command, "Sets individual port Enable (Delivering power
> enable) or Disable (Delivering power disable)." 
> 
> For my understanding, "Delivering power" is the state after
> classification. So, it is what we wont too.

On the PD692x0 there is also a requested class and power value but it stay "to
no class detected value" (0xc) if the port is not enabled.
It did not find a way to detect the class and keep port power off.
 
> If, it works in both cases, it would be a more elegant way to go. THe
> controller do auto- detection and classification, what we should do in
> the software is do decide if the PD can be enabled based on
> classification results, priority and available budget.
> 
> > > Both methods have their pros and cons. Since the dynamic method is not
> > > always desirable, and if there's no way to disable it in the PD692x0's
> > > firmware, one potential workaround could be handling the budget in
> > > software and dynamically setting per-port limits. For instance, with a
> > > total budget of 300W and unused ports, we could initially set 95W limits
> > > per port. As high-priority PDs (e.g., three 95W devices) are powered, we
> > > could dynamically reduce the power limit on the remaining ports to 15W,
> > > ensuring that no device exceeds that classification threshold.  
> > 
> > We would set port overcurrent limit for all unpowered ports when the power
> > budget available is less than max PI power 100W as you described.
> > If a new PD plugged exceed the overcurrent limit then it will raise an
> > interrupt and we could deal with the power budget to turn off low priority
> > ports at that time.   
> 
> > Mmh in fact I could not know if the overcurrent event interrupt comes from a
> > newly plugged PD or not.  
> 
> Hm..  in case of PD692x0, may be using event counters?

Counters? I don't see how.

> > An option: When we get new PD device plug interrupt event, we wait the end
> > of classification time (Tpon 400ms) and read the interrupt states again to
> > know if there is an overcurrent or not on the port.  
> 
> Let's try Semiauto mode for TPS23881 first, I assume it is designed
> exactly for this use case.

Yes,

> And then, test if PD692x0 supports a way to disable auto power delivery
> in the 4.3.5 command.

I don't have this 4.3.5 command. Are you refering to another document than the
communication protocol version 3.55 document?

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

      reply	other threads:[~2024-10-18 12:37 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-02 16:27 [PATCH net-next 00/12] Add support for PSE port priority Kory Maincent
2024-10-02 16:27 ` [PATCH net-next 01/12] net: pse-pd: Remove unused pse_ethtool_get_pw_limit function declaration Kory Maincent
2024-10-02 23:24   ` Andrew Lunn
2024-10-03  3:25   ` Kalesh Anakkur Purayil
2024-10-09  4:37   ` Oleksij Rempel
2024-10-02 16:27 ` [PATCH net-next 02/12] net: pse-pd: tps23881: Correct boolean evaluation for bitmask checks Kory Maincent
2024-10-02 16:27 ` [PATCH net-next 03/12] net: pse-pd: tps23881: Simplify function returns by removing redundant checks Kory Maincent
2024-10-02 23:26   ` Andrew Lunn
2024-10-09  4:38   ` Oleksij Rempel
2024-10-02 16:28 ` [PATCH net-next 04/12] net: pse-pd: tps23881: Add support for power limit and measurement features Kory Maincent
2024-10-02 23:31   ` Andrew Lunn
2024-10-09  5:02   ` Oleksij Rempel
2024-10-09  9:05     ` Kory Maincent
2024-10-09 15:16       ` Oleksij Rempel
2024-10-09 16:17         ` Kory Maincent
2024-10-02 16:28 ` [PATCH net-next 05/12] net: pse-pd: Add support for getting and setting port priority Kory Maincent
2024-10-02 23:34   ` Andrew Lunn
2024-10-09  5:04   ` Oleksij Rempel
2024-10-02 16:28 ` [PATCH net-next 06/12] net: ethtool: Add PSE new port priority support feature Kory Maincent
2024-10-02 23:37   ` Andrew Lunn
2024-10-05  6:26   ` Oleksij Rempel
2024-10-07  9:30     ` Kory Maincent
2024-10-07 14:10       ` Oleksij Rempel
2024-10-08 10:23         ` Kory Maincent
2024-10-08 12:56           ` Kory Maincent
2024-10-08 15:01             ` Oleksij Rempel
2024-10-08 16:31   ` Oleksij Rempel
2024-10-02 16:28 ` [PATCH net-next 07/12] netlink: specs: Expand the PSE netlink command with C33 prio attributes Kory Maincent
2024-10-04 10:44   ` Donald Hunter
2024-10-02 16:28 ` [PATCH net-next 08/12] net: pse-pd: pd692x0: Add support for PSE PI priority feature Kory Maincent
2024-10-02 23:41   ` Andrew Lunn
2024-10-03  8:01     ` Kory Maincent
2024-10-08 13:57     ` Oleksij Rempel
2024-10-08 14:21       ` Kory Maincent
2024-10-08 14:53         ` Oleksij Rempel
2024-10-08 16:50       ` Andrew Lunn
2024-10-09  7:16         ` Oleksij Rempel
2024-10-09 16:09           ` Andrew Lunn
2024-10-02 16:28 ` [PATCH net-next 09/12] net: pse-pd: tps23881: " Kory Maincent
2024-10-02 23:42   ` Andrew Lunn
2024-10-08 16:26   ` Oleksij Rempel
2024-10-02 16:28 ` [PATCH net-next 10/12] net: pse-pd: Register regulator even for undescribed PSE PIs Kory Maincent
2024-10-02 23:46   ` Andrew Lunn
2024-10-03  8:19     ` Kory Maincent
2024-10-02 16:28 ` [PATCH net-next 11/12] net: pse-pd: Add support for event reporting using devm_regulator_irq_helper Kory Maincent
2024-10-02 23:52   ` Andrew Lunn
2024-10-03  8:28     ` Kory Maincent
2024-10-03 12:56       ` Andrew Lunn
2024-10-03 13:33         ` Kory Maincent
2024-10-03 15:22           ` Andrew Lunn
2024-10-04 13:56             ` Oleksij Rempel
2024-10-04 14:02               ` Oleksij Rempel
2024-10-04 14:10                 ` Kory Maincent
2024-10-03  0:02   ` Andrew Lunn
2024-10-02 16:28 ` [PATCH net-next 12/12] net: pse-pd: tps23881: Add support for PSE events and interrupts Kory Maincent
2024-10-02 23:57   ` Andrew Lunn
2024-10-03  8:29     ` Kory Maincent
2024-10-08 17:03   ` Oleksij Rempel
2024-10-09  7:25   ` Oleksij Rempel
2024-10-09  8:25     ` Kory Maincent
2024-10-09 13:54 ` [PATCH net-next 00/12] Add support for PSE port priority Kyle Swenson
2024-10-09 15:04   ` Kory Maincent
2024-10-09 17:42     ` Kyle Swenson
2024-10-10  5:42       ` Oleksij Rempel
2024-10-15  9:43         ` Kory Maincent
2024-10-17 10:35           ` Kory Maincent
2024-10-18  6:14             ` Oleksij Rempel
2024-10-18 12:37               ` Kory Maincent [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241018143706.33d49872@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dentproject@linuxfoundation.org \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=kyle.swenson@est.tech \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox