Fixed generation of unnecessary software interrupt in e100 driver.
authorFlorian Pose <fp@igh-essen.com>
Thu, 06 Nov 2008 15:55:49 +0000
changeset 1311 bf7c62bc533f
parent 1310 bd4631c70392
child 1312 74853e018898
Fixed generation of unnecessary software interrupt in e100 driver.
devices/e100-2.6.20-ethercat.c
devices/e100-2.6.24-ethercat.c
devices/e100-2.6.26-ethercat.c
--- a/devices/e100-2.6.20-ethercat.c	Thu Nov 06 15:46:40 2008 +0000
+++ b/devices/e100-2.6.20-ethercat.c	Thu Nov 06 15:55:49 2008 +0000
@@ -1642,17 +1642,17 @@
 
 	mii_check_link(&nic->mii);
 
-	/* Software generated interrupt to recover from (rare) Rx
-	 * allocation failure.
-	 * Unfortunately have to use a spinlock to not re-enable interrupts
-	 * accidentally, due to hardware that shares a register between the
-	 * interrupt mask bit and the SW Interrupt generation bit */
-	if (!nic->ecdev)
+	if (!nic->ecdev) {
+		/* Software generated interrupt to recover from (rare) Rx
+		 * allocation failure.
+		 * Unfortunately have to use a spinlock to not re-enable interrupts
+		 * accidentally, due to hardware that shares a register between the
+		 * interrupt mask bit and the SW Interrupt generation bit */
 		spin_lock_irq(&nic->cmd_lock);
-	writeb(readb(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
-	e100_write_flush(nic);
-	if (!nic->ecdev)
+		writeb(readb(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
+		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
+	}
 
 	e100_update_stats(nic);
 	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
--- a/devices/e100-2.6.24-ethercat.c	Thu Nov 06 15:46:40 2008 +0000
+++ b/devices/e100-2.6.24-ethercat.c	Thu Nov 06 15:55:49 2008 +0000
@@ -1658,17 +1658,17 @@
 
 	mii_check_link(&nic->mii);
 
-	/* Software generated interrupt to recover from (rare) Rx
-	 * allocation failure.
-	 * Unfortunately have to use a spinlock to not re-enable interrupts
-	 * accidentally, due to hardware that shares a register between the
-	 * interrupt mask bit and the SW Interrupt generation bit */
-	if (!nic->ecdev)
+	if (!nic->ecdev) {
+		/* Software generated interrupt to recover from (rare) Rx
+		 * allocation failure.
+		 * Unfortunately have to use a spinlock to not re-enable interrupts
+		 * accidentally, due to hardware that shares a register between the
+		 * interrupt mask bit and the SW Interrupt generation bit */
 		spin_lock_irq(&nic->cmd_lock);
-	iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
-	e100_write_flush(nic);
-	if (!nic->ecdev)
+		iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
+		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
+	}
 
 	e100_update_stats(nic);
 	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
--- a/devices/e100-2.6.26-ethercat.c	Thu Nov 06 15:46:40 2008 +0000
+++ b/devices/e100-2.6.26-ethercat.c	Thu Nov 06 15:55:49 2008 +0000
@@ -1665,17 +1665,17 @@
 
 	mii_check_link(&nic->mii);
 
-	/* Software generated interrupt to recover from (rare) Rx
-	 * allocation failure.
-	 * Unfortunately have to use a spinlock to not re-enable interrupts
-	 * accidentally, due to hardware that shares a register between the
-	 * interrupt mask bit and the SW Interrupt generation bit */
-	if (!nic->ecdev)
+	if (!nic->ecdev) {
+		/* Software generated interrupt to recover from (rare) Rx
+		 * allocation failure.
+		 * Unfortunately have to use a spinlock to not re-enable interrupts
+		 * accidentally, due to hardware that shares a register between the
+		 * interrupt mask bit and the SW Interrupt generation bit */
 		spin_lock_irq(&nic->cmd_lock);
-	iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
-	e100_write_flush(nic);
-	if (!nic->ecdev)
+		iowrite8(ioread8(&nic->csr->scb.cmd_hi) | irq_sw_gen,&nic->csr->scb.cmd_hi);
+		e100_write_flush(nic);
 		spin_unlock_irq(&nic->cmd_lock);
+	}
 
 	e100_update_stats(nic);
 	e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);