From: Jonas Jelonek <jonas@jonasjelonek.de>
To: netdev-bot+sashiko@kernel.org
Cc: o.rempel@pengutronix.de, kory.maincent@bootlin.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, russell@personaltelco.net
Subject: Re: [PATCH net] net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management
Date: Tue, 1 Dec 2026 12:35:28 +0100 [thread overview]
Message-ID: <502140fa-a266-432d-ab32-56c8ce898f49@jonasjelonek.de> (raw)
In-Reply-To: <179608244650.3146.5191319119181327382@kernel.org>
On 01.12.26 00:47, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] In drivers/net/pse-pd/realtek-pse-mcu-core.c,
> rtpse_mcu_register() now forces the MCU into mode 0x02, "dynamic, with…
>
> --
>
> net: pse-pd: realtek-pse-mcu: ensure MCU does dynamic power management
>
> This commit adds a SET_POWER_MGMT_MODE command to both dialects: 0x17
> for Gen1 and 0x10 for Gen2. rtpse_mcu_register() issues it to put the
> MCU into dynamic power management with port priority (mode 0x02). Probe
> fails if the command fails, and the mode is selected before the
> disable-ports GPIO is deasserted.
>
>> diff --git a/drivers/net/pse-pd/realtek-pse-mcu-core.c b/drivers/net/pse-pd/realtek-pse-mcu-core.c
>> index c70b09ca20122..e382045932e9e 100644
>> --- a/drivers/net/pse-pd/realtek-pse-mcu-core.c
>> +++ b/drivers/net/pse-pd/realtek-pse-mcu-core.c
> [ ... ]
>
>> @@ -369,6 +373,26 @@ static int rtpse_mcu_set_global_state(struct rtpse_mcu_ctrl *pse, bool enable)
>> return (resp.payload[0] == 0x0) ? 0 : -EIO;
>> }
>>
>> +static int rtpse_mcu_set_power_mgmt_mode(struct rtpse_mcu_ctrl *pse)
>> +{
>> + struct rtpse_mcu_msg req, resp;
>> + const struct rtpse_mcu_opcode *opc;
>> + int ret;
>> +
>> + opc = &pse->dialect->opcode[RTPSE_MCU_CMD_SET_POWER_MGMT_MODE];
>> + if (!opc->valid)
>> + return -EOPNOTSUPP;
>> +
>> + rtpse_mcu_msg_init(&req, opc->op);
>> + req.payload[0] = RTPSE_MCU_POWER_MGMT_DYNAMIC_PRIO;
> [Severity: Medium]
> Is the global power budget that this mode checks against ever set?
>
> This function writes only the mode byte. enum rtpse_mcu_cmd has no
> budget command, and neither the Gen1 nor the Gen2 opcode table maps
> one. In the Gen1 command family, 0x18 (next to 0x17) is the set global
> power budget command.
>
> The only budget reference in the driver is in rtpse_mcu_register():
>
> pse->pcdev.supp_budget_eval_strategies = PSE_BUDGET_EVAL_STRAT_DYNAMIC;
>
> pse.h says PSE_BUDGET_EVAL_STRAT_DYNAMIC compares "the current
> consumption per ports compared to the total power budget". It also
> says this mode "is managed by the PSE controller". pse_core does not do
> its own budget accounting for this strategy.
>
> If a board's firmware defaults to a non-managed mode, the MCU used to
> ignore its stored budget. With this patch, every probe makes the MCU
> enforce whatever budget the firmware holds.
>
> If that budget is below the real supply, or zero, could PDs be refused
> or shed? If it is above what the PSU can deliver, could the PSU be
> over-committed?
>
> The commit message says the driver should "ensure that the MCU performs
> dynamic power management with priorities as advertised". Should the
> budget also be programmed here, or at least read back and logged, so
> that the policy is actually established?
The concern is correct but I would reduce its importance.
The majority of switches already come with a good default configuration.
This change targets a few devices which for whatever reason ship with
IIRC mode 'None', preventing any power delivery. Still, they have a power
budget configured. So when this is set as the patch intends, the MCU will
do the dynamic budgeting with the configured budget.
I cannot exclude that there are devices which both have a power management
mode of 'None' by default and also a bad/zero budget defined. Probably it
exists but no-one has seen it so far, only either isolated case.
This was sent as a separate fix from [1] following the Sashiko suggestion.
It also seems to affect more devices than having to provide a global budget.
I plan to update the global budget on net-next too, this appears to me rather
as a new feature than a fix worth to backport.
If anyone favor having those patches together on either net or net-next,
please say so.
>> +
>> + ret = rtpse_mcu_do_xfer(pse, &req, &resp);
>> + if (ret)
>> + return ret;
>> +
>> + return (resp.payload[0] == 0x0) ? 0 : -EIO;
>> +}
> [ ... ]
>
[1] https://lore.kernel.org/all/20261116115224.1454885-1-jonas@jonasjelonek.de/
Best,
Jonas
prev parent reply other threads:[~2026-12-01 11:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 23:46 Jonas Jelonek
2026-11-29 23:48 ` netdev-bot+sinfo
2026-11-30 0:25 ` Russell Senior
2026-11-30 15:09 ` Kory Maincent
2026-11-30 23:47 ` netdev-bot+sashiko
2026-12-01 11:35 ` Jonas Jelonek [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=502140fa-a266-432d-ab32-56c8ce898f49@jonasjelonek.de \
--to=jonas@jonasjelonek.de \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=russell@personaltelco.net \
/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®