Messages in this thread | | | Date | Wed, 05 Feb 2020 14:39:24 +0100 (CET) | Subject | Re: [PATCH net v4 1/6] net: stmmac: Fix incorrect location to set real_num_rx|tx_queues | From | David Miller <> |
| |
From: Ong Boon Leong <boon.leong.ong@intel.com> Date: Wed, 5 Feb 2020 16:55:05 +0800
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 5836b21edd7e..4d9afa13eeb9 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -2657,6 +2657,10 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) > stmmac_enable_tbs(priv, priv->ioaddr, enable, chan); > } > > + /* Configure real RX and TX queues */ > + netif_set_real_num_rx_queues(dev, priv->plat->rx_queues_to_use); > + netif_set_real_num_tx_queues(dev, priv->plat->tx_queues_to_use); > + > /* Start the ball rolling... */ > stmmac_start_all_dma(priv); >
It is only safe to ignore the return values from netif_set_real_num_{rx,tx}_queues() if you call them before the network device is registered. Because only in that case are these functions guaranteed to succeed.
But now that you have moved these calls here, they can fail.
Therefore you must check the return value and unwind the state completely upon failures.
Honestly, I think this change will have several undesirable side effects:
1) Lots of added new code complexity
2) A new failure mode when resuming the device, users will find this very hard to diagnose and recover from
What real value do you get from doing these calls after probe?
If you can't come up with a suitable answer to that question, you should reconsider this change.
Thanks.
| |