From: sashiko-bot@kernel.org
To: "Wei Fang" <wei.fang@nxp.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v2 net-next 12/12] net: enetc: dynamically allocate rxmsg based on VF count
Date: Sat, 30 May 2026 00:46:30 +0000 [thread overview]
Message-ID: <20260530004630.C32C51F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260522092438.1264020-13-wei.fang@nxp.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] VLAN promiscuous mode is silently broken for Virtual Functions beyond the first two due to a hardcoded 3-bit mask.
- [High] Potential division by zero when allocating hardware rings to VFs if the device supports 0 VFs and has more than 8 rings.
--
commit 03bc9cb8ddeec88c130b193926ea03b84b9d152b
Author: Wei Fang <wei.fang@nxp.com>
net: enetc: dynamically allocate rxmsg based on VF count
This commit updates the ENETC driver to dynamically allocate the rxmsg array
based on the actual number of Virtual Functions supported by the hardware.
It removes the fixed allocation size to prevent memory over-allocation on
hardware variants with fewer or zero VFs.
> i.MX94 standalone ENETC: 0 VFs
[Severity: High]
This is a pre-existing issue, but if a device supports 0 VFs and reports
more than 8 hardware rings during probe, will this result in a division by
zero?
In enetc_port_si_configure(), the driver reserves 8 rings for the PF and
distributes the rest to the VFs:
drivers/net/ethernet/freescale/enetc/enetc_pf.c:enetc_port_si_configure() {
...
if (num_rings)
num_rings -= ENETC_PF_NUM_RINGS;
...
if (num_rings) {
num_rings /= pf->total_vfs;
val |= ENETC_PSICFGR0_SET_TXBDR(num_rings);
val |= ENETC_PSICFGR0_SET_RXBDR(num_rings);
}
...
}
If pf->total_vfs is 0 and there are remaining rings, the division by zero
will cause a kernel panic.
> i.MX94 internal ENETC: 3 VFs
[Severity: High]
This isn't a bug introduced by this patch, but since 3 VFs means there are
4 Station Interfaces (1 PF + 3 VFs) in total, will VLAN promiscuous mode
work for the 3rd VF?
The ENETC_PSIPVMR_SET_VP() macro uses a hardcoded 0x7 mask (3 bits), which
covers only the first 3 Station Interfaces:
drivers/net/ethernet/freescale/enetc/enetc_hw.h:
#define ENETC_PSIPVMR_SET_VP(simap) ((simap) & 0x7)
Because of this mask, the 4th Station Interface (the 3rd VF mapped to bit 3)
is silently dropped from the VLAN promiscuous mode configuration.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260522092438.1264020-1-wei.fang@nxp.com?part=12
next prev parent reply other threads:[~2026-05-30 0:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 9:24 [PATCH v2 net-next 00/12] net: enetc: Prepare for ENETC v4 VF support Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 01/12] net: enetc: use enetc_set_si_hw_addr() for setting MAC address Wei Fang
2026-05-30 0:46 ` sashiko-bot
2026-05-22 9:24 ` [PATCH v2 net-next 02/12] net: enetc: move VF message handlers to enetc_msg.c Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 03/12] net: enetc: relocate SR-IOV configuration helper for common PF support Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 04/12] net: enetc: integrate enetc_msg.c into enetc-pf-common driver Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 05/12] net: enetc: use read_poll_timeout() for VF mailbox polling Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 06/12] net: enetc: convert mailbox messages to new formats Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 07/12] net: enetc: add VF-PF messaging support for IP minor revision query Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 08/12] net: enetc: align v1 CBDR API with v4 for VF driver sharing Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 09/12] net: enetc: add CBDR setup/teardown hooks to enetc_si_ops for VF support Wei Fang
2026-05-30 0:46 ` sashiko-bot
2026-05-22 9:24 ` [PATCH v2 net-next 10/12] net: enetc: add generic helper to initialize SR-IOV resources Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 11/12] net: enetc: use MADDR_TYPE for MAC filter array size Wei Fang
2026-05-22 9:24 ` [PATCH v2 net-next 12/12] net: enetc: dynamically allocate rxmsg based on VF count Wei Fang
2026-05-25 2:36 ` Wei Fang
2026-05-30 0:46 ` sashiko-bot [this message]
2026-05-26 11:30 ` [PATCH v2 net-next 00/12] net: enetc: Prepare for ENETC v4 VF support patchwork-bot+netdevbpf
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=20260530004630.C32C51F00899@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@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