Hello!

Really needed? 

If so -- Wouldn't a concept of a bitmask to control also which CPU's
that runs the threads be more general?

Cheers.
                                        --ro


Luiz Fernando Capitulino writes:
 > 
 > Currently, pktgen will create one thread for each online CPU in the
 > system. That behaivor may be annoying if you're using pktgen in a
 > large SMP system.
 > 
 > This patch adds a new module parameter called 'pg_max_threads', which
 > can be set to the maximum number of threads pktgen should create.
 > 
 > For example, if you're playing with pktgen in SMP system with 8
 > CPUs, but want only two pktgen's threads, you can do:
 > 
 >    modprobe pktgen pg_max_threads=2
 > 
 > Signed-off-by: Luiz Capitulino <[EMAIL PROTECTED]>
 > 
 > ---
 > 
 >  net/core/pktgen.c |   23 +++++++++++++++++------
 >  1 files changed, 17 insertions(+), 6 deletions(-)
 > 
 > e210ad47d0db52496fdaabdd50bfe6ee0bcc53cd
 > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
 > index 37b25a6..994aef1 100644
 > --- a/net/core/pktgen.c
 > +++ b/net/core/pktgen.c
 > @@ -154,7 +154,7 @@
 >  #include <asm/div64.h>              /* do_div */
 >  #include <asm/timex.h>
 >  
 > -#define VERSION  "pktgen v2.66: Packet Generator for packet performance 
 > testing.\n"
 > +#define VERSION  "pktgen v2.67: Packet Generator for packet performance 
 > testing.\n"
 >  
 >  /* #define PG_DEBUG(a) a */
 >  #define PG_DEBUG(a)
 > @@ -488,6 +488,7 @@ static unsigned int fmt_ip6(char *s, con
 >  static int pg_count_d = 1000;       /* 1000 pkts by default */
 >  static int pg_delay_d;
 >  static int pg_clone_skb_d;
 > +static int pg_max_threads;
 >  static int debug;
 >  
 >  static DEFINE_MUTEX(pktgen_thread_lock);
 > @@ -3184,7 +3185,7 @@ static int pktgen_remove_device(struct p
 >  
 >  static int __init pg_init(void)
 >  {
 > -    int cpu;
 > +    int i, threads;
 >      struct proc_dir_entry *pe;
 >  
 >      printk(version);
 > @@ -3208,15 +3209,24 @@ static int __init pg_init(void)
 >      /* Register us to receive netdevice events */
 >      register_netdevice_notifier(&pktgen_notifier_block);
 >  
 > -    for_each_online_cpu(cpu) {
 > +    threads = num_online_cpus();
 > +
 > +    /*
 > +     * Check if we should have less threads than the number
 > +     * of online CPUs
 > +     */
 > +    if ((pg_max_threads > 0) && (pg_max_threads < threads))
 > +            threads = pg_max_threads;
 > +
 > +    for (i = 0; i < threads; i++) {
 >              int err;
 >              char buf[30];
 >  
 > -            sprintf(buf, "kpktgend_%i", cpu);
 > -            err = pktgen_create_thread(buf, cpu);
 > +            sprintf(buf, "kpktgend_%i", i);
 > +            err = pktgen_create_thread(buf, i);
 >              if (err)
 >                      printk("pktgen: WARNING: Cannot create thread for cpu 
 > %d (%d)\n",
 > -                                    cpu, err);
 > +                                    i, err);
 >      }
 >  
 >      if (list_empty(&pktgen_threads)) {
 > @@ -3263,4 +3273,5 @@ MODULE_LICENSE("GPL");
 >  module_param(pg_count_d, int, 0);
 >  module_param(pg_delay_d, int, 0);
 >  module_param(pg_clone_skb_d, int, 0);
 > +module_param(pg_max_threads, int, 0);
 >  module_param(debug, int, 0);
 > -- 
 > 1.2.4.gbe76
 > 
 > 
 > 
 > -- 
 > Luiz Fernando N. Capitulino
-
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