diff options
author | David S. Miller <davem@davemloft.net> | 2009-11-29 03:57:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-29 03:57:15 -0500 |
commit | 9b963e5d0e01461099a40117b05480f24b63381f (patch) | |
tree | 4756d554e37bf4ab7202f2c564cbe629af98b576 /net/core | |
parent | 3b8626ba01a8a745a3fdf22dd347edd708b0af13 (diff) | |
parent | 5fdd4baef6195a1f2960e901c8877e2105f832ca (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/ieee802154/fakehard.c
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/phy.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/wireless/ath/ath9k/main.c
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/pktgen.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d38470a32792..b44104d3e6be 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -364,6 +364,7 @@ struct pktgen_dev { | |||
364 | * device name (not when the inject is | 364 | * device name (not when the inject is |
365 | * started as it used to do.) | 365 | * started as it used to do.) |
366 | */ | 366 | */ |
367 | char odevname[32]; | ||
367 | struct flow_state *flows; | 368 | struct flow_state *flows; |
368 | unsigned cflows; /* Concurrent flows (config) */ | 369 | unsigned cflows; /* Concurrent flows (config) */ |
369 | unsigned lflow; /* Flow length (config) */ | 370 | unsigned lflow; /* Flow length (config) */ |
@@ -427,7 +428,7 @@ static const char version[] = | |||
427 | static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i); | 428 | static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i); |
428 | static int pktgen_add_device(struct pktgen_thread *t, const char *ifname); | 429 | static int pktgen_add_device(struct pktgen_thread *t, const char *ifname); |
429 | static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, | 430 | static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, |
430 | const char *ifname); | 431 | const char *ifname, bool exact); |
431 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); | 432 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); |
432 | static void pktgen_run_all_threads(void); | 433 | static void pktgen_run_all_threads(void); |
433 | static void pktgen_reset_all_threads(void); | 434 | static void pktgen_reset_all_threads(void); |
@@ -529,7 +530,7 @@ static int pktgen_if_show(struct seq_file *seq, void *v) | |||
529 | seq_printf(seq, | 530 | seq_printf(seq, |
530 | " frags: %d delay: %llu clone_skb: %d ifname: %s\n", | 531 | " frags: %d delay: %llu clone_skb: %d ifname: %s\n", |
531 | pkt_dev->nfrags, (unsigned long long) pkt_dev->delay, | 532 | pkt_dev->nfrags, (unsigned long long) pkt_dev->delay, |
532 | pkt_dev->clone_skb, pkt_dev->odev->name); | 533 | pkt_dev->clone_skb, pkt_dev->odevname); |
533 | 534 | ||
534 | seq_printf(seq, " flows: %u flowlen: %u\n", pkt_dev->cflows, | 535 | seq_printf(seq, " flows: %u flowlen: %u\n", pkt_dev->cflows, |
535 | pkt_dev->lflow); | 536 | pkt_dev->lflow); |
@@ -1689,13 +1690,13 @@ static int pktgen_thread_show(struct seq_file *seq, void *v) | |||
1689 | if_lock(t); | 1690 | if_lock(t); |
1690 | list_for_each_entry(pkt_dev, &t->if_list, list) | 1691 | list_for_each_entry(pkt_dev, &t->if_list, list) |
1691 | if (pkt_dev->running) | 1692 | if (pkt_dev->running) |
1692 | seq_printf(seq, "%s ", pkt_dev->odev->name); | 1693 | seq_printf(seq, "%s ", pkt_dev->odevname); |
1693 | 1694 | ||
1694 | seq_printf(seq, "\nStopped: "); | 1695 | seq_printf(seq, "\nStopped: "); |
1695 | 1696 | ||
1696 | list_for_each_entry(pkt_dev, &t->if_list, list) | 1697 | list_for_each_entry(pkt_dev, &t->if_list, list) |
1697 | if (!pkt_dev->running) | 1698 | if (!pkt_dev->running) |
1698 | seq_printf(seq, "%s ", pkt_dev->odev->name); | 1699 | seq_printf(seq, "%s ", pkt_dev->odevname); |
1699 | 1700 | ||
1700 | if (t->result[0]) | 1701 | if (t->result[0]) |
1701 | seq_printf(seq, "\nResult: %s\n", t->result); | 1702 | seq_printf(seq, "\nResult: %s\n", t->result); |
@@ -1818,9 +1819,10 @@ static struct pktgen_dev *__pktgen_NN_threads(const char *ifname, int remove) | |||
1818 | { | 1819 | { |
1819 | struct pktgen_thread *t; | 1820 | struct pktgen_thread *t; |
1820 | struct pktgen_dev *pkt_dev = NULL; | 1821 | struct pktgen_dev *pkt_dev = NULL; |
1822 | bool exact = (remove == FIND); | ||
1821 | 1823 | ||
1822 | list_for_each_entry(t, &pktgen_threads, th_list) { | 1824 | list_for_each_entry(t, &pktgen_threads, th_list) { |
1823 | pkt_dev = pktgen_find_dev(t, ifname); | 1825 | pkt_dev = pktgen_find_dev(t, ifname, exact); |
1824 | if (pkt_dev) { | 1826 | if (pkt_dev) { |
1825 | if (remove) { | 1827 | if (remove) { |
1826 | if_lock(t); | 1828 | if_lock(t); |
@@ -1995,7 +1997,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
1995 | "queue_map_min (zero-based) (%d) exceeds valid range " | 1997 | "queue_map_min (zero-based) (%d) exceeds valid range " |
1996 | "[0 - %d] for (%d) queues on %s, resetting\n", | 1998 | "[0 - %d] for (%d) queues on %s, resetting\n", |
1997 | pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, | 1999 | pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq, |
1998 | pkt_dev->odev->name); | 2000 | pkt_dev->odevname); |
1999 | pkt_dev->queue_map_min = ntxq - 1; | 2001 | pkt_dev->queue_map_min = ntxq - 1; |
2000 | } | 2002 | } |
2001 | if (pkt_dev->queue_map_max >= ntxq) { | 2003 | if (pkt_dev->queue_map_max >= ntxq) { |
@@ -2003,7 +2005,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
2003 | "queue_map_max (zero-based) (%d) exceeds valid range " | 2005 | "queue_map_max (zero-based) (%d) exceeds valid range " |
2004 | "[0 - %d] for (%d) queues on %s, resetting\n", | 2006 | "[0 - %d] for (%d) queues on %s, resetting\n", |
2005 | pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, | 2007 | pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq, |
2006 | pkt_dev->odev->name); | 2008 | pkt_dev->odevname); |
2007 | pkt_dev->queue_map_max = ntxq - 1; | 2009 | pkt_dev->queue_map_max = ntxq - 1; |
2008 | } | 2010 | } |
2009 | 2011 | ||
@@ -3263,7 +3265,7 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev) | |||
3263 | 3265 | ||
3264 | if (!pkt_dev->running) { | 3266 | if (!pkt_dev->running) { |
3265 | printk(KERN_WARNING "pktgen: interface: %s is already " | 3267 | printk(KERN_WARNING "pktgen: interface: %s is already " |
3266 | "stopped\n", pkt_dev->odev->name); | 3268 | "stopped\n", pkt_dev->odevname); |
3267 | return -EINVAL; | 3269 | return -EINVAL; |
3268 | } | 3270 | } |
3269 | 3271 | ||
@@ -3467,7 +3469,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev) | |||
3467 | default: /* Drivers are not supposed to return other values! */ | 3469 | default: /* Drivers are not supposed to return other values! */ |
3468 | if (net_ratelimit()) | 3470 | if (net_ratelimit()) |
3469 | pr_info("pktgen: %s xmit error: %d\n", | 3471 | pr_info("pktgen: %s xmit error: %d\n", |
3470 | odev->name, ret); | 3472 | pkt_dev->odevname, ret); |
3471 | pkt_dev->errors++; | 3473 | pkt_dev->errors++; |
3472 | /* fallthru */ | 3474 | /* fallthru */ |
3473 | case NETDEV_TX_LOCKED: | 3475 | case NETDEV_TX_LOCKED: |
@@ -3570,13 +3572,18 @@ static int pktgen_thread_worker(void *arg) | |||
3570 | } | 3572 | } |
3571 | 3573 | ||
3572 | static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, | 3574 | static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, |
3573 | const char *ifname) | 3575 | const char *ifname, bool exact) |
3574 | { | 3576 | { |
3575 | struct pktgen_dev *p, *pkt_dev = NULL; | 3577 | struct pktgen_dev *p, *pkt_dev = NULL; |
3576 | if_lock(t); | 3578 | size_t len = strlen(ifname); |
3577 | 3579 | ||
3580 | if_lock(t); | ||
3578 | list_for_each_entry(p, &t->if_list, list) | 3581 | list_for_each_entry(p, &t->if_list, list) |
3579 | if (strncmp(p->odev->name, ifname, IFNAMSIZ) == 0) { | 3582 | if (strncmp(p->odevname, ifname, len) == 0) { |
3583 | if (p->odevname[len]) { | ||
3584 | if (exact || p->odevname[len] != '@') | ||
3585 | continue; | ||
3586 | } | ||
3580 | pkt_dev = p; | 3587 | pkt_dev = p; |
3581 | break; | 3588 | break; |
3582 | } | 3589 | } |
@@ -3632,6 +3639,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) | |||
3632 | if (!pkt_dev) | 3639 | if (!pkt_dev) |
3633 | return -ENOMEM; | 3640 | return -ENOMEM; |
3634 | 3641 | ||
3642 | strcpy(pkt_dev->odevname, ifname); | ||
3635 | pkt_dev->flows = vmalloc(MAX_CFLOWS * sizeof(struct flow_state)); | 3643 | pkt_dev->flows = vmalloc(MAX_CFLOWS * sizeof(struct flow_state)); |
3636 | if (pkt_dev->flows == NULL) { | 3644 | if (pkt_dev->flows == NULL) { |
3637 | kfree(pkt_dev); | 3645 | kfree(pkt_dev); |