netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Olsson <robert@robur.slu.se>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, jeff@garzik.org,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Robert Olsson <robert.olsson@its.uu.se>
Subject: [NET-NEXT PATCH] pktgen: add full reset functionality
Date: Sat, 8 Nov 2008 11:21:52 +0100	[thread overview]
Message-ID: <18709.26688.587966.479504@robur.slu.se> (raw)
In-Reply-To: <20081107220140.8528.21932.stgit@gitlost.lost>



Jeff Kirsher writes:
 > From: Jesse Brandeburg <jesse.brandeburg@intel.com>
 > 
 > While testing pktgen, I found that sometimes my configurations from
 > previous runs would be left over, particularly when going from a test
 > with 8 threads down to a test with 4 threads.
 > 
 > This adds new functionality to pktgen where you can call
 > pgset "reset"

 Yes thats more convenient than looping over the threads from 
 the bash scripts.


 > and it will be just like you just insmod'ed pktgen again.

 For less impact I'll think you just can run pktgen_rem_all_ifs() 
 for all threads. 

void pktgen_reset_all_threads(void)
{
.
	mutex_lock(&pktgen_thread_lock);
	list_for_each_entry(t, &pktgen_threads, th_list)
			       pktgen_rem_all_ifs(t);
	mutex_unlock(&pktgen_thread_lock);

 .

 > Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
 > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
 > CC: Robert Olsson <robert.olsson@its.uu.se>

Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>


Cheers
				--ro	


 > ---
 > 
 >  net/core/pktgen.c |   22 ++++++++++++++++++++++
 >  1 files changed, 22 insertions(+), 0 deletions(-)
 > 
 > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
 > index fa4973b..a4f5ad1 100644
 > --- a/net/core/pktgen.c
 > +++ b/net/core/pktgen.c
 > @@ -422,6 +422,7 @@ static struct pktgen_dev *pktgen_find_dev(struct pktgen_thread *t,
 >  					  const char *ifname);
 >  static int pktgen_device_event(struct notifier_block *, unsigned long, void *);
 >  static void pktgen_run_all_threads(void);
 > +static void pktgen_reset_all_threads(void);
 >  static void pktgen_stop_all_threads_ifs(void);
 >  static int pktgen_stop_device(struct pktgen_dev *pkt_dev);
 >  static void pktgen_stop(struct pktgen_thread *t);
 > @@ -480,6 +481,9 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf,
 >  	else if (!strcmp(data, "start"))
 >  		pktgen_run_all_threads();
 >  
 > +	else if (!strcmp(data, "reset"))
 > +		pktgen_reset_all_threads();
 > +
 >  	else
 >  		printk(KERN_WARNING "pktgen: Unknown command: %s\n", data);
 >  
 > @@ -3173,6 +3177,24 @@ static void pktgen_run_all_threads(void)
 >  	pktgen_wait_all_threads_run();
 >  }
 >  
 > +static void pktgen_reset_all_threads(void)
 > +{
 > +	struct pktgen_thread *t;
 > +
 > +	pr_debug("pktgen: entering pktgen_reset_all_threads.\n");
 > +
 > +	mutex_lock(&pktgen_thread_lock);
 > +
 > +	list_for_each_entry(t, &pktgen_threads, th_list)
 > +		t->control |= (T_REMDEVALL);
 > +
 > +	mutex_unlock(&pktgen_thread_lock);
 > +
 > +	schedule_timeout_interruptible(msecs_to_jiffies(125));	/* Propagate thread->control  */
 > +
 > +	pktgen_wait_all_threads_run();
 > +}
 > +
 >  static void show_results(struct pktgen_dev *pkt_dev, int nr_frags)
 >  {
 >  	__u64 total_us, bps, mbps, pps, idle;

  reply	other threads:[~2008-11-08 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 22:01 [NET-NEXT PATCH] pktgen: add full reset functionality Jeff Kirsher
2008-11-08 10:21 ` Robert Olsson [this message]
2008-11-11  0:48   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18709.26688.587966.479504@robur.slu.se \
    --to=robert@robur.slu.se \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=robert.olsson@its.uu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).