pktgen.c (c203e45f069af47ca7623e4dcd8c00bfba2722e4) | pktgen.c (d3ede327e83f202c3a0962e207318f65717c5eb7) |
---|---|
1/* 2 * Authors: 3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se> 4 * Uppsala University and 5 * Swedish University of Agricultural Sciences 6 * 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * Ben Greear <greearb@candelatech.com> --- 376 unchanged lines hidden (view full) --- 385 char result[512]; 386 387 /* Field for thread to receive "posted" events terminate, stop ifs etc. */ 388 389 u32 control; 390 int cpu; 391 392 wait_queue_head_t queue; | 1/* 2 * Authors: 3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se> 4 * Uppsala University and 5 * Swedish University of Agricultural Sciences 6 * 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 8 * Ben Greear <greearb@candelatech.com> --- 376 unchanged lines hidden (view full) --- 385 char result[512]; 386 387 /* Field for thread to receive "posted" events terminate, stop ifs etc. */ 388 389 u32 control; 390 int cpu; 391 392 wait_queue_head_t queue; |
393 struct completion start_done; |
|
393}; 394 395#define REMOVE 1 396#define FIND 0 397 398/** Convert to micro-seconds */ 399static inline __u64 tv_to_us(const struct timeval *tv) 400{ --- 3008 unchanged lines hidden (view full) --- 3409 DEFINE_WAIT(wait); 3410 struct pktgen_thread *t = arg; 3411 struct pktgen_dev *pkt_dev = NULL; 3412 int cpu = t->cpu; 3413 3414 BUG_ON(smp_processor_id() != cpu); 3415 3416 init_waitqueue_head(&t->queue); | 394}; 395 396#define REMOVE 1 397#define FIND 0 398 399/** Convert to micro-seconds */ 400static inline __u64 tv_to_us(const struct timeval *tv) 401{ --- 3008 unchanged lines hidden (view full) --- 3410 DEFINE_WAIT(wait); 3411 struct pktgen_thread *t = arg; 3412 struct pktgen_dev *pkt_dev = NULL; 3413 int cpu = t->cpu; 3414 3415 BUG_ON(smp_processor_id() != cpu); 3416 3417 init_waitqueue_head(&t->queue); |
3418 complete(&t->start_done); |
|
3417 3418 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current)); 3419 3420 set_current_state(TASK_INTERRUPTIBLE); 3421 3422 set_freezable(); 3423 3424 while (!kthread_should_stop()) { --- 185 unchanged lines hidden (view full) --- 3610 } 3611 3612 spin_lock_init(&t->if_lock); 3613 t->cpu = cpu; 3614 3615 INIT_LIST_HEAD(&t->if_list); 3616 3617 list_add_tail(&t->th_list, &pktgen_threads); | 3419 3420 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current)); 3421 3422 set_current_state(TASK_INTERRUPTIBLE); 3423 3424 set_freezable(); 3425 3426 while (!kthread_should_stop()) { --- 185 unchanged lines hidden (view full) --- 3612 } 3613 3614 spin_lock_init(&t->if_lock); 3615 t->cpu = cpu; 3616 3617 INIT_LIST_HEAD(&t->if_list); 3618 3619 list_add_tail(&t->th_list, &pktgen_threads); |
3620 init_completion(&t->start_done); |
|
3618 3619 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3620 if (IS_ERR(p)) { 3621 printk(KERN_ERR "pktgen: kernel_thread() failed " 3622 "for cpu %d\n", t->cpu); 3623 list_del(&t->th_list); 3624 kfree(t); 3625 return PTR_ERR(p); --- 8 unchanged lines hidden (view full) --- 3634 PG_PROC_DIR, t->tsk->comm); 3635 kthread_stop(p); 3636 list_del(&t->th_list); 3637 kfree(t); 3638 return -EINVAL; 3639 } 3640 3641 wake_up_process(p); | 3621 3622 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3623 if (IS_ERR(p)) { 3624 printk(KERN_ERR "pktgen: kernel_thread() failed " 3625 "for cpu %d\n", t->cpu); 3626 list_del(&t->th_list); 3627 kfree(t); 3628 return PTR_ERR(p); --- 8 unchanged lines hidden (view full) --- 3637 PG_PROC_DIR, t->tsk->comm); 3638 kthread_stop(p); 3639 list_del(&t->th_list); 3640 kfree(t); 3641 return -EINVAL; 3642 } 3643 3644 wake_up_process(p); |
3645 wait_for_completion(&t->start_done); |
|
3642 3643 return 0; 3644} 3645 3646/* 3647 * Removes a device from the thread if_list. 3648 */ 3649static void _rem_dev_from_if_list(struct pktgen_thread *t, --- 124 unchanged lines hidden --- | 3646 3647 return 0; 3648} 3649 3650/* 3651 * Removes a device from the thread if_list. 3652 */ 3653static void _rem_dev_from_if_list(struct pktgen_thread *t, --- 124 unchanged lines hidden --- |