public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>,
	Robert Olsson <robert@herjulf.net>,
	Jesper Dangaard Brouer <jdb@comx.dk>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] pktgen: check for link down
Date: Mon, 21 Sep 2009 22:55:43 -0700	[thread overview]
Message-ID: <20090921225543.44d2d5c4@nehalam> (raw)
In-Reply-To: <20090919221844.114e2e23@nehalam>

On Sat, 19 Sep 2009 22:18:44 -0700
Stephen Hemminger <shemminger@vyatta.com> wrote:

> If cable is pulled, pktgen shouldn't continue slamming packets into the
> device.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> --- a/net/core/pktgen.c	2009-09-19 11:20:55.546463176 -0700
> +++ b/net/core/pktgen.c	2009-09-19 11:22:44.810509240 -0700
> @@ -1959,7 +1959,7 @@ static int pktgen_setup_dev(struct pktge
>  	if (odev->type != ARPHRD_ETHER) {
>  		printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname);
>  		err = -EINVAL;
> -	} else if (!netif_running(odev)) {
> +	} else if (!netif_running(odev) || !netif_carrier_ok(odev)) {
>  		printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname);
>  		err = -ENETDOWN;
>  	} else {
> @@ -3410,7 +3410,7 @@ static void pktgen_xmit(struct pktgen_de
>  	/* Did we saturate the queue already? */
>  	if (netif_tx_queue_stopped(txq) || netif_tx_queue_frozen(txq)) {
>  		/* If device is down, then all queues are permnantly frozen */
> -		if (netif_running(odev))
> +		if (netif_running(odev) && netif_carrier_ok(odev))
>  			idle(pkt_dev);
>  		else
>  			pktgen_stop_device(pkt_dev);

You can hold off on these two patches, I have better version
which fixes some other issues. But testing time is limited this week.

  parent reply	other threads:[~2009-09-22  5:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-20  5:18 [PATCH 1/2] pktgen: check for link down Stephen Hemminger
2009-09-20 15:26 ` Jesper Dangaard Brouer
2009-09-22  5:55 ` Stephen Hemminger [this message]
2009-09-22 21:24   ` 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=20090921225543.44d2d5c4@nehalam \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=jdb@comx.dk \
    --cc=netdev@vger.kernel.org \
    --cc=robert@herjulf.net \
    /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