NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/44776: dual fiber i82546GB (wm) worked in NetBSD-4, not in -5, nor in -current
On 2013/06/18 16:30, Masanobu SAITOH wrote:
> The following reply was made to PR kern/44776; it has been noted by GNATS.
>
> From: Masanobu SAITOH <msaitoh%execsw.org@localhost>
> To: gnats-bugs%NetBSD.org@localhost
> Cc: kiers%original.xs4all.nl@localhost, kern-bug-people%netbsd.org@localhost,
> gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost,
> msaitoh%execsw.org@localhost
> Subject: Re: kern/44776: dual fiber i82546GB (wm) worked in NetBSD-4, not
> in -5, nor in -current
> Date: Tue, 18 Jun 2013 16:28:54 +0900
>
> (2011/03/28 3:55), kiers%original.xs4all.nl@localhost wrote:
> >> Number: 44776
> >> Category: kern
> >> Synopsis: dual fiber i82546GB (wm) worked in NetBSD-4, not in -5,
> nor in -current
> >> Confidential: no
> >> Severity: serious
> >> Priority: medium
> >> Responsible: kern-bug-people
> >> State: open
> >> Class: sw-bug
> >> Submitter-Id: net
> >> Arrival-Date: Sun Mar 27 18:55:00 +0000 2011
> >> Originator: Bert Kiers
> >> Release: 5.1 GENERIC i386
> >> Organization:
> > XS4ALL
> >> Environment:
> > NetBSD mammalou.boppelans.net 5.1 NetBSD 5.1 (GENERIC) #0: Sun Nov 7
> 14:39:56 UTC 2010
> builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-1-RELEASE/i386/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/i386/compile/GENERIC
> i386
> >> Description:
> > dual fiber i82546GB (wm(4), Intel PRO/1000 MF Server Adapter) worked in
> NetBSD-4.0.2, but not in NetBSD-5.0.2, nor in -current
> >
> > Hardware is a Soekris 5501, switch is HP 1800-24G
> >
> > Card is probed in NetBSD-4 as:
> > wm1 at pci0 dev 14 function 1: Intel i82546GB 1000BASE-X Ethernet, rev. 3
> > wm1: interrupting at irq 15
> > wm1: Ethernet address 00:04:23:ae:2a:d5
> > wm1: 1000baseSX, 1000baseSX-FDX, auto
> >
> > and in NetBSD-5.1 as:
> > wm1 at pci0 dev 14 function 1: Intel i82546GB 1000BASE-X Ethernet, rev. 3
> > wm1: interrupting at irq 15
> > wm1: 32-bit 33MHz PCI bus
> > wm1: 256 word (8 address bits) MicroWire EEPROM
> > wm1: Ethernet address 00:04:23:ae:2a:d5
> > wm1: 1000baseSX, 1000baseSX-FDX, auto
> >
> > as soon as ifconfig or dhclient touches it, the link on the switch goes
> down and then (ofcourse) no traffic. After a reboot, there is link again.
> >
> > now link, then
> > mammalou# ifconfig wm1
> > wm1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
> >
> capabilities=2bf80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx>
> > enabled=0
> > address: 00:04:23:ae:2a:d5
> > media: Ethernet autoselect (1000baseSX full-duplex)
> > status: active
> > still link
> > mammalou# ifconfig wm1 up
> > (or # dhclient wm1)
> > now, no more link
> > mammalou# ifconfig wm1
> > wm1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> >
> capabilities=2bf80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx>
> > enabled=0
> > address: 00:04:23:ae:2a:d5
> > media: Ethernet autoselect (none)
> > status: no carrier
> > inet6 fe80::204:23ff:feae:2ad5%wm1 prefixlen 64 scopeid 0x6
> >
> > mammalou# ifconfig wm1 media 1000base-SX
> > mammalou# ifconfig wm1
> > wm1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> >
> capabilities=2bf80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx>
> > enabled=0
> > address: 00:04:23:ae:2a:d5
> > media: Ethernet 1000baseSX (1000baseSX full-duplex)
> > status: active
> > inet6 fe80::204:23ff:feae:2ad5%wm1 prefixlen 64 scopeid 0x6
> >
> > at this moment, NetBSD sees link, but switch does not
> >
> > mediaopt fdx does not change things
> >
> >> How-To-Repeat:
> > # ifconfig wm1 up
> > ethernet link link goes down
> >
> >> Fix:
>
> Could you try the latest -current?
> A few days ago, my 83546GB card worked.
>
>
> --
> -----------------------------------------------
> SAITOH Masanobu (msaitoh%execsw.org@localhost
> msaitoh%netbsd.org@localhost)
I could reproduce with 82571 fiber and 82572 fiber cards.
The following patch will fix the problem (and perhaps
also fixes PR#30880).
I have to do more tests and then I'll commit it.
------------------------------------------
Fix fiber link problem (PR#44776 and PR#30880):
- Don't use the RXCFG interrput. It's not required and the interrupt is very
heavy (a lot of interrupts). Same as {Free,Open}BSD.
- Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
of {Free,Open}BSD. At least, don't forget to set duplex setting.
------------------------------------------
Index: if_wmreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wmreg.h,v
retrieving revision 1.59
diff -u -r1.59 if_wmreg.h
--- if_wmreg.h 25 Jul 2014 18:28:03 -0000 1.59
+++ if_wmreg.h 28 Jul 2014 11:30:49 -0000
@@ -348,6 +348,7 @@
#define SCTL_CTL_DATA_MASK 0x000000ff
#define SCTL_CTL_ADDR_SHIFT 8
#define SCTL_CTL_POLL_TIMEOUT 640
+#define SCTL_DISABLE_SERDES_LOOPBACK 0x0400
#define WMREG_FCAL 0x0028 /* Flow Control Address Low */
#define FCAL_CONST 0x00c28001 /* Flow Control MAC addr low */
@@ -540,6 +541,8 @@
#define WMREG_TXCW 0x0178 /* Transmit Configuration Word (TBI
mode) */
/* See MII ANAR_X bits. */
+#define TXCW_FD (1U << 5) /* Full Duplex */
+#define TXCW_HD (1U << 6) /* Half Duplex */
#define TXCW_SYM_PAUSE (1U << 7) /* sym pause request */
#define TXCW_ASYM_PAUSE (1U << 8) /* asym pause request */
#define TXCW_TxConfig (1U << 30) /* Tx Config */
Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.283
diff -u -r1.283 if_wm.c
--- if_wm.c 28 Jul 2014 06:36:09 -0000 1.283
+++ if_wm.c 28 Jul 2014 11:30:50 -0000
@@ -375,8 +375,6 @@
int sc_tbi_linkup; /* TBI link status */
int sc_tbi_anegticks; /* autonegotiation ticks */
int sc_tbi_ticks; /* tbi ticks */
- int sc_tbi_nrxcfg; /* count of ICR_RXCFG */
- int sc_tbi_lastnrxcfg; /* count of ICR_RXCFG (on last tick) */
int sc_mchash_type; /* multicast filter offset */
@@ -3848,15 +3846,10 @@
reg |= RXCSUM_IPV6OFL | RXCSUM_TUOFL;
CSR_WRITE(sc, WMREG_RXCSUM, reg);
- /* Reset TBI's RXCFG count */
- sc->sc_tbi_nrxcfg = sc->sc_tbi_lastnrxcfg = 0;
-
/* Set up the interrupt registers. */
CSR_WRITE(sc, WMREG_IMC, 0xffffffffU);
sc->sc_icr = ICR_TXDW | ICR_LSC | ICR_RXSEQ | ICR_RXDMT0 |
ICR_RXO | ICR_RXT0;
- if ((sc->sc_flags & WM_F_HAS_MII) == 0)
- sc->sc_icr |= ICR_RXCFG;
CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9)
@@ -5653,11 +5646,6 @@
sc->sc_tbi_linkup = 0;
}
wm_tbi_set_linkled(sc);
- } else if (icr & ICR_RXCFG) {
- DPRINTF(WM_DEBUG_LINK, ("%s: LINK: receiving /C/\n",
- device_xname(sc->sc_dev)));
- sc->sc_tbi_nrxcfg++;
- wm_check_for_link(sc);
} else if (icr & ICR_RXSEQ) {
DPRINTF(WM_DEBUG_LINK,
("%s: LINK: Receive sequence error\n",
@@ -5732,7 +5720,7 @@
#endif
wm_txintr(sc);
- if (icr & (ICR_LSC|ICR_RXSEQ|ICR_RXCFG)) {
+ if (icr & (ICR_LSC|ICR_RXSEQ)) {
WM_EVCNT_INCR(&sc->sc_ev_linkintr);
wm_linkintr(sc, icr);
}
@@ -7309,37 +7297,32 @@
wm_tbi_mediachange(struct ifnet *ifp)
{
struct wm_softc *sc = ifp->if_softc;
+#if 0
struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
+#endif
uint32_t status;
int i;
if (sc->sc_wmp->wmp_flags & WMP_F_SERDES)
return 0;
- sc->sc_txcw = 0;
- if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO ||
- (sc->sc_mii.mii_media.ifm_media & IFM_FLOW) != 0)
+ if ((sc->sc_type == WM_T_82571) || (sc->sc_type == WM_T_82572)
+ || (sc->sc_type >= WM_T_82575))
+ CSR_WRITE(sc, WMREG_SCTL, SCTL_DISABLE_SERDES_LOOPBACK);
+
+ /* XXX power_up_serdes_link_82575() */
+
+ sc->sc_ctrl &= ~CTRL_LRST;
+ sc->sc_txcw = TXCW_ANE | TXCW_FD;
+ if ((sc->sc_mii.mii_media.ifm_media & IFM_FLOW) != 0)
sc->sc_txcw |= TXCW_SYM_PAUSE | TXCW_ASYM_PAUSE;
- if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
- sc->sc_txcw |= TXCW_ANE;
- } else {
- /*
- * If autonegotiation is turned off, force link up and turn on
- * full duplex
- */
- sc->sc_txcw &= ~TXCW_ANE;
- sc->sc_ctrl |= CTRL_SLU | CTRL_FD;
- sc->sc_ctrl &= ~(CTRL_TFCE | CTRL_RFCE);
- CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
- CSR_WRITE_FLUSH(sc);
- delay(1000);
- }
DPRINTF(WM_DEBUG_LINK,("%s: sc_txcw = 0x%x after autoneg check\n",
- device_xname(sc->sc_dev),sc->sc_txcw));
+ device_xname(sc->sc_dev), sc->sc_txcw));
CSR_WRITE(sc, WMREG_TXCW, sc->sc_txcw);
+ CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
CSR_WRITE_FLUSH(sc);
- delay(10000);
+ delay(1000);
i = CSR_READ(sc, WMREG_CTRL) & CTRL_SWDPIN(1);
DPRINTF(WM_DEBUG_LINK,("%s: i = 0x%x\n", device_xname(sc->sc_dev),i));
@@ -7351,6 +7334,7 @@
if (((i != 0) && (sc->sc_type > WM_T_82544)) || (i == 0)) {
/* Have signal; wait for the link to come up. */
+#if 0
if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
/*
* Reset the link, and let autonegotiation do its thing
@@ -7364,6 +7348,7 @@
CSR_WRITE_FLUSH(sc);
delay(1000);
}
+#endif
for (i = 0; i < WM_LINKUP_TIMEOUT; i++) {
delay(10000);
@@ -7487,15 +7472,7 @@
if ((sc->sc_ethercom.ec_if.if_flags & IFF_UP)
&& ((status & STATUS_LU) == 0)) {
sc->sc_tbi_linkup = 0;
- if (sc->sc_tbi_nrxcfg - sc->sc_tbi_lastnrxcfg > 100) {
- /* RXCFG storm! */
- DPRINTF(WM_DEBUG_LINK, ("RXCFG storm! (%d)\n",
- sc->sc_tbi_nrxcfg - sc->sc_tbi_lastnrxcfg));
- wm_init_locked(ifp);
- WM_TX_UNLOCK(sc);
- ifp->if_start(ifp);
- WM_TX_LOCK(sc);
- } else if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
+ if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
/* If the timer expired, retry autonegotiation */
if (++sc->sc_tbi_ticks >= sc->sc_tbi_anegticks) {
DPRINTF(WM_DEBUG_LINK, ("EXPIRE\n"));
--
-----------------------------------------------
SAITOH Masanobu (msaitoh%execsw.org@localhost
msaitoh%netbsd.org@localhost)
Home |
Main Index |
Thread Index |
Old Index