Skip to contentSkip to conversation

net: enetc: S32N79 pseudo-MAC (PPM) networking support

PATCH Superseded Claudiu Manoil 3 participants 11 messages Nov 3 – Nov 11

Subsystems (6)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Claudiu Manoil

author maintainer
#0 lore raw

v3 cover net: enetc: S32N79 pseudo-MAC (PPM) networking support

This series adds networking support for the ENETCv4.4 pseudo-MAC (PPM) ports found on the NXP S32N79 SoC. On S32N79, the ENETCv4 ports are not wired to any external PHY/MII; instead they are internal "pseudo-MAC" links into the on-chip NETC switch. These links are proprietary, expose no standard IEEE interface, and run at a speed fixed at boot time by the Port PCR[PSPEED] register.

A key use case is a port that has no "ethernet" DT node at all: NETC is reached over PCI from a host that probes the ENETC, while the internal NETC switch it connects to is not owned by Linux. Such a port must have its fixed link synthesized at probe time.

The driver synthesizes the fixed link directly in C using an of_changeset:
of_changeset_create_node() adds a "fixed-link" subnode onto the PCI function's dynamic OF node (CONFIG_PCI_DYNAMIC_OF_NODES), with the "speed" property read from PCR[PSPEED] at probe time and "full-duplex" set. phylink then picks up the fixed-link node through dev_fwnode().

The series touches three subsystems:

  - net/enetc:  pseudo-MAC fixed-link support + probing of 4.4 devices
  - arm64 dts:  NETC IEP18 ECAM node on S32N79 and its RDB board enable
  - PCI:        a quirk creating the OF node for the ENETC PMAC functions

Because this is primarily a networking feature and the pieces are interdependent at runtime, it would be most convenient to merge the whole series through the netdev tree.

Patch 1 has a runtime (not Kconfig) dependency on CONFIG_PCI_DYNAMIC_OF_NODES; absent that, the pseudo-MAC probe path fails gracefully with -ENODEV.

v3:
- Patch 1: fixed the CONFIG_OF_DYNAMIC dependency, refactored enetc4_add_ppm_fixed_link() as per Wei's feedback, and improved the commit message.
- Patch 2: added sysclk_freq info for the v4.4 ENETC devices.
- Patches 3-5: no changes.
v2:
- Switched patch 1 from a DT overlay blob (of_overlay_fdt_apply() + a .dtso compiled to .dtbo) to of_changeset_create_node(), per review feedback. This drops the embedded overlay externs, the Makefile .dtbo wrapping, and the OF_OVERLAY Kconfig dependency. The operating speed is now baked directly into the changeset-created fixed-link node (read once from PCR[PSPEED] at probe time); the phylink get_fixed_state callback is no longer needed and was removed.
- Patch 2: described why there are two ENETC PF IDs in the commit message, as per review.
- Patch 3: replaced the 'msi-parent' stub property with 'msi-map', as per H/W spec.
- Patch 5: reworded the commit message to match patch 1's fixed-link approach (no functional change); added Bjorn's Acked-by.
v1: initial submission.

Claudiu Manoil (5):
net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link
node
net: enetc: Enable probing of version 4.4 devices
arm64: dts: s32n79: add NETC IEP18 ECAM node for ENETC PPM ports
arm64: dts: s32n79-rdb: enable NETC IEP18
PCI: Create OF node for NXP ENETC pseudo-MAC functions

 arch/arm64/boot/dts/freescale/s32n79-rdb.dts  |   4 +
 arch/arm64/boot/dts/freescale/s32n79.dtsi     |  24 ++++
 drivers/net/ethernet/freescale/enetc/Kconfig  |   1 +
 drivers/net/ethernet/freescale/enetc/enetc.c  |  26 +++++
 .../net/ethernet/freescale/enetc/enetc4_pf.c  | 109 +++++++++++++++++-
 .../net/ethernet/freescale/enetc/enetc_hw.h   |   4 +-
 .../net/ethernet/freescale/enetc/enetc_pf.h   |   2 +
 .../freescale/enetc/enetc_pf_common.c         |  41 ++++++-
 .../freescale/enetc/enetc_pf_common.h         |   1 +
 drivers/pci/quirks.c                          |   2 +
 10 files changed, 204 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v3 1/5 net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node

ENETCv4 has special internal links when connected to the on-chip NETC switch via internal switch ports, called pseudo-MAC links. These pseudo-MACs are proprietary, they don't implement any standard IEEE interface (like MII), and can be modeled as fixed links with the link speed determined at boot time by the Port PCR[PSPEED] register configuration.

We also need to be able to probe the ENETCv4 Ports featuring pseudo-MACs as pure PCI devices, i.e. without any "ethernet" DT node representation. The typical use case for this consists in a board with NETC connected via PCI to another host which probes the ENETC. Note that in this scenario, the pseudo-MAC ENETCs are connected internally to a NETC switch that is not owned by Linux.

Since such a port has no "ethernet" DT node, its fixed link has to be synthesized at probe time. Build the fixed-link subnode directly in C with an of_changeset: of_changeset_create_node() adds a "fixed-link" node onto the port's own OF node, and of_changeset_add_prop_*() populate its "speed" and "full-duplex" properties. The changeset is applied with of_changeset_apply(), so the fixed-link node is spliced onto the ENETC netdev's fwnode exactly as if it had come from static DT, and phylink picks it up through dev_fwnode().

The operating speed written into the node is read from PCR[PSPEED] at probe time and mapped to a phylink-supported value, so the fixed link reflects the actual boot-time configuration, as long as it's a phylink supported value. Otherwise, PCR[PSPEED] will be updated to the closest rounded down supported value.

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. Ports described by static DT take the regular of_get_phy_mode() path instead.

The changeset is reverted and destroyed on teardown and on the probe error unwind. The node-less pseudo-MAC path has a runtime dependency on CONFIG_PCI_DYNAMIC_OF_NODES: that is what makes the PCI core synthesize the per-function OF node (of_pci_make_dev_node()) that the fixed-link node is attached onto. This is intentionally not a hard Kconfig dependency, since the ENETC4 driver also serves regular ports described by static DT; when PCI_DYNAMIC_OF_NODES is absent the PCI function has no of_node and the pseudo-MAC probe path fails gracefully with a clear -ENODEV error.

---
v3:
- Fixed the CONFIG_OF_DYNAMIC dependency.
- Refactored enetc4_add_ppm_fixed_link(), as per Wei's feedback.
- Improved the commit message.

v2:
- Switched from a DT overlay blob (of_overlay_fdt_apply() + a .dtso compiled to .dtbo) to of_changeset_create_node(), per review feedback. Drops the embedded overlay externs, the Makefile .dtbo wrapping, and the OF_OVERLAY Kconfig dependency.
- Baked the operating speed directly into the changeset-created fixed-link node (read once from PCR[PSPEED] at probe time); the phylink get_fixed_state callback is no longer needed and was removed.

 drivers/net/ethernet/freescale/enetc/Kconfig  |   1 +
 .../net/ethernet/freescale/enetc/enetc4_pf.c  | 109 +++++++++++++++++-
 .../net/ethernet/freescale/enetc/enetc_pf.h   |   2 +
 .../freescale/enetc/enetc_pf_common.c         |  41 ++++++-
 .../freescale/enetc/enetc_pf_common.h         |   1 +
 5 files changed, 145 insertions(+), 9 deletions(-)
drivers/net/ethernet/freescale/enetc/Kconfig +1 -0
index f425f82a6213a..c51d07db2c869 100644
@@ -55,6 +55,7 @@ config NXP_ENETC4
 	select NXP_NTMP
 	select PHYLINK
 	select DIMLIB
+	select OF_DYNAMIC
 	help
 	  This driver supports NXP ENETC devices with major revision 4. ENETC is
 	  as the NIC functionality in NETC, it supports virtualization/isolation
drivers/net/ethernet/freescale/enetc/enetc4_pf.c +103 -6

152 lines not on this page · raw message

drivers/net/ethernet/freescale/enetc/enetc_pf.h +2 -0
index 1f92d16d8ca81..ab11e40cfdbbb 100644
@@ -67,6 +67,8 @@ struct enetc_pf {
 	bool sriov_enabled;
 	bool link_up;
 	u16 link_status_ms_mask;
+
+	struct of_changeset *ppm_ocs; /* pseudo-MAC fixed-link changeset */
 };
 
 #define phylink_to_enetc_pf(config) \
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +38 -3

53 lines not on this page · raw message

drivers/net/ethernet/freescale/enetc/enetc_pf_common.h +1 -0
index c9eed879d5a3f..aede1aad63621 100644
@@ -13,6 +13,7 @@ void enetc_mdiobus_destroy(struct enetc_pf *pf);
 int enetc_phylink_create(struct enetc_ndev_priv *priv, struct device_node *node,
 			 const struct phylink_mac_ops *ops);
 void enetc_phylink_destroy(struct enetc_ndev_priv *priv);
+int enetc_phylink_match_pseudo_mac_speed(int speed);
 void enetc_set_default_rss_key(struct enetc_pf *pf);
 int enetc_vlan_rx_add_vid(struct net_device *ndev, __be16 prot, u16 vid);
 int enetc_vlan_rx_del_vid(struct net_device *ndev, __be16 prot, u16 vid);
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH net-next v3 1/5] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] net: enetc: NXP_ENETC4 selects OF_DYNAMIC without depending on OF - [Medium] net: enetc…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] net: enetc: NXP_ENETC4 selects OF_DYNAMIC without depending on OF
- [Medium] net: enetc: enetc_phylink_match_pseudo_mac_speed() returns >10G fixed-link --

commit 47b0c7dd1742d2d679a7876866a314bac673517d
Author: Claudiu Manoil <[email protected]>

net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a fixed-link node

This commit adds pseudo-MAC support for ENETCv4 ports by synthesizing a runtime fixed-link devicetree subnode via an of_changeset using the boot-time speed read from the port PCR register.

drivers/net/ethernet/freescale/enetc/Kconfig config NXP_ENETC4 · line 58

Quoted 9 lines
drivers/net/ethernet/freescale/enetc/Kconfig +1 -0
index f425f82a6213a..c51d07db2c869 100644
@@ -55,6 +55,7 @@ config NXP_ENETC4
 	select NXP_NTMP
 	select PHYLINK
 	select DIMLIB
+	select OF_DYNAMIC

[Severity: Medium]
As reported by kernel test robot on v2 [1], does selecting OF_DYNAMIC here without depending on OF cause Kconfig unmet dependency warnings and link failures when CONFIG_OF is disabled?

In drivers/of/Kconfig, OF_DYNAMIC (and OF_KOBJ, which it selects) is defined inside the if OF block:

drivers/of/Kconfig:
if OF
...
config OF_DYNAMIC
bool "Support for dynamic device trees" if OF_UNITTEST select OF_KOBJ

When building with CONFIG_OF=n and CONFIG_NXP_ENETC4 enabled (for example, under CONFIG_COMPILE_TEST=y on x86_64), selecting OF_DYNAMIC forces CONFIG_OF_DYNAMIC=y while CONFIG_OF remains disabled.

Because CONFIG_OF_DYNAMIC=y is set, include/linux/of.h exposes extern declarations rather than inline stubs for the of_changeset_*() and of_node_put() helpers, while drivers/Makefile only descends into drivers/of/ when CONFIG_OF is enabled. As a result, the calls to of_changeset_init(), of_changeset_create_node(), of_changeset_add_prop_u32(), of_changeset_add_prop_bool(), of_changeset_apply(), of_changeset_revert(), of_changeset_destroy(), and of_node_put() in enetc4_add_ppm_fixed_link() and enetc4_put_ppm_fixed_link() fail with undefined references at link time.

Should NXP_ENETC4 depend on OF, or only select OF_DYNAMIC if OF (with the relevant calls or stubs guarded accordingly)?

[ ... ]

Quoted 34 lines
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +26 -0
index 8206884294a47..3ba46c3a7670b 100644
@@ -436,6 +436,43 @@ void enetc_mdiobus_destroy(struct enetc_pf *pf)
 }
 EXPORT_SYMBOL_GPL(enetc_mdiobus_destroy);
 
+static struct {
+	unsigned long mac_cap;
+	int speed; /* descending order sorted  */
+} enetc_phylink_pseudo_mac_caps[] = {
+	{ MAC_25000FD,  SPEED_25000 },
+	{ MAC_20000FD,  SPEED_20000 },
+	{ MAC_10000FD,  SPEED_10000 },
+	{ MAC_5000FD,   SPEED_5000  },
+	{ MAC_2500FD,   SPEED_2500  },
+	{ MAC_1000FD,   SPEED_1000  },
+	{ MAC_100FD,    SPEED_100   },
+	{ MAC_10FD,     SPEED_10    },
+};
+
+static unsigned long enetc_phylink_get_pseudo_mac_caps(void)
+{
+	unsigned long mac_caps = 0;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(enetc_phylink_pseudo_mac_caps); i++)
+		mac_caps |= enetc_phylink_pseudo_mac_caps[i].mac_cap;
+
+	return mac_caps;
+}
+
+int enetc_phylink_match_pseudo_mac_speed(int speed)

drivers/net/ethernet/freescale/enetc/enetc_pf_common.c void enetc_mdiobus_destroy(struct enetc_pf *pf) · line 474

Quoted 10 lines
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c +10 -0
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(enetc_phylink_pseudo_mac_caps); i++)
+		if (enetc_phylink_pseudo_mac_caps[i].speed <= speed)
+			return enetc_phylink_pseudo_mac_caps[i].speed;
+
+	return SPEED_UNKNOWN;
+}
+EXPORT_SYMBOL_GPL(enetc_phylink_match_pseudo_mac_speed);

[Severity: Medium]
What happens in phylink_parse_fixedlink() when an ENETCv4 pseudo-MAC port has PCR[PSPEED] configured for 20000 or 25000 Mbps at boot?

In enetc4_link_init() -> enetc4_add_ppm_fixed_link(), the driver reads the hardware speed via enetc4_get_pcr_speed(), maps it through enetc_phylink_match_pseudo_mac_speed(), and writes the resulting speed (SPEED_20000 or SPEED_25000) into the synthesized fixed-link node's speed property before calling enetc_phylink_create() -> phylink_create().

However, in drivers/net/phy/phylink.c, phylink_parse_fixedlink() populates pl->supported using phylink_fill_fixedlink_supported(), which only sets link modes up to 10000baseT_Full:

drivers/net/phy/phylink.c:phylink_fill_fixedlink_supported() {
    linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, supported);
    linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, supported);
}

Because pl->supported has no 20000 or 25000 Mbps link modes set, phy_caps_lookup() in phylink_parse_fixedlink() returns NULL for SPEED_20000 and SPEED_25000, triggering:

    phylink_warn(pl, "fixed link %s duplex %dMbps not recognised\n", ...);

and leaving pl->supported, pl->link_config.advertising, and pl->link_config.lp_advertising with no speed link modes set.

[1] https://lore.kernel.org/r/[email protected]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#3 lore raw

PATCH v3 2/5 net: enetc: Enable probing of version 4.4 devices

In reply to Claudiu Manoil

The ENETC v4.4 devices are present on S32N79 SoCs and feature only Pseudo-MAC ENETC ports, whose PFs use either the 0xe101 or the 0xe110 PCI device ID, and the VFs answer to the usual device ID of 0xef00.

While the ENETC PF instances are usually designated by the 0xe101 ID, in newer IP versions the 0xe110 ID was introduced to indicate the power-on reset default NETC switch management interface. These IDs do not indicate any functional difference between the designated ENETC instances, and can be interchanged and re-assigned at boot time (i.e. from firmware).

---
v3:
- Added sysclk_freq info for the v4.4 ENETC devices.

v2:
- Described why there are two ENETC PF IDs in the commit message, as per review.

 drivers/net/ethernet/freescale/enetc/enetc.c  | 26 +++++++++++++++++++
 .../net/ethernet/freescale/enetc/enetc_hw.h   |  4 ++-
 2 files changed, 29 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.c +26 -0
index c6571b5cc8425..b989823859ff2 100644
@@ -3832,6 +3832,20 @@ static const struct enetc_drvdata enetc4_vf_data = {
 	.eth_ops = &enetc_vf_ethtool_ops,
 };
 
+static const struct enetc_drvdata enetc4_s32n79_ppm_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc4_ppm_ethtool_ops,
+};
+
+static const struct enetc_drvdata enetc4_s32n79_vf_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc_vf_ethtool_ops,
+};
+
 static const struct enetc_platform_info enetc_info[] = {
 	{ .revision = ENETC_REV_1_0,
 	  .dev_id = ENETC_DEV_ID_PF,
@@ -3862,6 +3876,18 @@ static const struct enetc_platform_info enetc_info[] = {
 	  .dev_id = NXP_ENETC_VF_DEV_ID,
 	  .data = &enetc4_vf_data,
 	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PPM_DEV_ID,
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PF_DEV_ID,
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_VF_DEV_ID,
+	  .data = &enetc4_s32n79_vf_data,
+	},
 };
 
 int enetc_get_driver_data(struct enetc_si *si)
drivers/net/ethernet/freescale/enetc/enetc_hw.h +3 -1
index 2c9d9042eb0bb..8e6a9d366d404 100644
@@ -414,6 +414,7 @@ enum enetc_bdr_type {TX, RX};
 #define ENETC_REV_1_0		0x0100
 #define ENETC_REV_4_1		0X0401
 #define ENETC_REV_4_3		0x0403
+#define ENETC_REV_4_4		0x0404
 
 #define ENETC_G_EIPBRR1		0x0bfc
 #define ENETC_G_EPFBLPR(n)	(0xd00 + 4 * (n))
@@ -1048,8 +1049,9 @@ struct enetc_cbd {
 	u8 status_flags;
 };
 
-#define ENETC_CLK_400M		400000000ULL
 #define ENETC_CLK_333M		333000000ULL
+#define ENETC_CLK_400M		400000000ULL
+#define ENETC_CLK_500M		500000000ULL
 
 static inline u32 enetc_cycles_to_usecs(u32 cycles, u64 clk_freq)
 {
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH net-next v3 2/5] net: enetc: Enable probing of version 4.4 devices

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Critical] net: enetc: out-of-bounds write to int_vector[] in enetc_int_vector_init() --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] net: enetc: out-of-bounds write to int_vector[] in enetc_int_vector_init() --

commit 6de2e15f2fb313f3ab9a84d0bfd5a867de11c72c
Author: Claudiu Manoil <[email protected]>

net: enetc: Enable probing of version 4.4 devices

This commit adds driver data and platform info entries for ENETC v4.4 PF and VF devices on S32N79 SoCs with a 500 MHz system clock frequency.

Quoted 31 lines
drivers/net/ethernet/freescale/enetc/enetc.c +16 -0
index c6571b5cc8425..b989823859ff2 100644
@@ -3832,6 +3832,20 @@ static const struct enetc_drvdata enetc4_vf_data = {
 	.eth_ops = &enetc_vf_ethtool_ops,
 };
 
+static const struct enetc_drvdata enetc4_s32n79_ppm_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc4_ppm_ethtool_ops,
+};
+
+static const struct enetc_drvdata enetc4_s32n79_vf_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc_vf_ethtool_ops,
+};
+
 static const struct enetc_platform_info enetc_info[] = {
 	{ .revision = ENETC_REV_1_0,
 	  .dev_id = ENETC_DEV_ID_PF,
@@ -3862,6 +3876,18 @@ static const struct enetc_platform_info enetc_info[] = {
 	  .dev_id = NXP_ENETC_VF_DEV_ID,
 	  .data = &enetc4_vf_data,
 	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PPM_DEV_ID,

drivers/net/ethernet/freescale/enetc/enetc.c static const struct enetc_platform_info enetc_info[] = { · line 3890

Quoted 10 lines
drivers/net/ethernet/freescale/enetc/enetc.c +10 -0
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PF_DEV_ID,
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_VF_DEV_ID,
+	  .data = &enetc4_s32n79_vf_data,
+	},

[Severity: Critical]
Can probing ENETC v4.4 on an 8-core S32N79 SoC overflow priv->int_vector[] in enetc_int_vector_init()?

In drivers/net/ethernet/freescale/enetc/enetc.h, ENETC_MAX_BDR_INT is still defined as 6:

#define ENETC_MAX_BDR_INT 6 /* fixed to max # of available cpus */
...

struct enetc_ndev_priv {
	...
	int bdr_int_num; /* number of Rx/Tx ring interrupts */
	struct enetc_int_vector *int_vector[ENETC_MAX_BDR_INT];
	u16 num_rx_rings, num_tx_rings;
	u16 rx_bd_count, tx_bd_count;

Previously supported SoCs had at most 6 CPUs, whereas S32N79 has 8 CPUs and enetc4_default_rings_allocation() allocates up to ENETC_SI_MAX_RING_NUM (8) RX rings to the PF.

When enetc_init_si_rings_params() runs on an 8-CPU system with 7 or 8 RX rings:

	int cpus = num_online_cpus();
	...
	priv->num_rx_rings = min_t(int, cpus, si->num_rx_rings);
	priv->num_tx_rings = si->num_tx_rings;
	priv->bdr_int_num = priv->num_rx_rings;

priv->bdr_int_num becomes 7 or 8 without being clamped to ENETC_MAX_BDR_INT. Then enetc_alloc_msix() -> enetc_int_vector_init() writes past the end of priv->int_vector[]:

	for (i = 0; i < priv->bdr_int_num; i++) {
		...
		err = enetc_int_vector_init(priv, i, num_tx_rings);

where enetc_int_vector_init() does:

	priv->int_vector[i] = v;

overwriting num_rx_rings, num_tx_rings, rx_bd_count, tx_bd_count, and subsequent fields in struct enetc_ndev_priv.

Should ENETC_MAX_BDR_INT be increased (and/or priv->bdr_int_num bounded by ENETC_MAX_BDR_INT)?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
reviewer
#5 lore raw

Re: [PATCH net-next v3 2/5] net: enetc: Enable probing of version 4.4 devices

In reply to Claudiu Manoil
Quoted 11 lines · Claudiu Manoil

The ENETC v4.4 devices are present on S32N79 SoCs and feature only Pseudo-MAC ENETC ports, whose PFs use either the 0xe101 or the 0xe110 PCI device ID, and the VFs answer to the usual device ID of 0xef00.

While the ENETC PF instances are usually designated by the 0xe101 ID, in newer IP versions the 0xe110 ID was introduced to indicate the power-on reset default NETC switch management interface. These IDs do not indicate any functional difference between the designated ENETC instances, and can be interchanged and re-assigned at boot time (i.e. from firmware).

Quoted 8 lines

---
v3:
- Added sysclk_freq info for the v4.4 ENETC devices.

v2:
- Described why there are two ENETC PF IDs in the commit message, as per review.

I realise this was forwarded somewhere by an automation, but it seems not to the full CC list, so I'm reproducing it here:

commit 6de2e15f2fb313f3ab9a84d0bfd5a867de11c72c
Author: Claudiu Manoil <[email protected]>

net: enetc: Enable probing of version 4.4 devices

This commit adds driver data and platform info entries for ENETC v4.4 PF and VF devices on S32N79 SoCs with a 500 MHz system clock frequency.

Quoted 31 lines
drivers/net/ethernet/freescale/enetc/enetc.c +16 -0
index c6571b5cc8425..b989823859ff2 100644
@@ -3832,6 +3832,20 @@ static const struct enetc_drvdata enetc4_vf_data = {
 	.eth_ops = &enetc_vf_ethtool_ops,
 };
 
+static const struct enetc_drvdata enetc4_s32n79_ppm_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc4_ppm_ethtool_ops,
+};
+
+static const struct enetc_drvdata enetc4_s32n79_vf_data = {
+	.sysclk_freq = ENETC_CLK_500M,
+	.tx_csum = true,
+	.max_frags = ENETC4_MAX_SKB_FRAGS,
+	.eth_ops = &enetc_vf_ethtool_ops,
+};
+
 static const struct enetc_platform_info enetc_info[] = {
 	{ .revision = ENETC_REV_1_0,
 	  .dev_id = ENETC_DEV_ID_PF,
@@ -3862,6 +3876,18 @@ static const struct enetc_platform_info enetc_info[] = {
 	  .dev_id = NXP_ENETC_VF_DEV_ID,
 	  .data = &enetc4_vf_data,
 	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PPM_DEV_ID,

drivers/net/ethernet/freescale/enetc/enetc.c static const struct enetc_platform_info enetc_info[] = { · line 3890

Quoted 10 lines
drivers/net/ethernet/freescale/enetc/enetc.c +10 -0
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_PF_DEV_ID,
+	  .data = &enetc4_s32n79_ppm_data,
+	},
+	{ .revision = ENETC_REV_4_4,
+	  .dev_id = NXP_ENETC_VF_DEV_ID,
+	  .data = &enetc4_s32n79_vf_data,
+	},

Can probing ENETC v4.4 on an 8-core S32N79 SoC overflow priv->int_vector[] in enetc_int_vector_init()?

In drivers/net/ethernet/freescale/enetc/enetc.h, ENETC_MAX_BDR_INT is still defined as 6:

  #define ENETC_MAX_BDR_INT	6 /* fixed to max # of available cpus */
  ...
  struct enetc_ndev_priv {
  	...
  	int bdr_int_num; /* number of Rx/Tx ring interrupts */
  	struct enetc_int_vector *int_vector[ENETC_MAX_BDR_INT];
  	u16 num_rx_rings, num_tx_rings;
  	u16 rx_bd_count, tx_bd_count;

Previously supported SoCs had at most 6 CPUs, whereas S32N79 has 8 CPUs and enetc4_default_rings_allocation() allocates up to ENETC_SI_MAX_RING_NUM (8) RX rings to the PF.

When enetc_init_si_rings_params() runs on an 8-CPU system with 7 or 8 RX rings:

  	int cpus = num_online_cpus();
  	...
  	priv->num_rx_rings = min_t(int, cpus, si->num_rx_rings);
  	priv->num_tx_rings = si->num_tx_rings;
  	priv->bdr_int_num = priv->num_rx_rings;

priv->bdr_int_num becomes 7 or 8 without being clamped to ENETC_MAX_BDR_INT. Then enetc_alloc_msix() -> enetc_int_vector_init() writes past the end of priv->int_vector[]:

  	for (i = 0; i < priv->bdr_int_num; i++) {
  		...
  		err = enetc_int_vector_init(priv, i, num_tx_rings);

where enetc_int_vector_init() does:

  	priv->int_vector[i] = v;

overwriting num_rx_rings, num_tx_rings, rx_bd_count, tx_bd_count, and subsequent fields in struct enetc_ndev_priv.

Should ENETC_MAX_BDR_INT be increased (and/or priv->bdr_int_num bounded by ENETC_MAX_BDR_INT)?

This does seem to be a legitimate concern to me, and I think it warrants a v4.

There is also a review of patch 1/5, here, which I think warrants investigation too.

Signature · 1 line
pw-bot: changes-requested
author maintainer
#6 lore raw

RE: [PATCH net-next v3 2/5] net: enetc: Enable probing of version 4.4 devices

From: Simon Horman <[email protected]>
Sent: Monday, November 9, 2026 7:37 PM

Quoted 1 line

To: Claudiu Manoil <[email protected]>

[...]

Quoted 27 lines

Subject: Re: [PATCH net-next v3 2/5] net: enetc: Enable probing of version 4.4 devices

Quoted 11 lines · Claudiu Manoil

The ENETC v4.4 devices are present on S32N79 SoCs and feature only Pseudo-MAC ENETC ports, whose PFs use either the 0xe101 or the 0xe110 PCI device ID, and the VFs answer to the usual device ID of 0xef00.

While the ENETC PF instances are usually designated by the 0xe101 ID, in newer IP versions the 0xe110 ID was introduced to indicate the power-on reset default NETC switch management interface. These IDs do not indicate any functional difference between the designated ENETC instances, and can be interchanged and re-assigned at boot time (i.e. from firmware).

Quoted 8 lines

---
v3:
- Added sysclk_freq info for the v4.4 ENETC devices.

v2:
- Described why there are two ENETC PF IDs in the commit message, as per review.

I realise this was forwarded somewhere by an automation, but it seems not to the full CC list, so I'm reproducing it here:

Quoted 8 lines

commit 6de2e15f2fb313f3ab9a84d0bfd5a867de11c72c
Author: Claudiu Manoil <[email protected]>

net: enetc: Enable probing of version 4.4 devices

This commit adds driver data and platform info entries for ENETC v4.4 PF and VF devices on S32N79 SoCs with a 500 MHz system clock frequency.

Will add this line to the commit message.

Quoted 6 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/net/ethernet/freescale/enetc/enetc.c

Quoted 3 lines

index c6571b5cc8425..b989823859ff2 100644

drivers/net/ethernet/freescale/enetc/enetc.c +0 -0

[...]

Quoted 3 lines

Can probing ENETC v4.4 on an 8-core S32N79 SoC overflow priv->int_vector[] in enetc_int_vector_init()?

I already have a downstream 'fix' for this, where int_vector is allocated dynamically. I'm going to include it in the v4 patchset. Since this issue only affects the new chip (S32N79), it's not a 'net' kind of fix.

[...]

Quoted 2 lines

Link:

[...]

Quoted 6 lines

This does seem to be a legitimate concern to me, and I think it warrants a v4.

There is also a review of patch 1/5, here, which I think warrants investigation too.

Link:

[...]

Thanks for sharing the links, I wasn't aware that Sashiko already scrutinized v3.

Regards
Claudiu

author maintainer
#7 lore raw

PATCH v3 3/5 arm64: dts: s32n79: add NETC IEP18 ECAM node for ENETC PPM ports

In reply to Claudiu Manoil

Add the netc_iep18 PCIe ECAM host node describing the NETC integrated endpoint bus allocated to the first Linux cohort on S32N79. The bus is enumerated via the generic pci-host-ecam-generic driver and hosts the ENETC v4 Pseudo-MAC (PPM) PF and its VFs, which connect internally to the on-chip NETC switch (not owned by Linux).

The node is kept disabled at the SoC level; boards that wire up NETC enable it. MSIs are routed through the GIC-v3 ITS (msi-map) and DMA is translated by the SMMUv3 (iommu-map).

---
v3: none

v2:
- Replaced the 'msi-parent' stub property with 'msi-map', as per H/W spec.

 arch/arm64/boot/dts/freescale/s32n79.dtsi | 24 +++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/freescale/s32n79.dtsi +24 -0
index 94ab58783fdc8..65cf65e828328 100644
@@ -122,6 +122,30 @@ irqsteer_coss: interrupt-controller@4ed00000 {
 		};
 	};
 
+	nwss-bus {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges = <0x0 0x48800000 0x0 0x48800000 0x0 0x4b0000>,
+			 <0x2 0x40000000 0x2 0x40000000 0x0 0x20000000>;
+
+		netc_iep18: pcie@241200000 {
+			compatible = "pci-host-ecam-generic";
+			reg = <0x2 0x41200000 0x0 0x100000>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			device_type = "pci";
+			bus-range = <0x0 0x0>;
+			iommu-map = <0x0 &smmu 0xc0000 0x100>;
+			msi-map = <0x0 &its 0xc0000 0x100>;
+			dma-coherent;
+			status = "disabled";
+
+			/* All NETC PCIe functions */
+			ranges = <0x82000000 0x0 0x48800000 0x0 0x48800000 0x0 0x4b0000>;
+		};
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
Signature · 1 line
2.34.1
author maintainer
#8 lore raw

PATCH v3 4/5 arm64: dts: s32n79-rdb: enable NETC IEP18

In reply to Claudiu Manoil

Enable the NETC v4 ECAM bus #18 on the S32N79-RDB board so that the ENETC v4 Pseudo-MAC port (PPM) PF and VF instances are probed.

---
v3: none
v2: none

 arch/arm64/boot/dts/freescale/s32n79-rdb.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/freescale/s32n79-rdb.dts +4 -0
index 1feccd61258ef..897ba24ac03ae 100644
@@ -68,3 +68,7 @@ &usdhc0 {
 	no-sdio;
 	status = "okay";
 };
+
+&netc_iep18 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
author maintainer
#9 lore raw

PATCH v3 5/5 PCI: Create OF node for NXP ENETC pseudo-MAC functions

In reply to Claudiu Manoil

NXP ENETCv4 pseudo-MAC (PPM) ports can be probed as pure PCI endpoints, without any "ethernet" node in the static device tree. The ENETC4 driver describes their fixed link by attaching a fixed-link node to the PCI function's own OF node, which requires that node to exist.

Request the PCI core to synthesize a per-function OF node for these devices by registering of_pci_make_dev_node() as a final fixup, following the existing precedent for the Xilinx, Red Hat and EFAR devices. The helper is a no-op when the function already has a static OF node, so this has no effect on platforms that describe ENETC via static DT. It only takes effect when CONFIG_PCI_DYNAMIC_OF_NODES is enabled.

Both ENETC4 PCI device IDs are covered (0xe101 and 0xe110), since either can be instantiated as a pseudo-MAC port on S32N79.

---
v3: none
v2: none (reworded the overlay reference to match patch 1's fixed-link
approach; no functional change)

 drivers/pci/quirks.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/pci/quirks.c +2 -0
index 7f1f47ea2ee41..71f272d8a2965 100644
@@ -6563,6 +6563,8 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, 0x9660, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TOSHIBA, 0x0220, of_pci_make_dev_node);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PHILIPS, 0xe101, of_pci_make_dev_node);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PHILIPS, 0xe110, of_pci_make_dev_node);
 
 /*
  * Devices known to require a longer delay before first config space access
Signature · 1 line
2.34.1
#10 lore raw

Re: [PATCH net-next v3 5/5] PCI: Create OF node for NXP ENETC pseudo-MAC functions

Sashiko has reviewed this patch and found no issues.
Quoted 12 lines

NXP ENETCv4 pseudo-MAC (PPM) ports can be probed as pure PCI endpoints, without any "ethernet" node in the static device tree. The ENETC4 driver describes their fixed link by attaching a fixed-link node to the PCI function's own OF node, which requires that node to exist.

Request the PCI core to synthesize a per-function OF node for these devices by registering of_pci_make_dev_node() as a final fixup, following the existing precedent for the Xilinx, Red Hat and EFAR devices. The helper is a no-op when the function already has a static OF node, so this has no effect on platforms that describe ENETC via static DT. It only takes effect when CONFIG_PCI_DYNAMIC_OF_NODES is enabled.

Quoted 4 lines

Both ENETC4 PCI device IDs are covered (0xe101 and 0xe110), since either can be instantiated as a pseudo-MAC port on S32N79.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5