This adds KERN_INFO to bare printk()s in pktgen.c

Signed-off-by: Kris Katterjohn <[EMAIL PROTECTED]>

Thanks.

--- x/net/core/pktgen.c 2006-01-20 21:51:08.000000000 -0600
+++ y/net/core/pktgen.c 2006-01-20 21:51:03.000000000 -0600
@@ -415,7 +415,7 @@ static inline __u64 tv_to_us(const struc
 static inline __u64 pg_div(__u64 n, __u32 base) {
         __u64 tmp = n;
         do_div(tmp, base);
-        /* printk("pktgen: pg_div, n: %llu  base: %d  rv: %llu\n",
+        /* printk(KERN_INFO "pktgen: pg_div, n: %llu  base: %d  rv: %llu\n",
                   n, base, tmp); */
         return tmp;
 }
@@ -536,7 +536,7 @@ static ssize_t pgctrl_write(struct file*
                pktgen_run_all_threads();
 
        else 
-               printk("pktgen: Unknown command: %s\n", data);
+               printk(KERN_INFO "pktgen: Unknown command: %s\n", data);
 
        err = count;
 
@@ -765,14 +765,14 @@ static ssize_t pktgen_if_write(struct fi
         pg_result = &(pkt_dev->result[0]);
         
        if (count < 1) {
-               printk("pktgen: wrong command format\n");
+               printk(KERN_INFO "pktgen: wrong command format\n");
                return -EINVAL;
        }
   
        max = count - i;
        tmp = count_trail_chars(&user_buffer[i], max);
         if (tmp < 0) { 
-               printk("pktgen: illegal format\n");
+               printk(KERN_INFO "pktgen: illegal format\n");
                return tmp; 
        }
         i += tmp;
@@ -798,7 +798,7 @@ static ssize_t pktgen_if_write(struct fi
                 if (copy_from_user(tb, user_buffer, count))
                        return -EFAULT;
                 tb[count] = 0;
-               printk("pktgen: %s,%lu  buffer -:%s:-\n", name,
+               printk(KERN_INFO "pktgen: %s,%lu  buffer -:%s:-\n", name,
                       (unsigned long) count, tb);
         }
 
@@ -1035,7 +1035,8 @@ static ssize_t pktgen_if_write(struct fi
                         pkt_dev->cur_daddr = pkt_dev->daddr_min;
                 }
                 if(debug)
-                        printk("pktgen: dst_min set to: %s\n", 
pkt_dev->dst_min);
+                        printk(KERN_INFO "pktgen: dst_min set to: %s\n",
+                               pkt_dev->dst_min);
                 i += len;
                sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min);
                return count;
@@ -1055,7 +1056,8 @@ static ssize_t pktgen_if_write(struct fi
                         pkt_dev->cur_daddr = pkt_dev->daddr_max;
                 }
                if(debug)
-                       printk("pktgen: dst_max set to: %s\n", 
pkt_dev->dst_max);
+                       printk(KERN_INFO "pktgen: dst_max set to: %s\n",
+                              pkt_dev->dst_max);
                i += len;
                sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max);
                return count;
@@ -1076,7 +1078,7 @@ static ssize_t pktgen_if_write(struct fi
                ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr);
 
                 if(debug) 
-                       printk("pktgen: dst6 set to: %s\n", buf);
+                       printk(KERN_INFO "pktgen: dst6 set to: %s\n", buf);
 
                 i += len;
                sprintf(pg_result, "OK: dst6=%s", buf);
@@ -1097,7 +1099,7 @@ static ssize_t pktgen_if_write(struct fi
 
                ipv6_addr_copy(&pkt_dev->cur_in6_daddr, 
&pkt_dev->min_in6_daddr);
                 if(debug) 
-                       printk("pktgen: dst6_min set to: %s\n", buf);
+                       printk(KERN_INFO "pktgen: dst6_min set to: %s\n", buf);
 
                 i += len;
                sprintf(pg_result, "OK: dst6_min=%s", buf);
@@ -1117,7 +1119,7 @@ static ssize_t pktgen_if_write(struct fi
                fmt_ip6(buf,  pkt_dev->max_in6_daddr.s6_addr);
 
                 if(debug) 
-                       printk("pktgen: dst6_max set to: %s\n", buf);
+                       printk(KERN_INFO "pktgen: dst6_max set to: %s\n", buf);
 
                 i += len;
                sprintf(pg_result, "OK: dst6_max=%s", buf);
@@ -1139,7 +1141,7 @@ static ssize_t pktgen_if_write(struct fi
                ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr);
 
                 if(debug) 
-                       printk("pktgen: src6 set to: %s\n", buf);
+                       printk(KERN_INFO "pktgen: src6 set to: %s\n", buf);
                
                 i += len;
                sprintf(pg_result, "OK: src6=%s", buf);
@@ -1158,7 +1160,8 @@ static ssize_t pktgen_if_write(struct fi
                         pkt_dev->cur_saddr = pkt_dev->saddr_min;
                 }
                if(debug)
-                       printk("pktgen: src_min set to: %s\n", 
pkt_dev->src_min);
+                       printk(KERN_INFO "pktgen: src_min set to: %s\n",
+                              pkt_dev->src_min);
                i += len;
                sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min);
                return count;
@@ -1176,7 +1179,8 @@ static ssize_t pktgen_if_write(struct fi
                         pkt_dev->cur_saddr = pkt_dev->saddr_max;
                 }
                if(debug)
-                       printk("pktgen: src_max set to: %s\n", 
pkt_dev->src_max);
+                       printk(KERN_INFO "pktgen: src_max set to: %s\n",
+                              pkt_dev->src_max);
                i += len;
                sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max);
                return count;
@@ -1374,11 +1378,11 @@ static ssize_t pktgen_thread_write(struc
        i += len;
 
        if (debug)
-               printk("pktgen: t=%s, count=%lu\n", name,
+               printk(KERN_INFO "pktgen: t=%s, count=%lu\n", name,
                       (unsigned long) count);
 
        if(!t) {
-               printk("pktgen: ERROR: No thread\n");
+               printk(KERN_INFO "pktgen: ERROR: No thread\n");
                ret = -EINVAL;
                goto out;
        }
@@ -1515,15 +1519,18 @@ static struct net_device* pktgen_setup_d
        odev = dev_get_by_name(pkt_dev->ifname);
 
        if (!odev) {
-               printk("pktgen: no such netdevice: \"%s\"\n", pkt_dev->ifname);
+               printk(KERN_INFO "pktgen: no such netdevice: \"%s\"\n",
+                      pkt_dev->ifname);
                goto out;
        }
        if (odev->type != ARPHRD_ETHER) {
-               printk("pktgen: not an ethernet device: \"%s\"\n", 
pkt_dev->ifname);
+               printk(KERN_INFO "pktgen: not an ethernet device: \"%s\"\n",
+                      pkt_dev->ifname);
                goto out_put;
        }
        if (!netif_running(odev)) {
-               printk("pktgen: device is down: \"%s\"\n", pkt_dev->ifname);
+               printk(KERN_INFO "pktgen: device is down: \"%s\"\n",
+                      pkt_dev->ifname);
                goto out_put;
        }
        pkt_dev->odev = odev;
@@ -1547,7 +1554,7 @@ static void pktgen_setup_inject(struct p
                 pktgen_setup_dev(pkt_dev);
         
         if (!pkt_dev->odev) {
-                printk("pktgen: ERROR: pkt_dev->odev == NULL in 
setup_inject.\n");
+                printk(KERN_INFO "pktgen: ERROR: pkt_dev->odev == NULL in 
setup_inject.\n");
                 sprintf(pkt_dev->result, "ERROR: pkt_dev->odev == NULL in 
setup_inject.\n");
                 return;
         }
@@ -1603,7 +1610,8 @@ static void pktgen_setup_inject(struct p
                                read_unlock_bh(&idev->lock);
                        }
                        read_unlock(&addrconf_lock);
-                       if(err) printk("pktgen: ERROR: IPv6 link address not 
availble.\n");
+                       if(err)
+                               printk(KERN_INFO "pktgen: ERROR: IPv6 link 
address not availble.\n");
                }
 #endif
        } 
@@ -2271,7 +2279,7 @@ static void pktgen_run(struct pktgen_thr
         struct pktgen_dev *pkt_dev = NULL;
        int started = 0;
 
-       PG_DEBUG(printk("pktgen: entering pktgen_run. %p\n", t));
+       PG_DEBUG(printk(KERN_INFO "pktgen: entering pktgen_run. %p\n", t));
 
        if_lock(t);
         for (pkt_dev = t->if_list; pkt_dev; pkt_dev = pkt_dev->next ) {
@@ -2303,7 +2311,7 @@ static void pktgen_stop_all_threads_ifs(
 {
         struct pktgen_thread *t = pktgen_threads;
 
-       PG_DEBUG(printk("pktgen: entering pktgen_stop_all_threads.\n"));
+       PG_DEBUG(printk(KERN_INFO "pktgen: entering 
pktgen_stop_all_threads.\n"));
 
        thread_lock();
        while(t) {
@@ -2374,7 +2382,7 @@ static void pktgen_run_all_threads(void)
 {
         struct pktgen_thread *t = pktgen_threads;
 
-       PG_DEBUG(printk("pktgen: entering pktgen_run_all_threads.\n"));
+       PG_DEBUG(printk(KERN_INFO "pktgen: entering 
pktgen_run_all_threads.\n"));
 
        thread_lock();
 
@@ -2433,7 +2441,8 @@ static int pktgen_stop_device(struct pkt
 {
        
         if (!pkt_dev->running) {
-                printk("pktgen: interface: %s is already stopped\n", 
pkt_dev->ifname);
+                printk(KERN_INFO "pktgen: interface: %s is already stopped\n",
+                      pkt_dev->ifname);
                 return -EINVAL;
         }
 
@@ -2469,7 +2478,7 @@ static struct pktgen_dev *next_to_run(st
 static void pktgen_stop(struct pktgen_thread *t) {
         struct pktgen_dev *next = NULL;
 
-       PG_DEBUG(printk("pktgen: entering pktgen_stop.\n"));
+       PG_DEBUG(printk(KERN_INFO "pktgen: entering pktgen_stop.\n"));
 
         if_lock(t);
 
@@ -2572,7 +2581,7 @@ static __inline__ void pktgen_xmit(struc
                        
                        pkt_dev->skb = fill_packet(odev, pkt_dev);
                        if (pkt_dev->skb == NULL) {
-                               printk("pktgen: ERROR: couldn't allocate skb in 
fill_packet.\n");
+                               printk(KERN_INFO "pktgen: ERROR: couldn't 
allocate skb in fill_packet.\n");
                                schedule();
                                pkt_dev->clone_count--; /* back out increment, 
OOM */
                                goto out;
@@ -2689,7 +2698,8 @@ static void pktgen_thread_worker(struct 
 
         t->pid = current->pid;        
 
-        PG_DEBUG(printk("pktgen: starting pktgen/%d:  pid=%d\n", cpu, 
current->pid));
+        PG_DEBUG(printk(KERN_INFO "pktgen: starting pktgen/%d:  pid=%d\n", cpu,
+                        current->pid));
 
        max_before_softirq = t->max_before_softirq;
         
@@ -2757,13 +2767,13 @@ static void pktgen_thread_worker(struct 
                        schedule();
         } 
 
-        PG_DEBUG(printk("pktgen: %s stopping all device\n", t->name));
+        PG_DEBUG(printk(KERN_INFO "pktgen: %s stopping all device\n", 
t->name));
         pktgen_stop(t);
 
-        PG_DEBUG(printk("pktgen: %s removing all device\n", t->name));
+        PG_DEBUG(printk(KERN_INFO "pktgen: %s removing all device\n", 
t->name));
         pktgen_rem_all_ifs(t);
 
-        PG_DEBUG(printk("pktgen: %s removing thread.\n", t->name));
+        PG_DEBUG(printk(KERN_INFO "pktgen: %s removing thread.\n", t->name));
         pktgen_rem_thread(t);
 }
 
@@ -2779,7 +2789,8 @@ static struct pktgen_dev *pktgen_find_de
         }
 
         if_unlock(t);
-       PG_DEBUG(printk("pktgen: find_dev(%s) returning %p\n", ifname,pkt_dev));
+       PG_DEBUG(printk(KERN_INFO "pktgen: find_dev(%s) returning %p\n",
+                       ifname,pkt_dev));
         return pkt_dev;
 }
 
@@ -2794,7 +2805,7 @@ static int add_dev_to_thread(struct pktg
         if_lock(t);
 
         if (pkt_dev->pg_thread) {
-                printk("pktgen: ERROR:  already assigned to a thread.\n");
+                printk(KERN_INFO "pktgen: ERROR:  already assigned to a 
thread.\n");
                 rv = -EBUSY;
                 goto out;
         }
@@ -2818,7 +2829,7 @@ static int pktgen_add_device(struct pktg
 
        pkt_dev = __pktgen_NN_threads(ifname, FIND);
        if (pkt_dev) {
-                printk("pktgen: ERROR: interface already used.\n");
+                printk(KERN_INFO "pktgen: ERROR: interface already used.\n");
                 return -EBUSY;
         }
 
@@ -2849,7 +2860,7 @@ static int pktgen_add_device(struct pktg
        strncpy(pkt_dev->ifname, ifname, IFNAMSIZ);
 
        if (! pktgen_setup_dev(pkt_dev)) {
-               printk("pktgen: ERROR: pktgen_setup_dev failed.\n");
+               printk(KERN_INFO "pktgen: ERROR: pktgen_setup_dev failed.\n");
                if (pkt_dev->flows)
                        vfree(pkt_dev->flows);
                kfree(pkt_dev);
@@ -2858,7 +2869,7 @@ static int pktgen_add_device(struct pktg
 
        pe = create_proc_entry(ifname, 0600, pg_proc_dir);
        if (!pe) {
-               printk("pktgen: cannot create %s/%s procfs entry.\n",
+               printk(KERN_INFO "pktgen: cannot create %s/%s procfs entry.\n",
                       PG_PROC_DIR, ifname);
                if (pkt_dev->flows)
                        vfree(pkt_dev->flows);
@@ -2894,18 +2905,18 @@ static int __init pktgen_create_thread(c
        struct proc_dir_entry *pe;
 
         if (strlen(name) > 31) {
-                printk("pktgen: ERROR:  Thread name cannot be more than 31 
characters.\n");
+                printk(KERN_INFO "pktgen: ERROR:  Thread name cannot be more 
than 31 characters.\n");
                 return -EINVAL;
         }
         
         if (pktgen_find_thread(name)) {
-                printk("pktgen: ERROR: thread: %s already exists\n", name);
+                printk(KERN_INFO "pktgen: ERROR: thread: %s already exists\n", 
name);
                 return -EINVAL;
         }
 
         t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
         if (!t) {
-                printk("pktgen: ERROR: out of memory, can't create new 
thread.\n");
+                printk(KERN_INFO "pktgen: ERROR: out of memory, can't create 
new thread.\n");
                 return -ENOMEM;
         }
 
@@ -2915,7 +2926,7 @@ static int __init pktgen_create_thread(c
         
         pe = create_proc_entry(t->name, 0600, pg_proc_dir);
         if (!pe) {
-                printk("pktgen: cannot create %s/%s procfs entry.\n",
+                printk(KERN_INFO "pktgen: cannot create %s/%s procfs entry.\n",
                       PG_PROC_DIR, t->name);
                 kfree(t);
                 return -EINVAL;
@@ -2929,7 +2940,8 @@ static int __init pktgen_create_thread(c
 
        if (kernel_thread((void *) pktgen_thread_worker, (void *) t, 
                          CLONE_FS | CLONE_FILES | CLONE_SIGHAND) < 0)
-               printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu);
+               printk(KERN_INFO "pktgen: kernel_thread() failed for cpu %d\n",
+                      t->cpu);
 
        return 0;
 }
@@ -2957,10 +2969,11 @@ static void _rem_dev_from_if_list(struct
 static int pktgen_remove_device(struct pktgen_thread *t, struct pktgen_dev 
*pkt_dev) 
 {
 
-       PG_DEBUG(printk("pktgen: remove_device pkt_dev=%p\n", pkt_dev));
+       PG_DEBUG(printk(KERN_INFO "pktgen: remove_device pkt_dev=%p\n",
+                       pkt_dev));
 
         if (pkt_dev->running) { 
-                printk("pktgen:WARNING: trying to remove a running interface, 
stopping it now.\n");
+                printk(KERN_INFO "pktgen:WARNING: trying to remove a running 
interface, stopping it now.\n");
                 pktgen_stop_device(pkt_dev);
         }
         
@@ -2999,7 +3012,8 @@ static int __init pg_init(void) 
 
        pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir);
         if (pe == NULL) {
-               printk("pktgen: ERROR: cannot create %s procfs entry.\n", 
PGCTRL);
+               printk(KERN_INFO "pktgen: ERROR: cannot create %s procfs 
entry.\n",
+                      PGCTRL);
                proc_net_remove(PG_PROC_DIR);
                 return -EINVAL;
         }


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to