* Re: [PATCH net-next v4 1/6] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node
[not found] <4f51bfd237fa584c7d9187d7b82f36e261853ea3.1794581338.git.claudiu.manoil@nxp.com>
@ 2026-11-17 15:55 ` netdev-bot+sashiko
0 siblings, 0 replies; only message in thread
From: netdev-bot+sashiko @ 2026-11-17 15:55 UTC (permalink / raw)
To: claudiu.manoil; +Cc: netdev, s32, bhelgaas, linux-pci, linux-kernel, kuba
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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 enetc4_link_init()
(drivers/net/ethernet/freescale/enetc/enetc4_pf.c:1025-1047), the…
- [Low] In drivers/net/ethernet/freescale/enetc/enetc4_pf.c,
enetc4_link_init() (lines 1035-1047) only builds the pseudo-MAC fixed-…
- [Low] enetc4_add_ppm_fixed_link()
(drivers/net/ethernet/freescale/enetc/enetc4_pf.c:996) writes a…
--
net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node
This lets ENETCv4 pseudo-MAC ports probe without a static DT "ethernet"
node. At probe time an of_changeset adds a "fixed-link" child node whose
speed is read from PCR[PSPEED]. The pseudo-MAC path runs when the port has
no OF node or only an OF_DYNAMIC node, and the changeset is reverted on
teardown and on the probe error unwind.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index 71c971618388b..b7e7201e6a71a 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
[ ... ]
> +static int enetc4_add_ppm_fixed_link(struct enetc_pf *pf,
> + struct device_node *np)
> +{
> + struct device_node *fixed_link;
> + struct of_changeset *ocs;
> + int speed, err;
> +
> + enetc4_get_pcr_speed(&pf->si->hw, &speed);
> + speed = enetc_phylink_match_pseudo_mac_speed(speed);
> +
[ ... ]
> + fixed_link = of_changeset_create_node(ocs, np, "fixed-link");
> + if (!fixed_link) {
> + err = -ENOMEM;
> + goto err_destroy;
> + }
> +
> + err = of_changeset_add_prop_u32(ocs, fixed_link, "speed", speed);
[Severity: Low]
This isn't a bug, but can this write a speed value that the fixed-link
binding doesn't allow?
enetc_phylink_pseudo_mac_caps[] in enetc_pf_common.c includes SPEED_25000
and SPEED_20000. When PCR[PSPEED] maps to 20000 Mbps or more,
enetc_phylink_match_pseudo_mac_speed() returns 20000 or 25000.
In Documentation/devicetree/bindings/net/ethernet-controller.yaml, the
fixed-link speed property only allows:
enum: [10, 100, 1000, 2500, 5000, 10000]
phylink still accepts these values. But the node is built at runtime, so
dt-schema never checks it.
Should the binding be extended (as was done for 5000)? Or should the
driver stick to the speeds the binding lists?
> + if (err)
> + goto err_put_node;
[ ... ]
> static int enetc4_link_init(struct enetc_ndev_priv *priv,
> struct device_node *node)
> {
> + bool dynamic = node && of_node_check_flag(node, OF_DYNAMIC);
> struct enetc_pf *pf = enetc_si_priv(priv->si);
> struct device *dev = priv->dev;
> int err;
>
> - err = of_get_phy_mode(node, &pf->if_mode);
> - if (err) {
> - dev_err(dev, "Failed to get PHY mode\n");
> - return err;
> + /* Pseudo-MAC ENETCs are described by a runtime-synthesized fixed-link
> + * node rather than static DT. This covers both a missing OF node and a
> + * PCI-synthesized (OF_DYNAMIC) node, which is an empty node created
> + * by the PCI core and thus carries no fixed-link description.
> + */
[Severity: Low]
Is this comment accurate?
The PCI-synthesized node isn't empty. of_pci_make_dev_node() fills it in
through of_pci_add_properties() (compatible, reg, ...) before it applies
the changeset. The only accurate part is that it has no fixed-link child.
The branch also doesn't really cover a missing OF node. That case just
returns -ENODEV below.
Related to this: at this commit, the PCI core doesn't create a node for an
ENETC endpoint function. pci_bus_add_device() only does it for bridges:
if (pci_is_bridge(dev))
of_pci_make_dev_node(dev);
drivers/pci/quirks.c has no ENETC entries either. So a pseudo-MAC port
without a node always hits the "Missing of_node for Pseudo-MAC port" error
here.
A later patch in the series, "PCI: Create OF node for NXP ENETC pseudo-MAC
functions", fixes that. It adds DECLARE_PCI_FIXUP_FINAL() entries for
PCI_VENDOR_ID_PHILIPS device IDs 0xe101 and 0xe110 that call
of_pci_make_dev_node(). With the whole series applied, only the comment
wording is left.
> + if (enetc_is_pseudo_mac(priv->si) && (!node || dynamic)) {
> + pf->if_mode = PHY_INTERFACE_MODE_INTERNAL;
[Severity: Medium]
Is the OF_DYNAMIC flag enough to show that the node has no link
description?
__of_node_dup() sets OF_DYNAMIC, and DT overlays create their nodes with
it in add_changeset_node(). An overlay can also be applied on top of the
node from of_pci_make_dev_node() to add phy-mode or fixed-link.
In either case, this branch:
- skips of_get_phy_mode()
- forces PHY_INTERFACE_MODE_INTERNAL
- calls enetc4_add_ppm_fixed_link(), which calls
of_changeset_create_node(ocs, np, "fixed-link") without checking for an
existing fixed-link child
__of_attach_node() puts the new node at the head of the child list:
np->sibling = np->parent->child;
np->parent->child = np;
phylink_parse_fixedlink() looks the node up with
fwnode_get_named_child_node(), so it would find the driver-synthesized
fixed-link before the DT one.
Would that leave two fixed-link children and replace the DT-provided speed
with the PCR[PSPEED] value?
The commit message says:
The pseudo-MAC path is selected when the port has no OF node, or when it
only has the empty PCI-synthesized node (OF_DYNAMIC), which carries no
fixed-link description.
Nothing in the code checks that, though. Would a check such as
of_get_child_by_name(node, "fixed-link") or
of_property_present(node, "phy-mode") make the code match the
description?
> +
> + if (!node) {
> + dev_err(dev, "Missing of_node for Pseudo-MAC port\n");
> + return -ENODEV;
> + }
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794581338.git.claudiu.manoil%40nxp.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-17 15:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4f51bfd237fa584c7d9187d7b82f36e261853ea3.1794581338.git.claudiu.manoil@nxp.com>
2026-11-17 15:55 ` [PATCH net-next v4 1/6] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node netdev-bot+sashiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox