mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Kory Maincent <kory.maincent@bootlin.com>,
	"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, netdev@vger.kernel.org,
	linux-doc@vger.kernel.org, Kyle Swenson <kyle.swenson@est.tech>,
	Dent Project <dentproject@linuxfoundation.org>,
	kernel@pengutronix.de
Subject: Re: [PATCH net-next 08/12] net: pse-pd: pd692x0: Add support for PSE PI priority feature
Date: Wed, 9 Oct 2024 18:09:32 +0200	[thread overview]
Message-ID: <9e58bfec-c915-4c30-9d75-979a309e3f69@lunn.ch> (raw)
In-Reply-To: <ZwYt0WT-tdOM0Abj@pengutronix.de>

On Wed, Oct 09, 2024 at 09:16:33AM +0200, Oleksij Rempel wrote:
> Hi Andrew,
> 
> On Tue, Oct 08, 2024 at 06:50:25PM +0200, Andrew Lunn wrote:
> > On Tue, Oct 08, 2024 at 03:57:22PM +0200, Oleksij Rempel wrote:
> > > On Thu, Oct 03, 2024 at 01:41:02AM +0200, Andrew Lunn wrote:
> > > > > +	msg = pd692x0_msg_template_list[PD692X0_MSG_SET_PORT_PARAM];
> > > > > +	msg.sub[2] = id;
> > > > > +	/* Controller priority from 1 to 3 */
> > > > > +	msg.data[4] = prio + 1;
> > > > 
> > > > Does 0 have a meaning? It just seems an odd design if it does not.
> > > 
> > > 0 is not documented. But there are sub-priority which are not directly
> > > configured by user, but affect the system behavior.
> > > 
> > > Priority#: Critical – 1; high – 2; low – 3
> > >  For ports with the same priority, the PoE Controller sets the
> > >  sub-priority according to the logic port number. (Lower number gets
> > >  higher priority).
> > 
> > With less priorities than ports, there is always going to be something
> > like this.
> > 
> > > 
> > > Port priority affects:
> > > 1. Power-up order: After a reset, the ports are powered up according to
> > >  their priority, highest to lowest, highest priority will power up first.
> > > 2. Shutdown order: When exceeding the power budget, lowest priority
> > >  ports will turn off first.
> > > 
> > > Should we return sub priorities on the prio get request?
> > 
> > I should be optional, since we might not actually know what a
> > particular device is doing. It could pick at random, it could pick a
> > port which is consuming just enough to cover the shortfall if it was
> > turned off, it could pick the highest consumer of the lowest priority
> > etc. Some of these conditions are not going to be easy to describe
> > even if we do know it.
> 
> After reviewing the manuals for LTC4266 and TPS2388x, I realized that these
> controllers expose interfaces, but they don't implement prioritization concepts
> themselves.
> 
> The LTC4266 and TPS2388x controllers provide only interfaces that allow the
> kernel to manage shutdown and prioritization policies. For TPS2388x, fast
> shutdown is implemented as a port bitmask with only two priorities, handled via
> the OSS pin. Fast shutdown is triggered by the kernel on request by toggling
> the corresponding pin, and the policy - when and why this pin is toggled - is
> defined by the kernel or user space. Slow shutdown, on the other hand, is
> managed via the I2C bus and allows for more refined control, enabling a wider
> range of priorities and more granular policies.
> 
> I'll tend to hope we can reuse the proposed ETHTOOL_A_C33_PSE_PRIO interface
> across different PSE controllers. However, it is already being mapped to
> different shutdown concepts: PD692x0 firmware seems to rely on a slow shutdown
> backed by internal policies, while TPS2388x maps it to fast shutdown with
> driver specific policy. This inconsistency could force us to either break the
> UAPI or introduce a new, inconsistent one once we realize TPS2388x fast
> shutdown isn't what we actually need.

We should try to avoid fragmentation of the API, but given there is no
standardisation here, vendors are free to do whatever they want, this
may be difficult. Still, we should try to avoid it.

Maybe we want to consider a generic simple prioritization in the
kernel, plus export a generic model of PSE to user space to allow a
user space manager? This is really policy, and ideally we don't want
policy in the kernel. The in kernel implementation can use the
hardware prioritisation if it supports it, otherwise provide a library
of code which a driver can use to implement simple software
prioritisation?

For a user space manager, we already talked about an event to signal
that we are entering overload. I guess we additionally need an API to
get the current runtime state, what each consumer is actually
consuming, and a management API to shutdown or enable a port due to
overload, which is separate to the administrative state of a port.

The hardware/firmware might provide lots of options and capabilities,
but sometimes it is better it ignore them. Export a basic set which we
expect most PSE controllers can offer, and do the rest in our software
which we have full insight into, and debug and share, unlike firmware
which is a broken black box.

If we decide this is the way we want to go, we should not need to
extend the API for LTC4266 and TPS2388x, you just implement a basic
prioritisation in the driver. If it turns out to be not ideal, it does
not matter so much, so long as we have the understanding that
eventually we can have something better in userspace.

We can maybe do a rough sketch of what the kAPI looks like for a user
space manager, but we can kick the implementation down the road while
the in kernel prioritization is good enough.

	Andrew



  reply	other threads:[~2024-10-09 16:09 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 [this message]
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

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=9e58bfec-c915-4c30-9d75-979a309e3f69@lunn.ch \
    --to=andrew@lunn.ch \
    --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=kory.maincent@bootlin.com \
    --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

all inboxes | Powered by JetHome®