diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-11-10 19:48:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-10 19:48:03 -0500 |
commit | eb37b41cc2274cdecfc19d371717c321fe2ab426 (patch) | |
tree | c155954313416230e6b762d2385dc19858613b2b /net | |
parent | 9b1582d4513a2102c68fe12ac1106595f3c09120 (diff) |
pktgen: add full reset functionality
While testing pktgen, I found that sometimes my configurations from
previous runs would be left over, particularly when going from a test
with 8 threads down to a test with 4 threads.
This adds new functionality to pktgen where you can call
pgset "reset"
and it will be just like you just insmod'ed pktgen again.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/pktgen.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index fa4973bf73e9..a4f5ad1ab352 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -422,6 +422,7 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, | |||
422 | const char *ifname); | 422 | const char *ifname); |
423 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); | 423 | static int pktgen_device_event(struct notifier_block *, unsigned long, void *); |
424 | static void pktgen_run_all_threads(void); | 424 | static void pktgen_run_all_threads(void); |
425 | static void pktgen_reset_all_threads(void); | ||
425 | static void pktgen_stop_all_threads_ifs(void); | 426 | static void pktgen_stop_all_threads_ifs(void); |
426 | static int pktgen_stop_device(struct pktgen_dev *pkt_dev); | 427 | static int pktgen_stop_device(struct pktgen_dev *pkt_dev); |
427 | static void pktgen_stop(struct pktgen_thread *t); | 428 | static void pktgen_stop(struct pktgen_thread *t); |
@@ -480,6 +481,9 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf, | |||
480 | else if (!strcmp(data, "start")) | 481 | else if (!strcmp(data, "start")) |
481 | pktgen_run_all_threads(); | 482 | pktgen_run_all_threads(); |
482 | 483 | ||
484 | else if (!strcmp(data, "reset")) | ||
485 | pktgen_reset_all_threads(); | ||
486 | |||
483 | else | 487 | else |
484 | printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); | 488 | printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); |
485 | 489 | ||
@@ -3173,6 +3177,24 @@ static void pktgen_run_all_threads(void) | |||
3173 | pktgen_wait_all_threads_run(); | 3177 | pktgen_wait_all_threads_run(); |
3174 | } | 3178 | } |
3175 | 3179 | ||
3180 | static void pktgen_reset_all_threads(void) | ||
3181 | { | ||
3182 | struct pktgen_thread *t; | ||
3183 | |||
3184 | pr_debug("pktgen: entering pktgen_reset_all_threads.\n"); | ||
3185 | |||
3186 | mutex_lock(&pktgen_thread_lock); | ||
3187 | |||
3188 | list_for_each_entry(t, &pktgen_threads, th_list) | ||
3189 | t->control |= (T_REMDEVALL); | ||
3190 | |||
3191 | mutex_unlock(&pktgen_thread_lock); | ||
3192 | |||
3193 | schedule_timeout_interruptible(msecs_to_jiffies(125)); /* Propagate thread->control */ | ||
3194 | |||
3195 | pktgen_wait_all_threads_run(); | ||
3196 | } | ||
3197 | |||
3176 | static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) | 3198 | static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) |
3177 | { | 3199 | { |
3178 | __u64 total_us, bps, mbps, pps, idle; | 3200 | __u64 total_us, bps, mbps, pps, idle; |