Thread (1 message) 1 message, 1 author, 19h ago

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 05:54:38
Also in: imx, sashiko-reviews

quoted
-	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),
+				  min(si->num_rx_rings, ENETC_MAX_NUM_TXQS));
[Severity: Low]
Does this code handle the case where the hardware reports 0 rings?
The number of rings cannot be zero; if it is, then it's a severe bug.
If si->num_tx_rings or si->num_rx_rings is 0, this passes 0 to
alloc_etherdev_mqs(), which triggers a "Unable to allocate device with zero
queues" pr_err() in the network core and returns NULL. The previous hardcoded
ENETC_MAX_NUM_TXQS guaranteed a valid count.

Should there be a check to ensure the ring counts are at least 1?
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help