Thread (10 messages) flat view 10 messages, 5 authors, 2026-08-18

Re: [PATCH net-next v14 2/4] net: pse-pd: add Realtek PSE MCU core

From: sashiko-bot@kernel.org
Date: 2026-08-14 22:21:10

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] rtpse_mcu_resp_is_final() excludes RTPSE_MCU_OPCODE_NOT_READY, which breaks the bounded retry mechanism.
--
--- Patch [2]: [PATCH net-next v14 2/4] net: pse-pd: add Realtek PSE MCU core ---
commit 4ec3b6f7573cbef331580bfd04e92ce4ccdb71d2
Author: Jonas Jelonek [off-list ref]

net: pse-pd: add Realtek PSE MCU core

This commit introduces the core driver module for the microcontroller 
fronting PSE silicon on Realtek-based PoE switches. It implements the 
message-based protocol, parsing for Gen1 and Gen2 dialects, and exposes 
a registration interface for transport drivers.
quoted hunk ↗ jump to hunk
--- /dev/null
+++ b/drivers/net/pse-pd/realtek-pse-mcu.h
@@ -0,0 +1,94 @@
[ ... ]
+/*
+ * A polling transport can stop here: the reply to this request (opcode and
+ * seq_num) or a terminal error. The seq_num rejects a stale normal reply; the
+ * terminal errors match unconditionally, as a request the MCU couldn't parse
+ * carries no seq_num to correlate against.
+ */
+static inline bool rtpse_mcu_resp_is_final(const struct rtpse_mcu_msg *req,
+					   const struct rtpse_mcu_msg *resp)
+{
+	return (resp->opcode == req->opcode && resp->seq_num == req->seq_num) ||
+	       resp->opcode == RTPSE_MCU_OPCODE_INCOMPLETE ||
+	       resp->opcode == RTPSE_MCU_OPCODE_BAD_CSUM;
+}
[Severity: Medium]
Does rtpse_mcu_resp_is_final() need to include RTPSE_MCU_OPCODE_NOT_READY?

If a polling transport relies on this helper to wait for the MCU response, it
will ignore NOT_READY messages and continue polling until it times out. 

This would prevent the core driver from handling the transient busy state, as
the transport would return a timeout error instead of passing the NOT_READY
reply back to rtpse_mcu_do_xfer() for its bounded retry loop:

drivers/net/pse-pd/realtek-pse-mcu-core.c:rtpse_mcu_do_xfer() {
    ...
			ret = pse->transport->recv(pse, req, resp);
			if (ret)
				return ret;
    ...
		/* NOT_READY: MCU busy, wants the command resent; bounded retry. */
		if (resp->opcode != RTPSE_MCU_OPCODE_NOT_READY ||
		    tries >= RTPSE_MCU_NOT_READY_RETRIES)
			break;
		msleep(RTPSE_MCU_RESPONSE_MS);
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813222036.873930-1-jelonek.jonas@gmail.com?part=2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help