netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] pktgen: check for link down
@ 2009-09-20  5:18 Stephen Hemminger
  2009-09-20 15:26 ` Jesper Dangaard Brouer
  2009-09-22  5:55 ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Hemminger @ 2009-09-20  5:18 UTC (permalink / raw)
  To: David Miller, Robert Olsson, Jesper Dangaard Brouer; +Cc: netdev

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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-22 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-09-22 21:24   ` David Miller

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).