RE: [PATCH RESEND v4 net-next 13/14] net: enetc: use alloc_etherdev_mqs() to create netdev for VF driver
From: Wei Fang (OSS) <hidden>
Date: 2026-07-21 02:01:39
Also in:
imx, linux-arm-kernel, linuxppc-dev, lkml
On Mon, Jul 20, 2026 at 09:43:15AM +0800, wei.fang@oss.nxp.com wrote:quoted
From: Wei Fang <wei.fang@nxp.com> The VF driver uses alloc_etherdev_mq() with ENETC_MAX_NUM_TXQS as the queue count, which forces the TX and RX queue counts to be equal and uses a compile-time constant rather than the actual hardware capability. After enetc_get_si_caps() is called, si->num_tx_rings and si->num_rx_rings reflect the actual number of rings assigned to the VF by the PF. For the ENETC VF on LS1028A and the upcoming i.MX95/94, their SoCs have no more than 6 CPUs, and the number of TX/RX rings allocated to the VF is less than 8. Therefore, switch to alloc_etherdev_mqs() so that the TX and RX queue counts are set independently, each capped at ENETC_MAX_NUM_TXQS, based on the actual number of rings assigned to the VF by the PF. Note that if future SoCs have more than 6 CPUs and more than 6 RX rings allocated to VFs, the size of the int_vector array in struct enetc_ndev_priv will need to be modified. Similarly, if more than 8 TX rings are allocated to each int_vector, ENETC_MAX_NUM_TXQS will also need to be modified. Signed-off-by: Wei Fang <wei.fang@nxp.com> --- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.cb/drivers/net/ethernet/freescale/enetc/enetc_vf.cquoted
index 9cdb0a4d6baf..7dcb4a0246f5 100644--- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c@@ -317,7 +317,14 @@ static int enetc_vf_probe(struct pci_dev *pdev, enetc_get_si_caps(si); - ndev = alloc_etherdev_mq(sizeof(*priv), ENETC_MAX_NUM_TXQS); + /* Currently, the supported SoCs have a max of 6 CPUs and the VFs + * have less than 6 RX/TX rings. So no issues for these supported + * SoCs, but for future SoCs which have more CPUs or more TX/RX + * rings, all the related logic needs to be improved. + */ + ndev = alloc_etherdev_mqs(sizeof(*priv), + min(si->num_tx_rings,ENETC_MAX_NUM_TXQS),quoted
+ min(si->num_rx_rings,ENETC_MAX_NUM_TXQS)); Code looks right, but looks almost like a typo. I guess it would read nicer if ENETC_MAX_NUM_RXQS existed?
Yes, ENETC_MAX_NUM_RXQS is clearer. However, ENETC_MAX_NUM_RXQS does not exist; in fact, their values are equal, and we plan to remove ENETC_MAX_NUM_TXQS later, so a new macro ENETC_MAX_NUM_RXQS was not added in this patch.
That said: Reviewed-by: Joe Damato <redacted>