From: sashiko-bot@kernel.org
To: wei.fang@oss.nxp.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH v4 net-next 12/14] net: enetc: remove redundant num_vsi field from enetc_port_caps
Date: Wed, 08 Jul 2026 08:48:30 +0000 [thread overview]
Message-ID: <20260708084830.90E5E1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260707081834.710730-13-wei.fang@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Hardware ring overallocation when CONFIG_PCI_IOV is disabled due to uninitialized VSI PSICFGR0 registers.
--
--- Patch [12]: [PATCH v4 net-next 12/14] net: enetc: remove redundant num_vsi field from enetc_port_caps ---
commit d0ac7548c05e5390933f00261830b4e5d8ae719a
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: remove redundant num_vsi field from enetc_port_caps
This commit removes the num_vsi field from the enetc_port_caps structure
and replaces its usage with pf->total_vfs. The justification is that
pf->total_vfs already reflects the number of VFs that can actually be used.
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index cab79f81d6fe0..fcfbabb29d22e 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
[ ... ]
> @@ -255,34 +254,35 @@ static void enetc4_default_rings_allocation(struct enetc_pf *pf)
> {
> struct enetc_hw *hw = &pf->si->hw;
> u32 num_rx_bdr, num_tx_bdr, val;
> + int num_vfs = pf->total_vfs;
> u32 vf_tx_bdr, vf_rx_bdr;
> int i, rx_rem, tx_rem;
>
> - if (pf->caps.num_rx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi)
> - num_rx_bdr = pf->caps.num_rx_bdr - pf->caps.num_vsi;
> + if (pf->caps.num_rx_bdr < ENETC_SI_MAX_RING_NUM + num_vfs)
> + num_rx_bdr = pf->caps.num_rx_bdr - num_vfs;
> else
> num_rx_bdr = ENETC_SI_MAX_RING_NUM;
>
> - if (pf->caps.num_tx_bdr < ENETC_SI_MAX_RING_NUM + pf->caps.num_vsi)
> - num_tx_bdr = pf->caps.num_tx_bdr - pf->caps.num_vsi;
> + if (pf->caps.num_tx_bdr < ENETC_SI_MAX_RING_NUM + num_vfs)
> + num_tx_bdr = pf->caps.num_tx_bdr - num_vfs;
> else
> num_tx_bdr = ENETC_SI_MAX_RING_NUM;
>
> val = enetc4_psicfgr0_val_construct(false, num_tx_bdr, num_rx_bdr);
> enetc_port_wr(hw, ENETC4_PSICFGR0(0), val);
>
> - if (!pf->caps.num_vsi)
> + if (!num_vfs)
> return;
[Severity: High]
In enetc4_default_rings_allocation(), when num_vfs is 0 (such as when
CONFIG_PCI_IOV is disabled), this returns early without zeroing the ring
allocations in the VSIs' PSICFGR0 registers.
Because num_vfs is 0 instead of the true physical VSI count, the PF is
allocated the maximum possible hardware rings.
If these VSI registers retain non-zero values (e.g., from firmware defaults
or after a warm reboot), won't the sum of configured rings across the PF and
VSIs strictly exceed the physical hardware capacity?
Could this lead to memory corruption within the ENETC device's internal
SRAM or cause DMA issues due to overlapping BD ring structures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707081834.710730-1-wei.fang@oss.nxp.com?part=12
next prev parent reply other threads:[~2026-07-08 8:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 8:18 [PATCH v4 net-next 00/14] net: enetc: cleanups and improvements wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 01/14] net: enetc: extract common helpers for MAC promiscuous mode setting wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 02/14] net: enetc: extract common helpers for MAC hash filter configuration wei.fang
2026-07-08 8:48 ` sashiko-bot
2026-07-07 8:18 ` [PATCH v4 net-next 03/14] net: enetc: convert ndo_set_rx_mode() to ndo_set_rx_mode_async() wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 04/14] net: enetc: improve MAFT entry management with bitmap tracking wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 05/14] net: enetc: use PCI device name for debugfs directory wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 06/14] net: enetc: simplify enetc4_set_port_speed() wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 07/14] net: enetc: differentiate phylink capabilities for pseudo-MAC and standalone MAC wei.fang
2026-07-08 8:48 ` sashiko-bot
2026-07-07 8:18 ` [PATCH v4 net-next 08/14] net: enetc: remove invalid code from enetc4_pl_mac_link_up() wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 09/14] net: enetc: open-code enetc4_set_default_si_vlan_promisc() wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 10/14] net: enetc: refactor SI VLAN promiscuous mode configuration wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 11/14] net: enetc: move enetc_set_si_vlan_promisc() to enetc_pf_common.c wei.fang
2026-07-07 8:18 ` [PATCH v4 net-next 12/14] net: enetc: remove redundant num_vsi field from enetc_port_caps wei.fang
2026-07-08 8:48 ` sashiko-bot [this message]
2026-07-08 12:01 ` Wei Fang (OSS)
2026-07-07 8:18 ` [PATCH v4 net-next 13/14] net: enetc: use alloc_etherdev_mqs() to create netdev for VF driver wei.fang
2026-07-08 8:48 ` sashiko-bot
2026-07-07 8:18 ` [PATCH v4 net-next 14/14] net: enetc: use kzalloc_flex() for enetc_psfp_gate allocation wei.fang
2026-07-08 8:48 ` sashiko-bot
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=20260708084830.90E5E1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wei.fang@oss.nxp.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