Remove the fixed size channels[NR_CPUS] array in
net/core/dev.c and dynamically allocate array based on
nr_cpu_ids.
Based on:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
Cc: David S. Miller <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Mike Travis <travis@sgi.com>
---
v2: fixed logic error in netdev_dma_register().
---
net/core/dev.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- linux.trees.git.orig/net/core/dev.c
+++ linux.trees.git/net/core/dev.c
@@ -162,7 +162,7 @@ struct net_dma {
struct dma_client client;
spinlock_t lock;
cpumask_t channel_mask;
- struct dma_chan *channels[NR_CPUS];
+ struct dma_chan **channels;
};
static enum dma_state_client
@@ -2444,7 +2444,7 @@ static struct netif_rx_stats *softnet_ge
{
struct netif_rx_stats *rc = NULL;
- while (*pos < NR_CPUS)
+ while (*pos < nr_cpu_ids)
if (cpu_online(*pos)) {
rc = &per_cpu(netdev_rx_stat, *pos);
break;
@@ -4316,7 +4316,7 @@ netdev_dma_event(struct dma_client *clie
spin_lock(&net_dma->lock);
switch (state) {
case DMA_RESOURCE_AVAILABLE:
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < nr_cpu_ids; i++)
if (net_dma->channels[i] == chan) {
found = 1;
break;
@@ -4331,7 +4331,7 @@ netdev_dma_event(struct dma_client *clie
}
break;
case DMA_RESOURCE_REMOVED:
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < nr_cpu_ids; i++)
if (net_dma->channels[i] == chan) {
found = 1;
pos = i;
@@ -4358,6 +4358,13 @@ netdev_dma_event(struct dma_client *clie
*/
static int __init netdev_dma_register(void)
{
+ net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma),
+ GFP_KERNEL);
+ if (unlikely(!net_dma.channels)) {
+ printk(KERN_NOTICE
+ "netdev_dma: no memory for net_dma.channels\n");
+ return -ENOMEM;
+ }
spin_lock_init(&net_dma.lock);
dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask);
dma_async_client_register(&net_dma.client);
--
--
| David Miller | [GIT]: Networking |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
| Miklos Szeredi | Re: [PATCH] Remove process freezer from suspend to RAM pathway |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| David Kastrup | Re: git on MacOSX and files with decomposed utf-8 file names |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Nguyen Thai Ngoc Duy | [WIP] Get rid of msys in favor of busybox port for windows |
| sean | Adding color to git diff output. |
| Richard Stallman | Real men don't attack straw men |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| carlopmart | About Xen: maybe a reiterative question but .. |
| Douglas A. Tutty | Re: Embedding OpenBSD |
| Pavel Emelyanov | [PATCH net-2.6.25 8/11][IPV6] Use sysctl paths to register ipv6 sysctl tables |
| Jeff Garzik | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Denys | r8169 crash |
| Jeff Kirsher | [NET-NEXT PATCH 1/3] e1000e: add support for the 82567LM-4 device |
