diff options
Diffstat (limited to 'net/core/pktgen.c')
-rw-r--r-- | net/core/pktgen.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index ef430b1e8e42..5f043d346694 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -186,7 +186,7 @@ | |||
186 | 186 | ||
187 | /* Used to help with determining the pkts on receive */ | 187 | /* Used to help with determining the pkts on receive */ |
188 | #define PKTGEN_MAGIC 0xbe9be955 | 188 | #define PKTGEN_MAGIC 0xbe9be955 |
189 | #define PG_PROC_DIR "pktgen" | 189 | #define PG_PROC_DIR "net/pktgen" |
190 | 190 | ||
191 | #define MAX_CFLOWS 65536 | 191 | #define MAX_CFLOWS 65536 |
192 | 192 | ||
@@ -1476,18 +1476,7 @@ static int proc_thread_write(struct file *file, const char __user *user_buffer, | |||
1476 | 1476 | ||
1477 | static int create_proc_dir(void) | 1477 | static int create_proc_dir(void) |
1478 | { | 1478 | { |
1479 | int len; | 1479 | pg_proc_dir = proc_mkdir(PG_PROC_DIR, NULL); |
1480 | /* does proc_dir already exists */ | ||
1481 | len = strlen(PG_PROC_DIR); | ||
1482 | |||
1483 | for (pg_proc_dir = proc_net->subdir; pg_proc_dir; pg_proc_dir=pg_proc_dir->next) { | ||
1484 | if ((pg_proc_dir->namelen == len) && | ||
1485 | (! memcmp(pg_proc_dir->name, PG_PROC_DIR, len))) | ||
1486 | break; | ||
1487 | } | ||
1488 | |||
1489 | if (!pg_proc_dir) | ||
1490 | pg_proc_dir = create_proc_entry(PG_PROC_DIR, S_IFDIR, proc_net); | ||
1491 | 1480 | ||
1492 | if (!pg_proc_dir) | 1481 | if (!pg_proc_dir) |
1493 | return -ENODEV; | 1482 | return -ENODEV; |
@@ -1497,7 +1486,7 @@ static int create_proc_dir(void) | |||
1497 | 1486 | ||
1498 | static int remove_proc_dir(void) | 1487 | static int remove_proc_dir(void) |
1499 | { | 1488 | { |
1500 | remove_proc_entry(PG_PROC_DIR, proc_net); | 1489 | remove_proc_entry(PG_PROC_DIR, NULL); |
1501 | return 0; | 1490 | return 0; |
1502 | } | 1491 | } |
1503 | 1492 | ||
@@ -1678,13 +1667,12 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev) | |||
1678 | struct in_device *in_dev; | 1667 | struct in_device *in_dev; |
1679 | 1668 | ||
1680 | rcu_read_lock(); | 1669 | rcu_read_lock(); |
1681 | in_dev = __in_dev_get(pkt_dev->odev); | 1670 | in_dev = __in_dev_get_rcu(pkt_dev->odev); |
1682 | if (in_dev) { | 1671 | if (in_dev) { |
1683 | if (in_dev->ifa_list) { | 1672 | if (in_dev->ifa_list) { |
1684 | pkt_dev->saddr_min = in_dev->ifa_list->ifa_address; | 1673 | pkt_dev->saddr_min = in_dev->ifa_list->ifa_address; |
1685 | pkt_dev->saddr_max = pkt_dev->saddr_min; | 1674 | pkt_dev->saddr_max = pkt_dev->saddr_min; |
1686 | } | 1675 | } |
1687 | __in_dev_put(in_dev); | ||
1688 | } | 1676 | } |
1689 | rcu_read_unlock(); | 1677 | rcu_read_unlock(); |
1690 | } | 1678 | } |
@@ -2908,7 +2896,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname) | |||
2908 | pkt_dev->udp_dst_max = 9; | 2896 | pkt_dev->udp_dst_max = 9; |
2909 | 2897 | ||
2910 | strncpy(pkt_dev->ifname, ifname, 31); | 2898 | strncpy(pkt_dev->ifname, ifname, 31); |
2911 | sprintf(pkt_dev->fname, "net/%s/%s", PG_PROC_DIR, ifname); | 2899 | sprintf(pkt_dev->fname, "%s/%s", PG_PROC_DIR, ifname); |
2912 | 2900 | ||
2913 | if (! pktgen_setup_dev(pkt_dev)) { | 2901 | if (! pktgen_setup_dev(pkt_dev)) { |
2914 | printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); | 2902 | printk("pktgen: ERROR: pktgen_setup_dev failed.\n"); |
@@ -2981,7 +2969,7 @@ static int pktgen_create_thread(const char* name, int cpu) | |||
2981 | spin_lock_init(&t->if_lock); | 2969 | spin_lock_init(&t->if_lock); |
2982 | t->cpu = cpu; | 2970 | t->cpu = cpu; |
2983 | 2971 | ||
2984 | sprintf(t->fname, "net/%s/%s", PG_PROC_DIR, t->name); | 2972 | sprintf(t->fname, "%s/%s", PG_PROC_DIR, t->name); |
2985 | t->proc_ent = create_proc_entry(t->fname, 0600, NULL); | 2973 | t->proc_ent = create_proc_entry(t->fname, 0600, NULL); |
2986 | if (!t->proc_ent) { | 2974 | if (!t->proc_ent) { |
2987 | printk("pktgen: cannot create %s procfs entry.\n", t->fname); | 2975 | printk("pktgen: cannot create %s procfs entry.\n", t->fname); |
@@ -3064,7 +3052,7 @@ static int __init pg_init(void) | |||
3064 | 3052 | ||
3065 | create_proc_dir(); | 3053 | create_proc_dir(); |
3066 | 3054 | ||
3067 | sprintf(module_fname, "net/%s/pgctrl", PG_PROC_DIR); | 3055 | sprintf(module_fname, "%s/pgctrl", PG_PROC_DIR); |
3068 | module_proc_ent = create_proc_entry(module_fname, 0600, NULL); | 3056 | module_proc_ent = create_proc_entry(module_fname, 0600, NULL); |
3069 | if (!module_proc_ent) { | 3057 | if (!module_proc_ent) { |
3070 | printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); | 3058 | printk("pktgen: ERROR: cannot create %s procfs entry.\n", module_fname); |