Skip to contentSkip to conversation

net: eth: altera: set rx and tx ring size before init_dma call

PATCH In review Tham, Mun Yew 2 participants 3 messages May 31, 2022 – Jun 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: eth: altera: set rx and tx ring size before init_dma call

It is more appropriate to set the rx and tx ring size before calling the init function for the dma.

---
 drivers/net/ethernet/altera/altera_tse_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/altera/altera_tse_main.c +4 -2
index 1c00d719e5d7..ebfddad05e7e 100644
@@ -1152,6 +1152,10 @@ static int tse_open(struct net_device *dev)
 	int i;
 	unsigned long int flags;
 
+	/* set tx and rx ring size */
+	priv->rx_ring_size = dma_rx_num;
+	priv->tx_ring_size = dma_tx_num;
+
 	/* Reset and configure TSE MAC and probe associated PHY */
 	ret = priv->dmaops->init_dma(priv);
 	if (ret != 0) {
@@ -1194,8 +1198,6 @@ static int tse_open(struct net_device *dev)
 	priv->dmaops->reset_dma(priv);
 
 	/* Create and initialize the TX/RX descriptors chains. */
-	priv->rx_ring_size = dma_rx_num;
-	priv->tx_ring_size = dma_tx_num;
 	ret = alloc_init_skbufs(priv);
 	if (ret) {
 		netdev_err(dev, "DMA descriptors initialization failed\n");
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 2 lines · Mun Yew

It is more appropriate to set the rx and tx ring size before calling the init function for the dma.

Improve the commit message please, this tells us nothing. It's hardly a well know software design best practice to set some random thing before calling another random thing. AFAICT neither dma implementation upstream cares about priv->[tr]x_ring_size, do they?

If you're doing this to prepare for adding another DMA engine, please post this patch together with the support being added.

#2 lore raw
Quoted 10 lines · Mun Yew
Quoted 2 lines

It is more appropriate to set the rx and tx ring size before calling the init function for the dma.

Improve the commit message please, this tells us nothing.
It's hardly a well know software design best practice to set some random thing before calling another random thing. AFAICT neither dma implementation upstream cares about
priv->[tr]x_ring_size, do they?

If you're doing this to prepare for adding another DMA engine, please post this patch together with the support being added.

Noted, will post this patch together. Thanks.