aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/pktgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r--net/core/pktgen.c22
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);
423static int pktgen_device_event(struct notifier_block *, unsigned long, void *); 423static int pktgen_device_event(struct notifier_block *, unsigned long, void *);
424static void pktgen_run_all_threads(void); 424static void pktgen_run_all_threads(void);
425static void pktgen_reset_all_threads(void);
425static void pktgen_stop_all_threads_ifs(void); 426static void pktgen_stop_all_threads_ifs(void);
426static int pktgen_stop_device(struct pktgen_dev *pkt_dev); 427static int pktgen_stop_device(struct pktgen_dev *pkt_dev);
427static void pktgen_stop(struct pktgen_thread *t); 428static 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
3180static 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
3176static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) 3198static 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;