From: Mike Waychison <Michael.Waychison@Sun.COM>
To: "David S. Miller" <davem@davemloft.net>
Cc: Brian Somers <Brian.Somers@Sun.COM>, netdev@oss.sgi.com
Subject: [PATCH] TG3: fiber hw autoneg bounces
Date: Fri, 29 Oct 2004 17:31:19 -0400 [thread overview]
Message-ID: <4182B6A7.90700@sun.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi David,
We've recently noticed that the autonegotiation cleanup made a while
back (between tg3 3.8 and 3.9) has issues which make the link bounce up
and down.
I've traced it to be caused by the tg3_timer 1 second work noticing that
MAC_STATUS_LNKSTATE_CHANGED was set, which driver would see as the link
going down.
Upon further inspection, it appears that we don't wait long enough
between setting SG_DIG_CTRL and reading the SG_DIG_STATUS for the result.
The following patch (from a quasi recent bk tree) makes this code path
wait up to 200ms for the link to establish. In my testing, I'm seeing
it take around 20ms for the negotiation to complete.
I haven't had the chance to test how this patch affects the case where
the switch doesn't have autoneg enabled, although I suspect fallback
should work correctly.
Please consider applying, thanks,
Signed-off-by: Mike Waychison <michael.waychison@sun.com>
- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me,
and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBgrandQs4kOxk3/MRAhWnAJ9eD+qmG8/NCImsRuLCksXbLfwVCgCcDn8G
dnOG2USQhPV1q13rXr4xot8=
=GSM2
-----END PGP SIGNATURE-----
[-- Attachment #2: tg3-hw-autoneg-wait.patch --]
[-- Type: text/x-patch, Size: 1522 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.2192 -> 1.2193
# drivers/net/tg3.c 1.204 -> 1.205
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/10/29 michael.waychison@sun.com 1.2193
# The tg3 driver's fiber hw autonegotiation path wasn't waiting for the
# negotiation to complete. This caused a delayed change in link state which was
# picked up by the per-second timer and caused the link to bounce up and down
# once every second. The attached patch fixes this by waiting up to 200ms to get
# a success or error from the chip's built in autonegotiation.
# --------------------------------------------
#
diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
--- a/drivers/net/tg3.c Fri Oct 29 20:08:53 2004
+++ b/drivers/net/tg3.c Fri Oct 29 20:08:53 2004
@@ -2140,7 +2140,16 @@
tp->tg3_flags2 |= TG3_FLG2_PHY_JUST_INITTED;
} else if (mac_status & (MAC_STATUS_PCS_SYNCED |
MAC_STATUS_SIGNAL_DET)) {
- sg_dig_status = tr32(SG_DIG_STATUS);
+ int i;
+
+ /* Giver time to negotiate (~200ms) */
+ for (i = 0; i < 40000; i++) {
+ sg_dig_status = tr32(SG_DIG_STATUS);
+ if (sg_dig_status & (0x3))
+ break;
+ udelay(5);
+ }
+ mac_status = tr32(MAC_STATUS);
if ((sg_dig_status & (1 << 1)) &&
(mac_status & MAC_STATUS_PCS_SYNCED)) {
next reply other threads:[~2004-10-29 21:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-29 21:31 Mike Waychison [this message]
2004-11-02 1:27 ` [PATCH] TG3: fiber hw autoneg bounces David S. 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=4182B6A7.90700@sun.com \
--to=michael.waychison@sun.com \
--cc=Brian.Somers@Sun.COM \
--cc=davem@davemloft.net \
--cc=netdev@oss.sgi.com \
/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;
as well as URLs for NNTP newsgroup(s).