netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net_dma: acquire/release dma channels on ifup/ifdown
@ 2009-01-09 23:57 Dan Williams
  2009-01-11  8:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Williams @ 2009-01-09 23:57 UTC (permalink / raw)
  To: davem; +Cc: netdev, maciej.sosnowski

The recent dmaengine rework removed the capability to remove dma device
driver modules while net_dma is active.  Rather than notify
dmaengine-clients that channels are trying to be removed, we now rely on
clients to notify dmaengine when they no longer have a need for
channels.  Teach net_dma to release channels by taking dmaengine
references at netdevice open and dropping references at netdevice close.

Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 include/linux/dmaengine.h |   10 ++++++++++
 net/core/dev.c            |   13 ++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 64dea2a..c73f1e2 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -270,8 +270,18 @@ struct dma_device {
 
 /* --- public DMA engine API --- */
 
+#ifdef CONFIG_DMA_ENGINE
 void dmaengine_get(void);
 void dmaengine_put(void);
+#else
+static inline void dmaengine_get(void)
+{
+}
+static inline void dmaengine_put(void)
+{
+}
+#endif
+
 dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
 	void *dest, void *src, size_t len);
 dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
diff --git a/net/core/dev.c b/net/core/dev.c
index 5f736f1..b715a55 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1088,6 +1088,11 @@ int dev_open(struct net_device *dev)
 		dev->flags |= IFF_UP;
 
 		/*
+		 *	Enable NET_DMA
+		 */
+		dmaengine_get();
+
+		/*
 		 *	Initialize multicasting status
 		 */
 		dev_set_rx_mode(dev);
@@ -1164,6 +1169,11 @@ int dev_close(struct net_device *dev)
 	 */
 	call_netdevice_notifiers(NETDEV_DOWN, dev);
 
+	/*
+	 *	Shutdown NET_DMA
+	 */
+	dmaengine_put();
+
 	return 0;
 }
 
@@ -5151,9 +5161,6 @@ static int __init net_dev_init(void)
 	hotcpu_notifier(dev_cpu_callback, 0);
 	dst_init();
 	dev_mcast_init();
-	#ifdef CONFIG_NET_DMA
-	dmaengine_get();
-	#endif
 	rc = 0;
 out:
 	return rc;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net_dma: acquire/release dma channels on ifup/ifdown
  2009-01-09 23:57 [PATCH] net_dma: acquire/release dma channels on ifup/ifdown Dan Williams
@ 2009-01-11  8:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-01-11  8:20 UTC (permalink / raw)
  To: dan.j.williams; +Cc: netdev, maciej.sosnowski

From: Dan Williams <dan.j.williams@intel.com>
Date: Fri, 09 Jan 2009 16:57:53 -0700

> The recent dmaengine rework removed the capability to remove dma device
> driver modules while net_dma is active.  Rather than notify
> dmaengine-clients that channels are trying to be removed, we now rely on
> clients to notify dmaengine when they no longer have a need for
> channels.  Teach net_dma to release channels by taking dmaengine
> references at netdevice open and dropping references at netdevice close.
> 
> Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-11  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 23:57 [PATCH] net_dma: acquire/release dma channels on ifup/ifdown Dan Williams
2009-01-11  8:20 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).