Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 649274d9 authored by Dan Williams's avatar Dan Williams Committed by David S. Miller
Browse files

net_dma: acquire/release dma channels on ifup/ifdown



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: default avatarMaciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47fd23fe
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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,
+10 −3
Original line number Diff line number Diff line
@@ -1087,6 +1087,11 @@ int dev_open(struct net_device *dev)
		 */
		dev->flags |= IFF_UP;

		/*
		 *	Enable NET_DMA
		 */
		dmaengine_get();

		/*
		 *	Initialize multicasting status
		 */
@@ -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;