aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
commita1744d3bee19d3b9cbfb825ab316a101b9c9f109 (patch)
treec0e2324c09beca0eb5782eb5abf241ea2b7a4a11 /net/core
parent275f165fa970174f8a98205529750e8abb6c0a33 (diff)
parenta432226614c5616e3cfd211e0acffa0acfb4770c (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/p54/p54common.c
Diffstat (limited to 'net/core')
-rw-r--r--net/core/net_namespace.c32
-rw-r--r--net/core/pktgen.c27
2 files changed, 45 insertions, 14 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 861b4cbf40d..55cffad2f32 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -324,6 +324,38 @@ void unregister_pernet_subsys(struct pernet_operations *module)
324} 324}
325EXPORT_SYMBOL_GPL(unregister_pernet_subsys); 325EXPORT_SYMBOL_GPL(unregister_pernet_subsys);
326 326
327int register_pernet_gen_subsys(int *id, struct pernet_operations *ops)
328{
329 int rv;
330
331 mutex_lock(&net_mutex);
332again:
333 rv = ida_get_new_above(&net_generic_ids, 1, id);
334 if (rv < 0) {
335 if (rv == -EAGAIN) {
336 ida_pre_get(&net_generic_ids, GFP_KERNEL);
337 goto again;
338 }
339 goto out;
340 }
341 rv = register_pernet_operations(first_device, ops);
342 if (rv < 0)
343 ida_remove(&net_generic_ids, *id);
344 mutex_unlock(&net_mutex);
345out:
346 return rv;
347}
348EXPORT_SYMBOL_GPL(register_pernet_gen_subsys);
349
350void unregister_pernet_gen_subsys(int id, struct pernet_operations *ops)
351{
352 mutex_lock(&net_mutex);
353 unregister_pernet_operations(ops);
354 ida_remove(&net_generic_ids, id);
355 mutex_unlock(&net_mutex);
356}
357EXPORT_SYMBOL_GPL(unregister_pernet_gen_subsys);
358
327/** 359/**
328 * register_pernet_device - register a network namespace device 360 * register_pernet_device - register a network namespace device
329 * @ops: pernet operations structure for the subsystem 361 * @ops: pernet operations structure for the subsystem
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 18dd83c2ead..fa4973bf73e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1972,28 +1972,27 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
1972 1972
1973 /* make sure that we don't pick a non-existing transmit queue */ 1973 /* make sure that we don't pick a non-existing transmit queue */
1974 ntxq = pkt_dev->odev->real_num_tx_queues; 1974 ntxq = pkt_dev->odev->real_num_tx_queues;
1975 if (ntxq <= num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) { 1975 if (ntxq > num_online_cpus() && (pkt_dev->flags & F_QUEUE_MAP_CPU)) {
1976 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU " 1976 printk(KERN_WARNING "pktgen: WARNING: QUEUE_MAP_CPU "
1977 "disabled because CPU count (%d) exceeds number ", 1977 "disabled because CPU count (%d) exceeds number "
1978 num_online_cpus()); 1978 "of tx queues (%d) on %s\n", num_online_cpus(), ntxq,
1979 printk(KERN_WARNING "pktgen: WARNING: of tx queues " 1979 pkt_dev->odev->name);
1980 "(%d) on %s \n", ntxq, pkt_dev->odev->name);
1981 pkt_dev->flags &= ~F_QUEUE_MAP_CPU; 1980 pkt_dev->flags &= ~F_QUEUE_MAP_CPU;
1982 } 1981 }
1983 if (ntxq <= pkt_dev->queue_map_min) { 1982 if (ntxq <= pkt_dev->queue_map_min) {
1984 printk(KERN_WARNING "pktgen: WARNING: Requested " 1983 printk(KERN_WARNING "pktgen: WARNING: Requested "
1985 "queue_map_min (%d) exceeds number of tx\n", 1984 "queue_map_min (zero-based) (%d) exceeds valid range "
1986 pkt_dev->queue_map_min); 1985 "[0 - %d] for (%d) queues on %s, resetting\n",
1987 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1986 pkt_dev->queue_map_min, (ntxq ?: 1)- 1, ntxq,
1988 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1987 pkt_dev->odev->name);
1989 pkt_dev->queue_map_min = ntxq - 1; 1988 pkt_dev->queue_map_min = ntxq - 1;
1990 } 1989 }
1991 if (ntxq <= pkt_dev->queue_map_max) { 1990 if (pkt_dev->queue_map_max >= ntxq) {
1992 printk(KERN_WARNING "pktgen: WARNING: Requested " 1991 printk(KERN_WARNING "pktgen: WARNING: Requested "
1993 "queue_map_max (%d) exceeds number of tx\n", 1992 "queue_map_max (zero-based) (%d) exceeds valid range "
1994 pkt_dev->queue_map_max); 1993 "[0 - %d] for (%d) queues on %s, resetting\n",
1995 printk(KERN_WARNING "pktgen: WARNING: queues (%d) on " 1994 pkt_dev->queue_map_max, (ntxq ?: 1)- 1, ntxq,
1996 "%s, resetting\n", ntxq, pkt_dev->odev->name); 1995 pkt_dev->odev->name);
1997 pkt_dev->queue_map_max = ntxq - 1; 1996 pkt_dev->queue_map_max = ntxq - 1;
1998 } 1997 }
1999 1998