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?