aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-06-21 08:29:14 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-26 00:33:12 -0400
commitf9467eaec36a4ee13f5d282d2512f48e118a3120 (patch)
tree62a94d2d97f1194f8d6e8d66126c9e2241499b4b /net
parent01f2f3f6ef4d076c0c10a8a7b42624416d56b523 (diff)
net/core/pktgen.c: Use pr_<level>
Add pr_fmt(fmt) KBUILD_MODNAME ": " fmt Remove "pktgen: " from formats Convert printks to pr_<level> Added func_enter() for debugging Moved version to end of string at module_init Coalesced long formats Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c142
1 files changed, 64 insertions, 78 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6428653e9498..1ee2ebd9b04f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -115,6 +115,9 @@
115 * command by Adit Ranadive <adit.262@gmail.com> 115 * command by Adit Ranadive <adit.262@gmail.com>
116 * 116 *
117 */ 117 */
118
119#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
120
118#include <linux/sys.h> 121#include <linux/sys.h>
119#include <linux/types.h> 122#include <linux/types.h>
120#include <linux/module.h> 123#include <linux/module.h>
@@ -174,6 +177,8 @@
174#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */ 177#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
175#define MPLS_STACK_BOTTOM htonl(0x00000100) 178#define MPLS_STACK_BOTTOM htonl(0x00000100)
176 179
180#define func_enter() pr_debug("entering %s\n", __func__);
181
177/* Device flag bits */ 182/* Device flag bits */
178#define F_IPSRC_RND (1<<0) /* IP-Src Random */ 183#define F_IPSRC_RND (1<<0) /* IP-Src Random */
179#define F_IPDST_RND (1<<1) /* IP-Dst Random */ 184#define F_IPDST_RND (1<<1) /* IP-Dst Random */
@@ -424,7 +429,8 @@ static inline int ktime_lt(const ktime_t cmp1, const ktime_t cmp2)
424} 429}
425 430
426static const char version[] = 431static const char version[] =
427 "pktgen " VERSION ": Packet Generator for packet performance testing.\n"; 432 "Packet Generator for packet performance testing. "
433 "Version: " VERSION "\n";
428 434
429static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i); 435static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev *i);
430static int pktgen_add_device(struct pktgen_thread *t, const char *ifname); 436static int pktgen_add_device(struct pktgen_thread *t, const char *ifname);
@@ -495,7 +501,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
495 pktgen_reset_all_threads(); 501 pktgen_reset_all_threads();
496 502
497 else 503 else
498 printk(KERN_WARNING "pktgen: Unknown command: %s\n", data); 504 pr_warning("Unknown command: %s\n", data);
499 505
500 err = count; 506 err = count;
501 507
@@ -852,14 +858,14 @@ static ssize_t pktgen_if_write(struct file *file,
852 pg_result = &(pkt_dev->result[0]); 858 pg_result = &(pkt_dev->result[0]);
853 859
854 if (count < 1) { 860 if (count < 1) {
855 printk(KERN_WARNING "pktgen: wrong command format\n"); 861 pr_warning("wrong command format\n");
856 return -EINVAL; 862 return -EINVAL;
857 } 863 }
858 864
859 max = count - i; 865 max = count - i;
860 tmp = count_trail_chars(&user_buffer[i], max); 866 tmp = count_trail_chars(&user_buffer[i], max);
861 if (tmp < 0) { 867 if (tmp < 0) {
862 printk(KERN_WARNING "pktgen: illegal format\n"); 868 pr_warning("illegal format\n");
863 return tmp; 869 return tmp;
864 } 870 }
865 i += tmp; 871 i += tmp;
@@ -990,9 +996,7 @@ static ssize_t pktgen_if_write(struct file *file,
990 return len; 996 return len;
991 pkt_dev->delay = pkt_dev->min_pkt_size*8*NSEC_PER_USEC/value; 997 pkt_dev->delay = pkt_dev->min_pkt_size*8*NSEC_PER_USEC/value;
992 if (debug) 998 if (debug)
993 printk(KERN_INFO 999 pr_info("Delay set at: %llu ns\n", pkt_dev->delay);
994 "pktgen: Delay set at: %llu ns\n",
995 pkt_dev->delay);
996 1000
997 sprintf(pg_result, "OK: rate=%lu", value); 1001 sprintf(pg_result, "OK: rate=%lu", value);
998 return count; 1002 return count;
@@ -1007,9 +1011,7 @@ static ssize_t pktgen_if_write(struct file *file,
1007 return len; 1011 return len;
1008 pkt_dev->delay = NSEC_PER_SEC/value; 1012 pkt_dev->delay = NSEC_PER_SEC/value;
1009 if (debug) 1013 if (debug)
1010 printk(KERN_INFO 1014 pr_info("Delay set at: %llu ns\n", pkt_dev->delay);
1011 "pktgen: Delay set at: %llu ns\n",
1012 pkt_dev->delay);
1013 1015
1014 sprintf(pg_result, "OK: rate=%lu", value); 1016 sprintf(pg_result, "OK: rate=%lu", value);
1015 return count; 1017 return count;
@@ -1815,7 +1817,7 @@ static ssize_t pktgen_thread_write(struct file *file,
1815 name, (unsigned long)count); 1817 name, (unsigned long)count);
1816 1818
1817 if (!t) { 1819 if (!t) {
1818 printk(KERN_ERR "pktgen: ERROR: No thread\n"); 1820 pr_err("ERROR: No thread\n");
1819 ret = -EINVAL; 1821 ret = -EINVAL;
1820 goto out; 1822 goto out;
1821 } 1823 }
@@ -1908,7 +1910,7 @@ static void pktgen_mark_device(const char *ifname)
1908 int i = 0; 1910 int i = 0;
1909 1911
1910 mutex_lock(&pktgen_thread_lock); 1912 mutex_lock(&pktgen_thread_lock);
1911 pr_debug("pktgen: pktgen_mark_device marking %s for removal\n", ifname); 1913 pr_debug("%s: marking %s for removal\n", __func__, ifname);
1912 1914
1913 while (1) { 1915 while (1) {
1914 1916
@@ -1917,15 +1919,14 @@ static void pktgen_mark_device(const char *ifname)
1917 break; /* success */ 1919 break; /* success */
1918 1920
1919 mutex_unlock(&pktgen_thread_lock); 1921 mutex_unlock(&pktgen_thread_lock);
1920 pr_debug("pktgen: pktgen_mark_device waiting for %s " 1922 pr_debug("%s: waiting for %s to disappear....\n",
1921 "to disappear....\n", ifname); 1923 __func__, ifname);
1922 schedule_timeout_interruptible(msecs_to_jiffies(msec_per_try)); 1924 schedule_timeout_interruptible(msecs_to_jiffies(msec_per_try));
1923 mutex_lock(&pktgen_thread_lock); 1925 mutex_lock(&pktgen_thread_lock);
1924 1926
1925 if (++i >= max_tries) { 1927 if (++i >= max_tries) {
1926 printk(KERN_ERR "pktgen_mark_device: timed out after " 1928 pr_err("%s: timed out after waiting %d msec for device %s to be removed\n",
1927 "waiting %d msec for device %s to be removed\n", 1929 __func__, msec_per_try * i, ifname);
1928 msec_per_try * i, ifname);
1929 break; 1930 break;
1930 } 1931 }
1931 1932
@@ -1952,8 +1953,8 @@ static void pktgen_change_name(struct net_device *dev)
1952 &pktgen_if_fops, 1953 &pktgen_if_fops,
1953 pkt_dev); 1954 pkt_dev);
1954 if (!pkt_dev->entry) 1955 if (!pkt_dev->entry)
1955 printk(KERN_ERR "pktgen: can't move proc " 1956 pr_err("can't move proc entry for '%s'\n",
1956 " entry for '%s'\n", dev->name); 1957 dev->name);
1957 break; 1958 break;
1958 } 1959 }
1959 } 1960 }
@@ -2017,15 +2018,15 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
2017 2018
2018 odev = pktgen_dev_get_by_name(pkt_dev, ifname); 2019 odev = pktgen_dev_get_by_name(pkt_dev, ifname);
2019 if (!odev) { 2020 if (!odev) {
2020 printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname); 2021 pr_err("no such netdevice: \"%s\"\n", ifname);
2021 return -ENODEV; 2022 return -ENODEV;
2022 } 2023 }
2023 2024
2024 if (odev->type != ARPHRD_ETHER) { 2025 if (odev->type != ARPHRD_ETHER) {
2025 printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname); 2026 pr_err("not an ethernet device: \"%s\"\n", ifname);
2026 err = -EINVAL; 2027 err = -EINVAL;
2027 } else if (!netif_running(odev)) { 2028 } else if (!netif_running(odev)) {
2028 printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname); 2029 pr_err("device is down: \"%s\"\n", ifname);
2029 err = -ENETDOWN; 2030 err = -ENETDOWN;
2030 } else { 2031 } else {
2031 pkt_dev->odev = odev; 2032 pkt_dev->odev = odev;
@@ -2044,8 +2045,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2044 int ntxq; 2045 int ntxq;
2045 2046
2046 if (!pkt_dev->odev) { 2047 if (!pkt_dev->odev) {
2047 printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in " 2048 pr_err("ERROR: pkt_dev->odev == NULL in setup_inject\n");
2048 "setup_inject.\n");
2049 sprintf(pkt_dev->result, 2049 sprintf(pkt_dev->result,
2050 "ERROR: pkt_dev->odev == NULL in setup_inject.\n"); 2050 "ERROR: pkt_dev->odev == NULL in setup_inject.\n");
2051 return; 2051 return;
@@ -2055,19 +2055,15 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2055 ntxq = pkt_dev->odev->real_num_tx_queues; 2055 ntxq = pkt_dev->odev->real_num_tx_queues;
2056 2056
2057 if (ntxq <= pkt_dev->queue_map_min) { 2057 if (ntxq <= pkt_dev->queue_map_min) {
2058 printk(KERN_WARNING "pktgen: WARNING: Requested " 2058 pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
2059 "queue_map_min (zero-based) (%d) exceeds valid range " 2059 pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
2060 "[0 - %d] for (%d) queues on %s, resetting\n", 2060 pkt_dev->odevname);
2061 pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
2062 pkt_dev->odevname);
2063 pkt_dev->queue_map_min = ntxq - 1; 2061 pkt_dev->queue_map_min = ntxq - 1;
2064 } 2062 }
2065 if (pkt_dev->queue_map_max >= ntxq) { 2063 if (pkt_dev->queue_map_max >= ntxq) {
2066 printk(KERN_WARNING "pktgen: WARNING: Requested " 2064 pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
2067 "queue_map_max (zero-based) (%d) exceeds valid range " 2065 pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
2068 "[0 - %d] for (%d) queues on %s, resetting\n", 2066 pkt_dev->odevname);
2069 pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
2070 pkt_dev->odevname);
2071 pkt_dev->queue_map_max = ntxq - 1; 2067 pkt_dev->queue_map_max = ntxq - 1;
2072 } 2068 }
2073 2069
@@ -2127,8 +2123,7 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
2127 } 2123 }
2128 rcu_read_unlock(); 2124 rcu_read_unlock();
2129 if (err) 2125 if (err)
2130 printk(KERN_ERR "pktgen: ERROR: IPv6 link " 2126 pr_err("ERROR: IPv6 link address not available\n");
2131 "address not availble.\n");
2132 } 2127 }
2133#endif 2128#endif
2134 } else { 2129 } else {
@@ -2562,8 +2557,8 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
2562 if (nhead > 0) { 2557 if (nhead > 0) {
2563 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); 2558 ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
2564 if (ret < 0) { 2559 if (ret < 0) {
2565 printk(KERN_ERR "Error expanding " 2560 pr_err("Error expanding ipsec packet %d\n",
2566 "ipsec packet %d\n", ret); 2561 ret);
2567 goto err; 2562 goto err;
2568 } 2563 }
2569 } 2564 }
@@ -2572,8 +2567,7 @@ static int process_ipsec(struct pktgen_dev *pkt_dev,
2572 skb_pull(skb, ETH_HLEN); 2567 skb_pull(skb, ETH_HLEN);
2573 ret = pktgen_output_ipsec(skb, pkt_dev); 2568 ret = pktgen_output_ipsec(skb, pkt_dev);
2574 if (ret) { 2569 if (ret) {
2575 printk(KERN_ERR "Error creating ipsec " 2570 pr_err("Error creating ipsec packet %d\n", ret);
2576 "packet %d\n", ret);
2577 goto err; 2571 goto err;
2578 } 2572 }
2579 /* restore ll */ 2573 /* restore ll */
@@ -3049,8 +3043,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
3049 if (datalen < sizeof(struct pktgen_hdr)) { 3043 if (datalen < sizeof(struct pktgen_hdr)) {
3050 datalen = sizeof(struct pktgen_hdr); 3044 datalen = sizeof(struct pktgen_hdr);
3051 if (net_ratelimit()) 3045 if (net_ratelimit())
3052 printk(KERN_INFO "pktgen: increased datalen to %d\n", 3046 pr_info("increased datalen to %d\n", datalen);
3053 datalen);
3054 } 3047 }
3055 3048
3056 udph->source = htons(pkt_dev->cur_udp_src); 3049 udph->source = htons(pkt_dev->cur_udp_src);
@@ -3177,7 +3170,7 @@ static void pktgen_run(struct pktgen_thread *t)
3177 struct pktgen_dev *pkt_dev; 3170 struct pktgen_dev *pkt_dev;
3178 int started = 0; 3171 int started = 0;
3179 3172
3180 pr_debug("pktgen: entering pktgen_run. %p\n", t); 3173 func_enter();
3181 3174
3182 if_lock(t); 3175 if_lock(t);
3183 list_for_each_entry(pkt_dev, &t->if_list, list) { 3176 list_for_each_entry(pkt_dev, &t->if_list, list) {
@@ -3210,7 +3203,7 @@ static void pktgen_stop_all_threads_ifs(void)
3210{ 3203{
3211 struct pktgen_thread *t; 3204 struct pktgen_thread *t;
3212 3205
3213 pr_debug("pktgen: entering pktgen_stop_all_threads_ifs.\n"); 3206 func_enter();
3214 3207
3215 mutex_lock(&pktgen_thread_lock); 3208 mutex_lock(&pktgen_thread_lock);
3216 3209
@@ -3275,7 +3268,7 @@ static void pktgen_run_all_threads(void)
3275{ 3268{
3276 struct pktgen_thread *t; 3269 struct pktgen_thread *t;
3277 3270
3278 pr_debug("pktgen: entering pktgen_run_all_threads.\n"); 3271 func_enter();
3279 3272
3280 mutex_lock(&pktgen_thread_lock); 3273 mutex_lock(&pktgen_thread_lock);
3281 3274
@@ -3294,7 +3287,7 @@ static void pktgen_reset_all_threads(void)
3294{ 3287{
3295 struct pktgen_thread *t; 3288 struct pktgen_thread *t;
3296 3289
3297 pr_debug("pktgen: entering pktgen_reset_all_threads.\n"); 3290 func_enter();
3298 3291
3299 mutex_lock(&pktgen_thread_lock); 3292 mutex_lock(&pktgen_thread_lock);
3300 3293
@@ -3344,8 +3337,8 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
3344 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1; 3337 int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1;
3345 3338
3346 if (!pkt_dev->running) { 3339 if (!pkt_dev->running) {
3347 printk(KERN_WARNING "pktgen: interface: %s is already " 3340 pr_warning("interface: %s is already stopped\n",
3348 "stopped\n", pkt_dev->odevname); 3341 pkt_dev->odevname);
3349 return -EINVAL; 3342 return -EINVAL;
3350 } 3343 }
3351 3344
@@ -3381,7 +3374,7 @@ static void pktgen_stop(struct pktgen_thread *t)
3381{ 3374{
3382 struct pktgen_dev *pkt_dev; 3375 struct pktgen_dev *pkt_dev;
3383 3376
3384 pr_debug("pktgen: entering pktgen_stop\n"); 3377 func_enter();
3385 3378
3386 if_lock(t); 3379 if_lock(t);
3387 3380
@@ -3401,7 +3394,7 @@ static void pktgen_rem_one_if(struct pktgen_thread *t)
3401 struct list_head *q, *n; 3394 struct list_head *q, *n;
3402 struct pktgen_dev *cur; 3395 struct pktgen_dev *cur;
3403 3396
3404 pr_debug("pktgen: entering pktgen_rem_one_if\n"); 3397 func_enter();
3405 3398
3406 if_lock(t); 3399 if_lock(t);
3407 3400
@@ -3427,9 +3420,10 @@ static void pktgen_rem_all_ifs(struct pktgen_thread *t)
3427 struct list_head *q, *n; 3420 struct list_head *q, *n;
3428 struct pktgen_dev *cur; 3421 struct pktgen_dev *cur;
3429 3422
3423 func_enter();
3424
3430 /* Remove all devices, free mem */ 3425 /* Remove all devices, free mem */
3431 3426
3432 pr_debug("pktgen: entering pktgen_rem_all_ifs\n");
3433 if_lock(t); 3427 if_lock(t);
3434 3428
3435 list_for_each_safe(q, n, &t->if_list) { 3429 list_for_each_safe(q, n, &t->if_list) {
@@ -3511,8 +3505,7 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3511 3505
3512 pkt_dev->skb = fill_packet(odev, pkt_dev); 3506 pkt_dev->skb = fill_packet(odev, pkt_dev);
3513 if (pkt_dev->skb == NULL) { 3507 if (pkt_dev->skb == NULL) {
3514 printk(KERN_ERR "pktgen: ERROR: couldn't " 3508 pr_err("ERROR: couldn't allocate skb in fill_packet\n");
3515 "allocate skb in fill_packet.\n");
3516 schedule(); 3509 schedule();
3517 pkt_dev->clone_count--; /* back out increment, OOM */ 3510 pkt_dev->clone_count--; /* back out increment, OOM */
3518 return; 3511 return;
@@ -3592,8 +3585,7 @@ static int pktgen_thread_worker(void *arg)
3592 init_waitqueue_head(&t->queue); 3585 init_waitqueue_head(&t->queue);
3593 complete(&t->start_done); 3586 complete(&t->start_done);
3594 3587
3595 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", 3588 pr_debug("starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current));
3596 cpu, task_pid_nr(current));
3597 3589
3598 set_current_state(TASK_INTERRUPTIBLE); 3590 set_current_state(TASK_INTERRUPTIBLE);
3599 3591
@@ -3646,13 +3638,13 @@ static int pktgen_thread_worker(void *arg)
3646 set_current_state(TASK_INTERRUPTIBLE); 3638 set_current_state(TASK_INTERRUPTIBLE);
3647 } 3639 }
3648 3640
3649 pr_debug("pktgen: %s stopping all device\n", t->tsk->comm); 3641 pr_debug("%s stopping all device\n", t->tsk->comm);
3650 pktgen_stop(t); 3642 pktgen_stop(t);
3651 3643
3652 pr_debug("pktgen: %s removing all device\n", t->tsk->comm); 3644 pr_debug("%s removing all device\n", t->tsk->comm);
3653 pktgen_rem_all_ifs(t); 3645 pktgen_rem_all_ifs(t);
3654 3646
3655 pr_debug("pktgen: %s removing thread.\n", t->tsk->comm); 3647 pr_debug("%s removing thread\n", t->tsk->comm);
3656 pktgen_rem_thread(t); 3648 pktgen_rem_thread(t);
3657 3649
3658 return 0; 3650 return 0;
@@ -3676,7 +3668,7 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
3676 } 3668 }
3677 3669
3678 if_unlock(t); 3670 if_unlock(t);
3679 pr_debug("pktgen: find_dev(%s) returning %p\n", ifname, pkt_dev); 3671 pr_debug("find_dev(%s) returning %p\n", ifname, pkt_dev);
3680 return pkt_dev; 3672 return pkt_dev;
3681} 3673}
3682 3674
@@ -3692,8 +3684,7 @@ static int add_dev_to_thread(struct pktgen_thread *t,
3692 if_lock(t); 3684 if_lock(t);
3693 3685
3694 if (pkt_dev->pg_thread) { 3686 if (pkt_dev->pg_thread) {
3695 printk(KERN_ERR "pktgen: ERROR: already assigned " 3687 pr_err("ERROR: already assigned to a thread\n");
3696 "to a thread.\n");
3697 rv = -EBUSY; 3688 rv = -EBUSY;
3698 goto out; 3689 goto out;
3699 } 3690 }
@@ -3719,7 +3710,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3719 3710
3720 pkt_dev = __pktgen_NN_threads(ifname, FIND); 3711 pkt_dev = __pktgen_NN_threads(ifname, FIND);
3721 if (pkt_dev) { 3712 if (pkt_dev) {
3722 printk(KERN_ERR "pktgen: ERROR: interface already used.\n"); 3713 pr_err("ERROR: interface already used\n");
3723 return -EBUSY; 3714 return -EBUSY;
3724 } 3715 }
3725 3716
@@ -3764,7 +3755,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3764 pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir, 3755 pkt_dev->entry = proc_create_data(ifname, 0600, pg_proc_dir,
3765 &pktgen_if_fops, pkt_dev); 3756 &pktgen_if_fops, pkt_dev);
3766 if (!pkt_dev->entry) { 3757 if (!pkt_dev->entry) {
3767 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3758 pr_err("cannot create %s/%s procfs entry\n",
3768 PG_PROC_DIR, ifname); 3759 PG_PROC_DIR, ifname);
3769 err = -EINVAL; 3760 err = -EINVAL;
3770 goto out2; 3761 goto out2;
@@ -3795,8 +3786,7 @@ static int __init pktgen_create_thread(int cpu)
3795 t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL, 3786 t = kzalloc_node(sizeof(struct pktgen_thread), GFP_KERNEL,
3796 cpu_to_node(cpu)); 3787 cpu_to_node(cpu));
3797 if (!t) { 3788 if (!t) {
3798 printk(KERN_ERR "pktgen: ERROR: out of memory, can't " 3789 pr_err("ERROR: out of memory, can't create new thread\n");
3799 "create new thread.\n");
3800 return -ENOMEM; 3790 return -ENOMEM;
3801 } 3791 }
3802 3792
@@ -3810,8 +3800,7 @@ static int __init pktgen_create_thread(int cpu)
3810 3800
3811 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu); 3801 p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
3812 if (IS_ERR(p)) { 3802 if (IS_ERR(p)) {
3813 printk(KERN_ERR "pktgen: kernel_thread() failed " 3803 pr_err("kernel_thread() failed for cpu %d\n", t->cpu);
3814 "for cpu %d\n", t->cpu);
3815 list_del(&t->th_list); 3804 list_del(&t->th_list);
3816 kfree(t); 3805 kfree(t);
3817 return PTR_ERR(p); 3806 return PTR_ERR(p);
@@ -3822,7 +3811,7 @@ static int __init pktgen_create_thread(int cpu)
3822 pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir, 3811 pe = proc_create_data(t->tsk->comm, 0600, pg_proc_dir,
3823 &pktgen_thread_fops, t); 3812 &pktgen_thread_fops, t);
3824 if (!pe) { 3813 if (!pe) {
3825 printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", 3814 pr_err("cannot create %s/%s procfs entry\n",
3826 PG_PROC_DIR, t->tsk->comm); 3815 PG_PROC_DIR, t->tsk->comm);
3827 kthread_stop(p); 3816 kthread_stop(p);
3828 list_del(&t->th_list); 3817 list_del(&t->th_list);
@@ -3856,11 +3845,10 @@ static int pktgen_remove_device(struct pktgen_thread *t,
3856 struct pktgen_dev *pkt_dev) 3845 struct pktgen_dev *pkt_dev)
3857{ 3846{
3858 3847
3859 pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev); 3848 pr_debug("remove_device pkt_dev=%p\n", pkt_dev);
3860 3849
3861 if (pkt_dev->running) { 3850 if (pkt_dev->running) {
3862 printk(KERN_WARNING "pktgen: WARNING: trying to remove a " 3851 pr_warning("WARNING: trying to remove a running interface, stopping it now\n");
3863 "running interface, stopping it now.\n");
3864 pktgen_stop_device(pkt_dev); 3852 pktgen_stop_device(pkt_dev);
3865 } 3853 }
3866 3854
@@ -3891,7 +3879,7 @@ static int __init pg_init(void)
3891 int cpu; 3879 int cpu;
3892 struct proc_dir_entry *pe; 3880 struct proc_dir_entry *pe;
3893 3881
3894 printk(KERN_INFO "%s", version); 3882 pr_info("%s", version);
3895 3883
3896 pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net); 3884 pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
3897 if (!pg_proc_dir) 3885 if (!pg_proc_dir)
@@ -3899,8 +3887,7 @@ static int __init pg_init(void)
3899 3887
3900 pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops); 3888 pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
3901 if (pe == NULL) { 3889 if (pe == NULL) {
3902 printk(KERN_ERR "pktgen: ERROR: cannot create %s " 3890 pr_err("ERROR: cannot create %s procfs entry\n", PGCTRL);
3903 "procfs entry.\n", PGCTRL);
3904 proc_net_remove(&init_net, PG_PROC_DIR); 3891 proc_net_remove(&init_net, PG_PROC_DIR);
3905 return -EINVAL; 3892 return -EINVAL;
3906 } 3893 }
@@ -3913,13 +3900,12 @@ static int __init pg_init(void)
3913 3900
3914 err = pktgen_create_thread(cpu); 3901 err = pktgen_create_thread(cpu);
3915 if (err) 3902 if (err)
3916 printk(KERN_WARNING "pktgen: WARNING: Cannot create " 3903 pr_warning("WARNING: Cannot create thread for cpu %d (%d)\n",
3917 "thread for cpu %d (%d)\n", cpu, err); 3904 cpu, err);
3918 } 3905 }
3919 3906
3920 if (list_empty(&pktgen_threads)) { 3907 if (list_empty(&pktgen_threads)) {
3921 printk(KERN_ERR "pktgen: ERROR: Initialization failed for " 3908 pr_err("ERROR: Initialization failed for all threads\n");
3922 "all threads\n");
3923 unregister_netdevice_notifier(&pktgen_notifier_block); 3909 unregister_netdevice_notifier(&pktgen_notifier_block);
3924 remove_proc_entry(PGCTRL, pg_proc_dir); 3910 remove_proc_entry(PGCTRL, pg_proc_dir);
3925 proc_net_remove(&init_net, PG_PROC_DIR); 3911 proc_net_remove(&init_net, PG_PROC_DIR);