Lines Matching refs:t
235 #define if_lock(t) mutex_lock(&(t->if_lock)); argument
236 #define if_unlock(t) mutex_unlock(&(t->if_lock)); argument
479 static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i);
480 static int pktgen_add_device(struct pktgen_thread *t, const char *ifname);
481 static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
488 static void pktgen_stop(struct pktgen_thread *t);
1827 struct pktgen_thread *t = seq->private; in pktgen_thread_show() local
1830 BUG_ON(!t); in pktgen_thread_show()
1835 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) in pktgen_thread_show()
1841 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) in pktgen_thread_show()
1845 if (t->result[0]) in pktgen_thread_show()
1846 seq_printf(seq, "\nResult: %s\n", t->result); in pktgen_thread_show()
1860 struct pktgen_thread *t = seq->private; in pktgen_thread_write() local
1898 if (!t) { in pktgen_thread_write()
1904 pg_result = &(t->result[0]); in pktgen_thread_write()
1918 ret = pktgen_add_device(t, f); in pktgen_thread_write()
1930 t->control |= T_REMDEVALL; in pktgen_thread_write()
1966 struct pktgen_thread *t; in __pktgen_NN_threads() local
1970 list_for_each_entry(t, &pn->pktgen_threads, th_list) { in __pktgen_NN_threads()
1971 pkt_dev = pktgen_find_dev(t, ifname, exact); in __pktgen_NN_threads()
1975 t->control |= T_REMDEV; in __pktgen_NN_threads()
2020 struct pktgen_thread *t; in pktgen_change_name() local
2024 list_for_each_entry(t, &pn->pktgen_threads, th_list) { in pktgen_change_name()
2027 if_lock(t); in pktgen_change_name()
2028 list_for_each_entry(pkt_dev, &t->if_list, list) { in pktgen_change_name()
2043 if_unlock(t); in pktgen_change_name()
2265 struct hrtimer_sleeper t; in spin() local
2267 hrtimer_init_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); in spin()
2268 hrtimer_set_expires(&t.timer, spin_until); in spin()
2270 remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer)); in spin()
2283 hrtimer_sleeper_start_expires(&t, HRTIMER_MODE_ABS); in spin()
2285 if (likely(t.task)) in spin()
2288 hrtimer_cancel(&t.timer); in spin()
2289 } while (t.task && pkt_dev->running && !signal_pending(current)); in spin()
2297 destroy_hrtimer_on_stack(&t.timer); in spin()
2381 __u16 t; in set_cur_queue_map() local
2383 t = get_random_u32_inclusive(pkt_dev->queue_map_min, in set_cur_queue_map()
2386 t = pkt_dev->cur_queue_map + 1; in set_cur_queue_map()
2387 if (t > pkt_dev->queue_map_max) in set_cur_queue_map()
2388 t = pkt_dev->queue_map_min; in set_cur_queue_map()
2390 pkt_dev->cur_queue_map = t; in set_cur_queue_map()
2506 __u32 t; in mod_cur_headers() local
2508 t = get_random_u32_inclusive(imn, imx - 1); in mod_cur_headers()
2510 t = ntohl(pkt_dev->cur_saddr); in mod_cur_headers()
2511 t++; in mod_cur_headers()
2512 if (t > imx) in mod_cur_headers()
2513 t = imn; in mod_cur_headers()
2516 pkt_dev->cur_saddr = htonl(t); in mod_cur_headers()
2525 __u32 t; in mod_cur_headers() local
2530 t = get_random_u32_inclusive(imn, imx - 1); in mod_cur_headers()
2531 s = htonl(t); in mod_cur_headers()
2539 t = ntohl(pkt_dev->cur_daddr); in mod_cur_headers()
2540 t++; in mod_cur_headers()
2541 if (t > imx) { in mod_cur_headers()
2542 t = imn; in mod_cur_headers()
2544 pkt_dev->cur_daddr = htonl(t); in mod_cur_headers()
2575 __u32 t; in mod_cur_headers() local
2577 t = get_random_u32_inclusive(pkt_dev->min_pkt_size, in mod_cur_headers()
2580 t = pkt_dev->cur_pkt_size + 1; in mod_cur_headers()
2581 if (t > pkt_dev->max_pkt_size) in mod_cur_headers()
2582 t = pkt_dev->min_pkt_size; in mod_cur_headers()
2584 pkt_dev->cur_pkt_size = t; in mod_cur_headers()
2587 __u32 t = get_random_u32_below(IMIX_PRECISION); in mod_cur_headers() local
2588 __u8 entry_index = pkt_dev->imix_distribution[t]; in mod_cur_headers()
3136 static void pktgen_run(struct pktgen_thread *t) in pktgen_run() argument
3144 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) { in pktgen_run()
3166 t->control &= ~(T_STOP); in pktgen_run()
3171 struct pktgen_thread *t; in pktgen_handle_all_threads() local
3175 list_for_each_entry(t, &pn->pktgen_threads, th_list) in pktgen_handle_all_threads()
3176 t->control |= (flags); in pktgen_handle_all_threads()
3188 static int thread_is_running(const struct pktgen_thread *t) in thread_is_running() argument
3193 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) in thread_is_running()
3202 static int pktgen_wait_thread_run(struct pktgen_thread *t) in pktgen_wait_thread_run() argument
3204 while (thread_is_running(t)) { in pktgen_wait_thread_run()
3224 struct pktgen_thread *t; in pktgen_wait_all_threads_run() local
3233 list_for_each_entry(t, &pn->pktgen_threads, th_list) { in pktgen_wait_all_threads_run()
3234 sig = pktgen_wait_thread_run(t); in pktgen_wait_all_threads_run()
3240 list_for_each_entry(t, &pn->pktgen_threads, th_list) in pktgen_wait_all_threads_run()
3241 t->control |= (T_STOP); in pktgen_wait_all_threads_run()
3334 static struct pktgen_dev *next_to_run(struct pktgen_thread *t) in next_to_run() argument
3339 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) { in next_to_run()
3352 static void pktgen_stop(struct pktgen_thread *t) in pktgen_stop() argument
3360 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) { in pktgen_stop()
3371 static void pktgen_rem_one_if(struct pktgen_thread *t) in pktgen_rem_one_if() argument
3378 list_for_each_safe(q, n, &t->if_list) { in pktgen_rem_one_if()
3387 pktgen_remove_device(t, cur); in pktgen_rem_one_if()
3393 static void pktgen_rem_all_ifs(struct pktgen_thread *t) in pktgen_rem_all_ifs() argument
3402 list_for_each_safe(q, n, &t->if_list) { in pktgen_rem_all_ifs()
3408 pktgen_remove_device(t, cur); in pktgen_rem_all_ifs()
3412 static void pktgen_rem_thread(struct pktgen_thread *t) in pktgen_rem_thread() argument
3415 remove_proc_entry(t->tsk->comm, t->net->proc_dir); in pktgen_rem_thread()
3604 struct pktgen_thread *t = arg; in pktgen_thread_worker() local
3606 int cpu = t->cpu; in pktgen_thread_worker()
3610 init_waitqueue_head(&t->queue); in pktgen_thread_worker()
3611 complete(&t->start_done); in pktgen_thread_worker()
3618 pkt_dev = next_to_run(t); in pktgen_thread_worker()
3620 if (unlikely(!pkt_dev && t->control == 0)) { in pktgen_thread_worker()
3621 if (t->net->pktgen_exiting) in pktgen_thread_worker()
3623 wait_event_interruptible_timeout(t->queue, in pktgen_thread_worker()
3624 t->control != 0, in pktgen_thread_worker()
3639 if (t->control & T_STOP) { in pktgen_thread_worker()
3640 pktgen_stop(t); in pktgen_thread_worker()
3641 t->control &= ~(T_STOP); in pktgen_thread_worker()
3644 if (t->control & T_RUN) { in pktgen_thread_worker()
3645 pktgen_run(t); in pktgen_thread_worker()
3646 t->control &= ~(T_RUN); in pktgen_thread_worker()
3649 if (t->control & T_REMDEVALL) { in pktgen_thread_worker()
3650 pktgen_rem_all_ifs(t); in pktgen_thread_worker()
3651 t->control &= ~(T_REMDEVALL); in pktgen_thread_worker()
3654 if (t->control & T_REMDEV) { in pktgen_thread_worker()
3655 pktgen_rem_one_if(t); in pktgen_thread_worker()
3656 t->control &= ~(T_REMDEV); in pktgen_thread_worker()
3662 pr_debug("%s stopping all device\n", t->tsk->comm); in pktgen_thread_worker()
3663 pktgen_stop(t); in pktgen_thread_worker()
3665 pr_debug("%s removing all device\n", t->tsk->comm); in pktgen_thread_worker()
3666 pktgen_rem_all_ifs(t); in pktgen_thread_worker()
3668 pr_debug("%s removing thread\n", t->tsk->comm); in pktgen_thread_worker()
3669 pktgen_rem_thread(t); in pktgen_thread_worker()
3674 static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t, in pktgen_find_dev() argument
3681 list_for_each_entry_rcu(p, &t->if_list, list) in pktgen_find_dev()
3700 static int add_dev_to_thread(struct pktgen_thread *t, in add_dev_to_thread() argument
3711 if_lock(t); in add_dev_to_thread()
3720 pkt_dev->pg_thread = t; in add_dev_to_thread()
3721 list_add_rcu(&pkt_dev->list, &t->if_list); in add_dev_to_thread()
3724 if_unlock(t); in add_dev_to_thread()
3730 static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) in pktgen_add_device() argument
3734 int node = cpu_to_node(t->cpu); in pktgen_add_device()
3738 pkt_dev = __pktgen_NN_threads(t->net, ifname, FIND); in pktgen_add_device()
3775 err = pktgen_setup_dev(t->net, pkt_dev, ifname); in pktgen_add_device()
3781 pkt_dev->entry = proc_create_data(ifname, 0600, t->net->proc_dir, in pktgen_add_device()
3805 return add_dev_to_thread(t, pkt_dev); in pktgen_add_device()
3819 struct pktgen_thread *t; in pktgen_create_thread() local
3823 t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL, in pktgen_create_thread()
3825 if (!t) { in pktgen_create_thread()
3830 mutex_init(&t->if_lock); in pktgen_create_thread()
3831 t->cpu = cpu; in pktgen_create_thread()
3833 INIT_LIST_HEAD(&t->if_list); in pktgen_create_thread()
3835 list_add_tail(&t->th_list, &pn->pktgen_threads); in pktgen_create_thread()
3836 init_completion(&t->start_done); in pktgen_create_thread()
3839 t, in pktgen_create_thread()
3843 pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu); in pktgen_create_thread()
3844 list_del(&t->th_list); in pktgen_create_thread()
3845 kfree(t); in pktgen_create_thread()
3849 t->tsk = p; in pktgen_create_thread()
3851 pe = proc_create_data(t->tsk->comm, 0600, pn->proc_dir, in pktgen_create_thread()
3852 &pktgen_thread_proc_ops, t); in pktgen_create_thread()
3855 PG_PROC_DIR, t->tsk->comm); in pktgen_create_thread()
3857 list_del(&t->th_list); in pktgen_create_thread()
3858 kfree(t); in pktgen_create_thread()
3862 t->net = pn; in pktgen_create_thread()
3865 wait_for_completion(&t->start_done); in pktgen_create_thread()
3873 static void _rem_dev_from_if_list(struct pktgen_thread *t, in _rem_dev_from_if_list() argument
3879 if_lock(t); in _rem_dev_from_if_list()
3880 list_for_each_safe(q, n, &t->if_list) { in _rem_dev_from_if_list()
3885 if_unlock(t); in _rem_dev_from_if_list()
3888 static int pktgen_remove_device(struct pktgen_thread *t, in pktgen_remove_device() argument
3911 _rem_dev_from_if_list(t, pkt_dev); in pktgen_remove_device()
3971 struct pktgen_thread *t; in pg_net_exit() local
3983 t = list_entry(q, struct pktgen_thread, th_list); in pg_net_exit()
3984 list_del(&t->th_list); in pg_net_exit()
3985 kthread_stop_put(t->tsk); in pg_net_exit()
3986 kfree(t); in pg_net_exit()