]> git.hungrycats.org Git - linux/commit
net: enetc: dynamically allocate rxmsg based on VF count
authorWei Fang <wei.fang@nxp.com>
Fri, 22 May 2026 09:24:38 +0000 (17:24 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 26 May 2026 11:20:13 +0000 (13:20 +0200)
commit9d7b650888ff532f3d2f92722143c39ab780a6f6
tree8aeef43f9d0a0c0c7d8501c0820cb0bb2c43226f
parentc55a33014b52b8c0c2f2fdc99dd805b8fc913949
net: enetc: dynamically allocate rxmsg based on VF count

The constant ENETC_MAX_NUM_VFS is defined as 2 when enabling support for
LS1028A. This works for LS1028A because its ENETC hardware supports up
to 2 VFs. However, ENETC v4 has varying VF capabilities depending on the
SoC:

i.MX94 standalone ENETC: 0 VFs
i.MX94 internal ENETC:   3 VFs
i.MX952:                 1 VF

Using a fixed ENETC_MAX_NUM_VFS for memory allocation leads to
over-allocation on SoCs with fewer or no VF support. To better match
hardware capabilities and avoid unnecessary memory usage, change rxmsg
memory allocation from a fixed-size array to dynamic allocation based
on the actual VF count retrieved via pci_sriov_get_totalvfs().

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/20260522092438.1264020-13-wei.fang@nxp.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/freescale/enetc/enetc_hw.h
drivers/net/ethernet/freescale/enetc/enetc_pf.h
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c