Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95896
b: refs/heads/master
c: 0c0b0ac
h: refs/heads/master
v: v3
  • Loading branch information
Mike Travis authored and David S. Miller committed May 2, 2008
1 parent d832fc3 commit 2b5302f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d3e2ce3bcdbf4319dea308c79b5f72a8ecc8015c
refs/heads/master: 0c0b0aca66b3a58e12a216d992a0b534eff210e0
15 changes: 11 additions & 4 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2444,7 +2444,7 @@ static struct netif_rx_stats *softnet_get_online(loff_t *pos)
{
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;
Expand Down Expand Up @@ -4324,7 +4324,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
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;
Expand All @@ -4339,7 +4339,7 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
}
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;
Expand All @@ -4366,6 +4366,13 @@ netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
*/
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);
Expand Down

0 comments on commit 2b5302f

Please sign in to comment.