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: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dan Williams
2009-01-11 00:20:39 -08:00
committed by David S. Miller
parent 47fd23fe8e
commit 649274d993
2 changed files with 20 additions and 3 deletions

View File

@ -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;