Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 08/11] tg3: Disable EEE during loopback tests
@ 2011-01-26  1:58 Matt Carlson
  0 siblings, 0 replies; only message in thread
From: Matt Carlson @ 2011-01-26  1:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, andy, mcarlson

EEE interferes with the hardware's ability to loop a packet back to the
host.  This patch disables the feature for the duration of the test.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
---
 drivers/net/tg3.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 0f00270..997f0d2 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11013,14 +11013,19 @@ out:
 static int tg3_test_loopback(struct tg3 *tp)
 {
 	int err = 0;
-	u32 cpmuctrl = 0;
+	u32 eee_cap, cpmuctrl = 0;
 
 	if (!netif_running(tp->dev))
 		return TG3_LOOPBACK_FAILED;
 
+	eee_cap = tp->phy_flags & TG3_PHYFLG_EEE_CAP;
+	tp->phy_flags &= ~TG3_PHYFLG_EEE_CAP;
+
 	err = tg3_reset_hw(tp, 1);
-	if (err)
-		return TG3_LOOPBACK_FAILED;
+	if (err) {
+		err = TG3_LOOPBACK_FAILED;
+		goto done;
+	}
 
 	/* Turn off gphy autopowerdown. */
 	if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
@@ -11040,8 +11045,10 @@ static int tg3_test_loopback(struct tg3 *tp)
 			udelay(10);
 		}
 
-		if (status != CPMU_MUTEX_GNT_DRIVER)
-			return TG3_LOOPBACK_FAILED;
+		if (status != CPMU_MUTEX_GNT_DRIVER) {
+			err = TG3_LOOPBACK_FAILED;
+			goto done;
+		}
 
 		/* Turn off link-based power management. */
 		cpmuctrl = tr32(TG3_CPMU_CTRL);
@@ -11070,6 +11077,9 @@ static int tg3_test_loopback(struct tg3 *tp)
 	if (tp->phy_flags & TG3_PHYFLG_ENABLE_APD)
 		tg3_phy_toggle_apd(tp, true);
 
+done:
+	tp->phy_flags |= eee_cap;
+
 	return err;
 }
 
-- 
1.7.2.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-26  1:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26  1:58 [PATCH net-next 08/11] tg3: Disable EEE during loopback tests Matt Carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox