Lines Matching defs:t
190 pf(NO_TIMESTAMP) /* Don't timestamp packets (default TS) */ \
234 #define if_lock(t) mutex_lock(&(t->if_lock))
235 #define if_unlock(t) mutex_unlock(&(t->if_lock))
481 static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i);
482 static int pktgen_add_device(struct pktgen_thread *t, const char *ifname);
483 static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
490 static void pktgen_stop(struct pktgen_thread *t);
786 case '\t':
831 case '\t':
1885 struct pktgen_thread *t = seq->private;
1888 BUG_ON(!t);
1893 list_for_each_entry_rcu(pkt_dev, &t->if_list, list)
1899 list_for_each_entry_rcu(pkt_dev, &t->if_list, list)
1903 if (t->result[0])
1904 seq_printf(seq, "\nResult: %s\n", t->result);
1918 struct pktgen_thread *t = seq->private;
1955 pr_debug("t=%s, count=%lu\n", name, (unsigned long)count);
1957 if (!t) {
1963 pg_result = &(t->result[0]);
1979 ret = pktgen_add_device(t, f);
1991 t->control |= T_REMDEVALL;
2027 struct pktgen_thread *t;
2031 list_for_each_entry(t, &pn->pktgen_threads, th_list) {
2032 pkt_dev = pktgen_find_dev(t, ifname, exact);
2036 t->control |= T_REMDEV;
2081 struct pktgen_thread *t;
2085 list_for_each_entry(t, &pn->pktgen_threads, th_list) {
2088 if_lock(t);
2089 list_for_each_entry(pkt_dev, &t->if_list, list) {
2100 pr_err("can't move proc entry for '%s'\n",
2104 if_unlock(t);
2204 /* make sure that we don't pick a non-existing transmit queue */
2326 struct hrtimer_sleeper t;
2328 hrtimer_setup_sleeper_on_stack(&t, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2329 hrtimer_set_expires(&t.timer, spin_until);
2331 remaining = ktime_to_ns(hrtimer_expires_remaining(&t.timer));
2344 hrtimer_sleeper_start_expires(&t, HRTIMER_MODE_ABS);
2346 if (likely(t.task))
2349 hrtimer_cancel(&t.timer);
2350 } while (t.task && pkt_dev->running && !signal_pending(current));
2358 destroy_hrtimer_on_stack(&t.timer);
2419 /* slow path: we don't already have xfrm_state */
2442 __u16 t;
2445 t = get_random_u32_inclusive(pkt_dev->queue_map_min,
2448 t = pkt_dev->cur_queue_map + 1;
2449 if (t > pkt_dev->queue_map_max)
2450 t = pkt_dev->queue_map_min;
2452 pkt_dev->cur_queue_map = t;
2569 __u32 t;
2572 t = get_random_u32_inclusive(imn, imx - 1);
2574 t = ntohl(pkt_dev->cur_saddr);
2575 t++;
2576 if (t > imx)
2577 t = imn;
2580 pkt_dev->cur_saddr = htonl(t);
2589 __u32 t;
2595 t = get_random_u32_inclusive(imn, imx - 1);
2596 s = htonl(t);
2604 t = ntohl(pkt_dev->cur_daddr);
2605 t++;
2606 if (t > imx) {
2607 t = imn;
2609 pkt_dev->cur_daddr = htonl(t);
2638 __u32 t;
2641 t = get_random_u32_inclusive(pkt_dev->min_pkt_size,
2644 t = pkt_dev->cur_pkt_size + 1;
2645 if (t > pkt_dev->max_pkt_size)
2646 t = pkt_dev->min_pkt_size;
2648 pkt_dev->cur_pkt_size = t;
2651 __u32 t = get_random_u32_below(IMIX_PRECISION);
2652 __u8 entry_index = pkt_dev->imix_distribution[t];
3205 static void pktgen_run(struct pktgen_thread *t)
3213 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) {
3235 t->control &= ~(T_STOP);
3240 struct pktgen_thread *t;
3244 list_for_each_entry(t, &pn->pktgen_threads, th_list)
3245 t->control |= (flags);
3257 static int thread_is_running(const struct pktgen_thread *t)
3262 list_for_each_entry_rcu(pkt_dev, &t->if_list, list)
3271 static int pktgen_wait_thread_run(struct pktgen_thread *t)
3273 while (thread_is_running(t)) {
3275 /* note: 't' will still be around even after the unlock/lock
3293 struct pktgen_thread *t;
3302 list_for_each_entry(t, &pn->pktgen_threads, th_list) {
3303 sig = pktgen_wait_thread_run(t);
3309 list_for_each_entry(t, &pn->pktgen_threads, th_list)
3310 t->control |= (T_STOP);
3403 static struct pktgen_dev *next_to_run(struct pktgen_thread *t)
3408 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) {
3421 static void pktgen_stop(struct pktgen_thread *t)
3429 list_for_each_entry_rcu(pkt_dev, &t->if_list, list) {
3440 static void pktgen_rem_one_if(struct pktgen_thread *t)
3447 list_for_each_safe(q, n, &t->if_list) {
3456 pktgen_remove_device(t, cur);
3462 static void pktgen_rem_all_ifs(struct pktgen_thread *t)
3471 list_for_each_safe(q, n, &t->if_list) {
3477 pktgen_remove_device(t, cur);
3481 static void pktgen_rem_thread(struct pktgen_thread *t)
3484 remove_proc_entry(t->tsk->comm, t->net->proc_dir);
3531 /* If device is offline, then don't send */
3553 pr_err("ERROR: couldn't allocate skb in fill_packet\n");
3702 struct pktgen_thread *t = arg;
3704 int cpu = t->cpu;
3708 init_waitqueue_head(&t->queue);
3709 complete(&t->start_done);
3716 pkt_dev = next_to_run(t);
3718 if (unlikely(!pkt_dev && t->control == 0)) {
3719 if (t->net->pktgen_exiting)
3721 wait_event_freezable_timeout(t->queue,
3722 t->control != 0, HZ / 10);
3735 if (t->control & T_STOP) {
3736 pktgen_stop(t);
3737 t->control &= ~(T_STOP);
3740 if (t->control & T_RUN) {
3741 pktgen_run(t);
3742 t->control &= ~(T_RUN);
3745 if (t->control & T_REMDEVALL) {
3746 pktgen_rem_all_ifs(t);
3747 t->control &= ~(T_REMDEVALL);
3750 if (t->control & T_REMDEV) {
3751 pktgen_rem_one_if(t);
3752 t->control &= ~(T_REMDEV);
3758 pr_debug("%s stopping all device\n", t->tsk->comm);
3759 pktgen_stop(t);
3761 pr_debug("%s removing all device\n", t->tsk->comm);
3762 pktgen_rem_all_ifs(t);
3764 pr_debug("%s removing thread\n", t->tsk->comm);
3765 pktgen_rem_thread(t);
3770 static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
3777 list_for_each_entry_rcu(p, &t->if_list, list)
3796 static int add_dev_to_thread(struct pktgen_thread *t,
3808 if_lock(t);
3817 pkt_dev->pg_thread = t;
3818 list_add_rcu(&pkt_dev->list, &t->if_list);
3821 if_unlock(t);
3827 static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3831 int node = cpu_to_node(t->cpu);
3833 /* We don't allow a device to be on several threads */
3835 pkt_dev = __pktgen_NN_threads(t->net, ifname, FIND);
3873 err = pktgen_setup_dev(t->net, pkt_dev, ifname);
3879 pkt_dev->entry = proc_create_data(ifname, 0600, t->net->proc_dir,
3903 return add_dev_to_thread(t, pkt_dev);
3917 struct pktgen_thread *t;
3921 t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL,
3923 if (!t) {
3924 pr_err("ERROR: out of memory, can't create new thread\n");
3928 mutex_init(&t->if_lock);
3929 t->cpu = cpu;
3931 INIT_LIST_HEAD(&t->if_list);
3933 list_add_tail(&t->th_list, &pn->pktgen_threads);
3934 init_completion(&t->start_done);
3936 p = kthread_create_on_cpu(pktgen_thread_worker, t, cpu, "kpktgend_%d");
3938 pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu);
3939 list_del(&t->th_list);
3940 kfree(t);
3944 t->tsk = p;
3946 pe = proc_create_data(t->tsk->comm, 0600, pn->proc_dir,
3947 &pktgen_thread_proc_ops, t);
3950 PG_PROC_DIR, t->tsk->comm);
3952 list_del(&t->th_list);
3953 kfree(t);
3957 t->net = pn;
3960 wait_for_completion(&t->start_done);
3968 static void _rem_dev_from_if_list(struct pktgen_thread *t,
3974 if_lock(t);
3975 list_for_each_safe(q, n, &t->if_list) {
3980 if_unlock(t);
3983 static int pktgen_remove_device(struct pktgen_thread *t,
4007 _rem_dev_from_if_list(t, pkt_dev);
4069 struct pktgen_thread *t;
4081 t = list_entry(q, struct pktgen_thread, th_list);
4082 list_del(&t->th_list);
4083 kthread_stop_put(t->tsk);
4084 kfree(t);
4117 /* Don't need rcu_barrier() due to use of kfree_rcu() */