pktgen.c (96916090f488986a4ebb8e9ffa6a3b50881d5ccd) | pktgen.c (5efdccbcda20d3e5fbaa85f726dcc9cfeb005577) |
---|---|
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> --- 3556 unchanged lines hidden (view full) --- 3565 pkt_dev->svlan_p = 0; 3566 pkt_dev->svlan_cfi = 0; 3567 pkt_dev->svlan_id = 0xffff; 3568 3569 err = pktgen_setup_dev(pkt_dev, ifname); 3570 if (err) 3571 goto out1; 3572 | 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> --- 3556 unchanged lines hidden (view full) --- 3565 pkt_dev->svlan_p = 0; 3566 pkt_dev->svlan_cfi = 0; 3567 pkt_dev->svlan_id = 0xffff; 3568 3569 err = pktgen_setup_dev(pkt_dev, ifname); 3570 if (err) 3571 goto out1; 3572 |
3573 pkt_dev->entry = proc_create(ifname, 0600, 3574 pg_proc_dir, &pktgen_if_fops); | 3573 pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir, 3574 &pktgen_if_fops, pkt_dev); |
3575 if (!pkt_dev->entry) { 3576 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3577 PG_PROC_DIR, ifname); 3578 err = -EINVAL; 3579 goto out2; 3580 } | 3575 if (!pkt_dev->entry) { 3576 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3577 PG_PROC_DIR, ifname); 3578 err = -EINVAL; 3579 goto out2; 3580 } |
3581 pkt_dev->entry->data = pkt_dev; | |
3582#ifdef CONFIG_XFRM 3583 pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; 3584 pkt_dev->ipsproto = IPPROTO_ESP; 3585#endif 3586 3587 return add_dev_to_thread(t, pkt_dev); 3588out2: 3589 dev_put(pkt_dev->odev); --- 33 unchanged lines hidden (view full) --- 3623 "for cpu %d\n", t->cpu); 3624 list_del(&t->th_list); 3625 kfree(t); 3626 return PTR_ERR(p); 3627 } 3628 kthread_bind(p, cpu); 3629 t->tsk = p; 3630 | 3581#ifdef CONFIG_XFRM 3582 pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; 3583 pkt_dev->ipsproto = IPPROTO_ESP; 3584#endif 3585 3586 return add_dev_to_thread(t, pkt_dev); 3587out2: 3588 dev_put(pkt_dev->odev); --- 33 unchanged lines hidden (view full) --- 3622 "for cpu %d\n", t->cpu); 3623 list_del(&t->th_list); 3624 kfree(t); 3625 return PTR_ERR(p); 3626 } 3627 kthread_bind(p, cpu); 3628 t->tsk = p; 3629 |
3631 pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops); | 3630 pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir, 3631 &pktgen_thread_fops, t); |
3632 if (!pe) { 3633 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 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 | 3632 if (!pe) { 3633 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 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 pe->data = t; 3642 | |
3643 wake_up_process(p); 3644 3645 return 0; 3646} 3647 3648/* 3649 * Removes a device from the thread if_list. 3650 */ --- 60 unchanged lines hidden (view full) --- 3711 pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops); 3712 if (pe == NULL) { 3713 printk(KERN_ERR "pktgen: ERROR: cannot create %s " 3714 "procfs entry.\n", PGCTRL); 3715 proc_net_remove(&init_net, PG_PROC_DIR); 3716 return -EINVAL; 3717 } 3718 | 3641 wake_up_process(p); 3642 3643 return 0; 3644} 3645 3646/* 3647 * Removes a device from the thread if_list. 3648 */ --- 60 unchanged lines hidden (view full) --- 3709 pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops); 3710 if (pe == NULL) { 3711 printk(KERN_ERR "pktgen: ERROR: cannot create %s " 3712 "procfs entry.\n", PGCTRL); 3713 proc_net_remove(&init_net, PG_PROC_DIR); 3714 return -EINVAL; 3715 } 3716 |
3719 pe->data = NULL; 3720 | |
3721 /* Register us to receive netdevice events */ 3722 register_netdevice_notifier(&pktgen_notifier_block); 3723 3724 for_each_online_cpu(cpu) { 3725 int err; 3726 3727 err = pktgen_create_thread(cpu); 3728 if (err) --- 49 unchanged lines hidden --- | 3717 /* Register us to receive netdevice events */ 3718 register_netdevice_notifier(&pktgen_notifier_block); 3719 3720 for_each_online_cpu(cpu) { 3721 int err; 3722 3723 err = pktgen_create_thread(cpu); 3724 if (err) --- 49 unchanged lines hidden --- |