From: Lars Persson <lars.persson@axis.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Lars Persson <larper@axis.com>
Subject: [PATCH net 2/5] dwc_eth_qos: release descriptors outside netif_tx_lock
Date: Mon, 29 Feb 2016 16:22:31 +0100 [thread overview]
Message-ID: <405b7bbe8cceacc7edea2f415b7fbb21aa16ea6f.1456756740.git.larper@axis.com> (raw)
In-Reply-To: <cover.1456756740.git.larper@axis.com>
In-Reply-To: <cover.1456756740.git.larper@axis.com>
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
next prev parent reply other threads:[~2016-02-29 15:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-29 15:22 [PATCH net 0/5] dwc_eth_qos: stability fixes and support for CMA Lars Persson
2016-02-29 15:22 ` [PATCH net 1/5] dwc_eth_qos: fix race condition in dwceqos_start_xmit Lars Persson
2016-02-29 15:22 ` Lars Persson [this message]
2016-02-29 15:22 ` [PATCH net 3/5] dwc_eth_qos: use GFP_KERNEL in dma_alloc_coherent() Lars Persson
2016-02-29 15:22 ` [PATCH net 4/5] dwc_eth_qos: use DWCEQOS_MSG_DEFAULT Lars Persson
2016-02-29 15:22 ` [PATCH net 5/5] dwc_eth_qos: do phy_start before resetting hardware Lars Persson
2016-03-02 20:01 ` [PATCH net 0/5] dwc_eth_qos: stability fixes and support for CMA David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=405b7bbe8cceacc7edea2f415b7fbb21aa16ea6f.1456756740.git.larper@axis.com \
--to=lars.persson@axis.com \
--cc=larper@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®