pktgen: check for link down
Subsystems (2)
PATCH 1/2 pktgen: check for link down
If cable is pulled, pktgen shouldn't continue slamming packets into the device.
net/core/pktgen.c +2 -2
@@ -1959,7 +1959,7 @@ static int pktgen_setup_dev(struct pktgeif (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);
Thanks for fixing this.
Quoted 17 lines · Stephen Hemminger
If cable is pulled, pktgen shouldn't continue slamming packets into the device.
Signed-off-by Stephen Hemminger <[email protected]>net/core/pktgen.c +1
-1@@ -1959,7 +1959,7 @@ static int pktgen_setup_dev(struct pktgeif (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 {
net/core/pktgen.c static void pktgen_xmit(struct pktgen_de · line 3416
Quoted 8 lines
net/core/pktgen.c +1
-1@@ -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);
Hilsen
Jesper Brouer
--
-------------------------------------------------------------------
MSc. Master of Computer Science
Dept. of Computer Science, University of Copenhagen Author of http://www.adsl-optimizer.dk
-------------------------------------------------------------------
Quoted 17 lines · On Sat, 19 Sep 2009 22:18:44 -0700 Stephen Hemminger <[email protected]>…
If cable is pulled, pktgen shouldn't continue slamming packets into the device.
Signed-off-by Stephen Hemminger <[email protected]>net/core/pktgen.c +1
-1@@ -1959,7 +1959,7 @@ static int pktgen_setup_dev(struct pktgeif (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 {
net/core/pktgen.c static void pktgen_xmit(struct pktgen_de · line 3416
Quoted 8 lines
net/core/pktgen.c +1
-1@@ -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.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Mon, 21 Sep 2009 22:55:43 -0700
Quoted 2 lines
You can hold off on these two patches, I have better version which fixes some other issues. But testing time is limited this week.
Ok