Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1345909

[PATCH net 2/5] dwc_eth_qos: release descriptors outside netif_tx_lock

From Lars Persson <lars.persson@axis.com>
Newsgroups linux.kernel
Subject [PATCH net 2/5] dwc_eth_qos: release descriptors outside netif_tx_lock
Date 2016-02-29 16:30 +0100
Message-ID <r7xVM-4Nd-21@gated-at.bofh.it> (permalink)
References <r7xVL-4Nd-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


To prepare for using the CMA, we can not be in atomic context when
de-allocating DMA buffers.

The tx lock was needed only to protect the hw reset against the xmit
handler. Now we briefly grab the tx lock while stopping the queue to
make sure no thread is inside or will enter the xmit handler.

Signed-off-by: Lars Persson <larper@axis.com>
---
 drivers/net/ethernet/synopsys/dwc_eth_qos.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
index 926db2d..53d48c0 100644
--- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c
+++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c
@@ -1918,15 +1918,17 @@ static int dwceqos_stop(struct net_device *ndev)
 	phy_stop(lp->phy_dev);
 
 	tasklet_disable(&lp->tx_bdreclaim_tasklet);
-	netif_stop_queue(ndev);
 	napi_disable(&lp->napi);
 
-	dwceqos_drain_dma(lp);
+	/* Stop all tx before we drain the tx dma. */
+	netif_tx_lock_bh(lp->ndev);
+	netif_stop_queue(ndev);
+	netif_tx_unlock_bh(lp->ndev);
 
-	netif_tx_lock(lp->ndev);
+	dwceqos_drain_dma(lp);
 	dwceqos_reset_hw(lp);
+
 	dwceqos_descriptor_free(lp);
-	netif_tx_unlock(lp->ndev);
 
 	return 0;
 }
-- 
2.1.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net 0/5] dwc_eth_qos: stability fixes and support for CMA Lars Persson <lars.persson@axis.com> - 2016-02-29 16:30 +0100
  [PATCH net 2/5] dwc_eth_qos: release descriptors outside netif_tx_lock Lars Persson <lars.persson@axis.com> - 2016-02-29 16:30 +0100
  [PATCH net 5/5] dwc_eth_qos: do phy_start before resetting hardware Lars Persson <lars.persson@axis.com> - 2016-02-29 16:30 +0100
  [PATCH net 4/5] dwc_eth_qos: use DWCEQOS_MSG_DEFAULT Lars Persson <lars.persson@axis.com> - 2016-02-29 16:30 +0100
  Re: [PATCH net 0/5] dwc_eth_qos: stability fixes and support for  CMA David Miller <davem@davemloft.net> - 2016-03-02 21:10 +0100

csiph-web