Re: ale(4) cannot negotiate as GigE

2014-05-08 Thread Alexey Dokuchaev
On Fri, May 09, 2014 at 02:38:16PM +0900, Yonghyeon PYUN wrote:
> On Thu, May 08, 2014 at 05:23:32PM +, Alexey Dokuchaev wrote:
> > I just had a chance to plug the Ethernet cable directly into my laptop's
> > bge(4) port, and it immediately negotiated at 1000baseT; but with the 
> > switch,
> > it can only feel fine with 10baseT/UTP (after some 1000baseT-no carrier flip
> > flopping).  So it looks like it fails to talk to the switch.  Given that 
> > this
> > switch of mine in a simple (dumb) piece of equipment, any ideas how to help
> > ale(4) to negotiate with it at full speed?
> 
> Because there is no publicly available data sheet for Atheros F1
> PHY I'm not sure what could be done in this case.  The only thing
> I can think of at this moment is announcement of next page in auto
> negotiation. [...]
> Try attached patch and let me know whether this makes any
> difference for you.  You may have to cold boot the box because
> stock driver used to clear next page bit in auto-negotiation.

Thanks for the patch, but it does not make any noticeable difference.  I'll
try to boot some Ubuntu livecd to see if it works there; eventually I might
have to simply go out and buy some PCI-E gigE card. :(

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2014-05-08 Thread Yonghyeon PYUN
On Thu, May 08, 2014 at 05:23:32PM +, Alexey Dokuchaev wrote:
> On Tue, Mar 05, 2013 at 09:14:11AM +, Alexey Dokuchaev wrote:
> > On Tue, Mar 05, 2013 at 05:57:03PM +0900, YongHyeon PYUN wrote:
> > > Hmm, Does the switch support EEE feature? If yes, would you try
> > > disabling it?
> > 
> > I do not think it [1] does; plus I cannot do much about this switch, as I'm
> > pretty far away from it right now.
> > 
> > [1] 
> > http://netgear.com/home/products/switches-and-access-points/unmanaged-switches/GS608.aspx
> >  (got it about 4 years ago)
> 
> I just had a chance to plug the Ethernet cable directly into my laptop's
> bge(4) port, and it immediately negotiated at 1000baseT; but with the switch,
> it can only feel fine with 10baseT/UTP (after some 1000baseT-no carrier flip
> flopping).  So it looks like it fails to talk to the switch.  Given that this
> switch of mine in a simple (dumb) piece of equipment, any ideas how to help
> ale(4) to negotiate with it at full speed?
> 

Because there is no publicly available data sheet for Atheros F1
PHY I'm not sure what could be done in this case.  The only thing
I can think of at this moment is announcement of next page in auto
negotiation.  atphy(4) does not directly manipulate master/slave,
single port/multi port configuration and this configuration may
need next page if other link partner also announces next page
capability.
Try attached patch and let me know whether this makes any
difference for you.  You may have to cold boot the box because
stock driver used to clear next page bit in auto-negotiation.

> ./danfe
Index: sys/dev/mii/atphy.c
===
--- sys/dev/mii/atphy.c	(revision 265477)
+++ sys/dev/mii/atphy.c	(working copy)
@@ -338,7 +338,9 @@ atphy_setmedia(struct mii_softc *sc, int media)
 {
 	uint16_t anar;
 
-	anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
+	anar = PHY_READ(sc, MII_ANAR);
+	anar &= ANAR_NP;
+	anar |= BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
 	if ((IFM_SUBTYPE(media) == IFM_AUTO || (media & IFM_FDX) != 0) &&
 	((media & IFM_FLOW) != 0 ||
 	(sc->mii_flags & MIIF_FORCEPAUSE) != 0))
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2014-05-08 Thread Alexey Dokuchaev
On Tue, Mar 05, 2013 at 09:14:11AM +, Alexey Dokuchaev wrote:
> On Tue, Mar 05, 2013 at 05:57:03PM +0900, YongHyeon PYUN wrote:
> > Hmm, Does the switch support EEE feature? If yes, would you try
> > disabling it?
> 
> I do not think it [1] does; plus I cannot do much about this switch, as I'm
> pretty far away from it right now.
> 
> [1] 
> http://netgear.com/home/products/switches-and-access-points/unmanaged-switches/GS608.aspx
>  (got it about 4 years ago)

I just had a chance to plug the Ethernet cable directly into my laptop's
bge(4) port, and it immediately negotiated at 1000baseT; but with the switch,
it can only feel fine with 10baseT/UTP (after some 1000baseT-no carrier flip
flopping).  So it looks like it fails to talk to the switch.  Given that this
switch of mine in a simple (dumb) piece of equipment, any ideas how to help
ale(4) to negotiate with it at full speed?

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-05 Thread Alexey Dokuchaev
On Tue, Mar 05, 2013 at 05:57:03PM +0900, YongHyeon PYUN wrote:
> Hmm, Does the switch support EEE feature? If yes, would you try
> disabling it?

I do not think it [1] does; plus I cannot do much about this switch, as I'm
pretty far away from it right now.

./danfe

[1] 
http://netgear.com/home/products/switches-and-access-points/unmanaged-switches/GS608.aspx
 (got it about 4 years ago)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-05 Thread YongHyeon PYUN
On Tue, Mar 05, 2013 at 08:06:20AM +, Alexey Dokuchaev wrote:
> On Tue, Mar 05, 2013 at 04:43:15PM +0900, YongHyeon PYUN wrote:
> > > > Could you disable WOL before rebooting your box?
> > > 
> > > # ifconfig ale0 -wol
> > > # reboot
> > > 
> > > It came up as 100baseTX. :(
> > 
> > You don't use any manual link configuration, right?
> 
> Right, everything is auto (that is, the defaults).
> 
> > When you see the controller established a 100Mbps link, how about
> > restarting auto-negotiation? Does that also result in 100Mbps link?
> 
> # ifconfig ale0 media auto
> # ifconfig ale0 | egrep -v ether\|inet
> ale0: flags=8843 metric 0 mtu 1500
> 
> options=c319a
> nd6 options=29
> media: Ethernet autoselect (100baseTX )
> status: active
> 
> Tried a few times, no difference.

Hmm, Does the switch support EEE feature? If yes, would you try
disabling it?

> 
> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-05 Thread Alexey Dokuchaev
On Tue, Mar 05, 2013 at 04:43:15PM +0900, YongHyeon PYUN wrote:
> > > Could you disable WOL before rebooting your box?
> > 
> > # ifconfig ale0 -wol
> > # reboot
> > 
> > It came up as 100baseTX. :(
> 
> You don't use any manual link configuration, right?

Right, everything is auto (that is, the defaults).

> When you see the controller established a 100Mbps link, how about
> restarting auto-negotiation? Does that also result in 100Mbps link?

# ifconfig ale0 media auto
# ifconfig ale0 | egrep -v ether\|inet
ale0: flags=8843 metric 0 mtu 1500

options=c319a
nd6 options=29
media: Ethernet autoselect (100baseTX )
status: active

Tried a few times, no difference.

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-04 Thread YongHyeon PYUN
On Tue, Mar 05, 2013 at 06:59:10AM +, Alexey Dokuchaev wrote:
> On Tue, Mar 05, 2013 at 02:49:20PM +0900, YongHyeon PYUN wrote:
> > On Mon, Mar 04, 2013 at 08:18:58AM +, Alexey Dokuchaev wrote:
> > > Yes, multiple reboots was a good idea, it's not very stable: [...]
> > > 
> > > I've tried various combinations of just reboot, shutdown -r +1m and
> > > pinging some host while waiting for reboot.
> > 
> > Could you disable WOL before rebooting your box?
> 
> # ifconfig ale0 -wol
> # reboot
> 
> It came up as 100baseTX. :(

You don't use any manual link configuration, right?

When you see the controller established a 100Mbps link, how about
restarting auto-negotiation? Does that also result in 100Mbps link?

#ifconfig ale0 media auto

> 
> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-04 Thread Alexey Dokuchaev
On Tue, Mar 05, 2013 at 02:49:20PM +0900, YongHyeon PYUN wrote:
> On Mon, Mar 04, 2013 at 08:18:58AM +, Alexey Dokuchaev wrote:
> > Yes, multiple reboots was a good idea, it's not very stable: [...]
> > 
> > I've tried various combinations of just reboot, shutdown -r +1m and
> > pinging some host while waiting for reboot.
> 
> Could you disable WOL before rebooting your box?

# ifconfig ale0 -wol
# reboot

It came up as 100baseTX. :(

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-04 Thread YongHyeon PYUN
On Mon, Mar 04, 2013 at 08:18:58AM +, Alexey Dokuchaev wrote:
> On Mon, Mar 04, 2013 at 04:06:32PM +0900, YongHyeon PYUN wrote:
> > On Mon, Mar 04, 2013 at 06:59:40AM +, Alexey Dokuchaev wrote:
> > > Better this time, I'm having 1000baseT again! :-)
> > 
> > Thanks a lot for testing and patience!
> > Could you reboot multiple times and check whether you reliably get
> > a gigabit link?
> 
> Yes, multiple reboots was a good idea, it's not very stable:
> 
> 1st reboot:   100baseTX (!)
> 2nd reboot:   1000baseT
> 3rd reboot:   1000baseT
> 4th reboot:   1000baseT
> 5th reboot:   100baseTX (!)
> 6th reboot:   100baseTX (!)
> 7th reboot:   1000baseT
> 8th reboot:   100baseTX (!)
> 9th reboot:   1000baseT
> 10th reboot:  1000baseT
> 
> I've tried various combinations of just reboot, shutdown -r +1m and pinging
> some host while waiting for reboot.

Could you disable WOL before rebooting your box? You can disable
WOL like the following.
#ifconfig ale0 -wol

> 
> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-04 Thread Alexey Dokuchaev
On Mon, Mar 04, 2013 at 04:06:32PM +0900, YongHyeon PYUN wrote:
> On Mon, Mar 04, 2013 at 06:59:40AM +, Alexey Dokuchaev wrote:
> > Better this time, I'm having 1000baseT again! :-)
> 
> Thanks a lot for testing and patience!
> Could you reboot multiple times and check whether you reliably get
> a gigabit link?

Yes, multiple reboots was a good idea, it's not very stable:

1st reboot: 100baseTX (!)
2nd reboot: 1000baseT
3rd reboot: 1000baseT
4th reboot: 1000baseT
5th reboot: 100baseTX (!)
6th reboot: 100baseTX (!)
7th reboot: 1000baseT
8th reboot: 100baseTX (!)
9th reboot: 1000baseT
10th reboot:1000baseT

I've tried various combinations of just reboot, shutdown -r +1m and pinging
some host while waiting for reboot.

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread YongHyeon PYUN
On Mon, Mar 04, 2013 at 06:59:40AM +, Alexey Dokuchaev wrote:
> On Mon, Mar 04, 2013 at 03:29:44PM +0900, YongHyeon PYUN wrote:
> > On Mon, Mar 04, 2013 at 05:59:48AM +, Alexey Dokuchaev wrote:
> > > On Mon, Mar 04, 2013 at 02:23:28PM +0900, YongHyeon PYUN wrote:
> > > > Ok, here is final diff which combines two things you've tested.
> > > > So revert any changes before applying it.
> > > > Let me know how it goes on your box.
> > > 
> > > Hmm, apparently something went wrong, as I'm back to 100baseTX after make
> > > kernel and reboot...
> > 
> > Hmm, updated diff again.
> 
> Better this time, I'm having 1000baseT again! :-)
> 

Thanks a lot for testing and patience!
Could you reboot multiple times and check whether you reliably get
a gigabit link?

> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Mon, Mar 04, 2013 at 03:29:44PM +0900, YongHyeon PYUN wrote:
> On Mon, Mar 04, 2013 at 05:59:48AM +, Alexey Dokuchaev wrote:
> > On Mon, Mar 04, 2013 at 02:23:28PM +0900, YongHyeon PYUN wrote:
> > > Ok, here is final diff which combines two things you've tested.
> > > So revert any changes before applying it.
> > > Let me know how it goes on your box.
> > 
> > Hmm, apparently something went wrong, as I'm back to 100baseTX after make
> > kernel and reboot...
> 
> Hmm, updated diff again.

Better this time, I'm having 1000baseT again! :-)

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread YongHyeon PYUN
On Mon, Mar 04, 2013 at 05:59:48AM +, Alexey Dokuchaev wrote:
> On Mon, Mar 04, 2013 at 02:23:28PM +0900, YongHyeon PYUN wrote:
> > Ok, here is final diff which combines two things you've tested.
> > So revert any changes before applying it.
> > Let me know how it goes on your box.
> 
> Hmm, apparently something went wrong, as I'm back to 100baseTX after make
> kernel and reboot...

Hmm, updated diff again.

> 
> ./danfe
Index: sys/dev/ale/if_ale.c
===
--- sys/dev/ale/if_ale.c(revision 247382)
+++ sys/dev/ale/if_ale.c(working copy)
@@ -406,11 +406,13 @@ ale_phy_reset(struct ale_softc *sc)
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET |
GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   CSR_READ_2(sc, ALE_GPHY_CTRL);
+   DELAY(2000);
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE |
GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   CSR_READ_2(sc, ALE_GPHY_CTRL);
+   DELAY(2000);
 
 #defineATPHY_DBG_ADDR  0x1D
 #defineATPHY_DBG_DATA  0x1E
@@ -635,7 +637,7 @@ ale_attach(device_t dev)
/* Set up MII bus. */
error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange,
ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY,
-   MIIF_DOPAUSE);
+   MIIF_DOPAUSE | MIIF_MACPRIV0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
@@ -1515,6 +1517,7 @@ ale_setwol(struct ale_softc *sc)
GPHY_CTRL_HIB_PULSE | GPHY_CTRL_PHY_PLL_ON |
GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_IDDQ |
GPHY_CTRL_PCLK_SEL_DIS | GPHY_CTRL_PWDOWN_HW);
+   CSR_READ_2(sc, ALE_GPHY_CTRL);
return;
}
 
@@ -1547,6 +1550,7 @@ ale_setwol(struct ale_softc *sc)
GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET |
GPHY_CTRL_PHY_IDDQ | GPHY_CTRL_PCLK_SEL_DIS |
GPHY_CTRL_PWDOWN_HW);
+   CSR_READ_2(sc, ALE_GPHY_CTRL);
}
/* Request PME. */
pmstat = pci_read_config(sc->ale_dev, pmc + PCIR_POWER_STATUS, 2);
Index: sys/dev/mii/atphy.c
===
--- sys/dev/mii/atphy.c (revision 247382)
+++ sys/dev/mii/atphy.c (working copy)
@@ -100,8 +100,14 @@ atphy_probe(device_t dev)
 static int
 atphy_attach(device_t dev)
 {
+   struct mii_attach_args *ma;
+   u_int flags;
 
-   mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &atphy_funcs, 1);
+   ma = device_get_ivars(dev);
+   flags = MIIF_NOMANPAUSE;
+   if ((miibus_get_flags(dev) & MIIF_MACPRIV0) != 0)
+   flags |= MIIF_PHYPRIV0;
+   mii_phy_dev_attach(dev, flags, &atphy_funcs, 1);
return (0);
 }
 
@@ -287,9 +293,11 @@ atphy_reset(struct mii_softc *sc)
uint32_t reg;
int i;
 
-   /* Take PHY out of power down mode. */
-   PHY_WRITE(sc, 29, 0x29);
-   PHY_WRITE(sc, 30, 0);
+   if ((sc->mii_flags & MIIF_PHYPRIV0) != 0) {
+   /* Take PHY out of power down mode. */
+   PHY_WRITE(sc, 29, 0x29);
+   PHY_WRITE(sc, 30, 0);
+   }
 
reg = PHY_READ(sc, ATPHY_SCR);
/* Enable automatic crossover. */
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Mon, Mar 04, 2013 at 02:23:28PM +0900, YongHyeon PYUN wrote:
> Ok, here is final diff which combines two things you've tested.
> So revert any changes before applying it.
> Let me know how it goes on your box.

Hmm, apparently something went wrong, as I'm back to 100baseTX after make
kernel and reboot...

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread YongHyeon PYUN
On Mon, Mar 04, 2013 at 02:46:31AM +, Alexey Dokuchaev wrote:
> On Mon, Mar 04, 2013 at 11:10:59AM +0900, YongHyeon PYUN wrote:
> > On Mon, Mar 04, 2013 at 01:53:44AM +, Alexey Dokuchaev wrote:
> > > Yes, it did help.  With 2000us delays (I didn't revert them [...]
> > 
> > Great! But it seems 2ms delays is too much.  Could you revert the change
> > (2000us delays) and try it again?
> 
> Reverting if_ale.c, making kernel, and reboot gave me 100baseTX again; :-(
> second reboot (with the same kernel) did not help.  Bumping delays to 2ms
> (just to make sure) restored GigE mode upon 1st reboot after "make kernel".
> 

Ok, here is final diff which combines two things you've tested.
So revert any changes before applying it.
Let me know how it goes on your box.

> ./danfe
Index: sys/dev/ale/if_ale.c
===
--- sys/dev/ale/if_ale.c(revision 247382)
+++ sys/dev/ale/if_ale.c(working copy)
@@ -406,11 +406,11 @@ ale_phy_reset(struct ale_softc *sc)
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET |
GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   DELAY(2000);
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE |
GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   DELAY(2000);
 
 #defineATPHY_DBG_ADDR  0x1D
 #defineATPHY_DBG_DATA  0x1E
@@ -635,7 +635,7 @@ ale_attach(device_t dev)
/* Set up MII bus. */
error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange,
ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY,
-   MIIF_DOPAUSE);
+   MIIF_DOPAUSE | MIIF_MACPRIV0);
if (error != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto fail;
Index: sys/dev/mii/atphy.c
===
--- sys/dev/mii/atphy.c (revision 247382)
+++ sys/dev/mii/atphy.c (working copy)
@@ -100,8 +100,14 @@ atphy_probe(device_t dev)
 static int
 atphy_attach(device_t dev)
 {
+   struct mii_attach_args *ma;
+   u_int flags;
 
-   mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &atphy_funcs, 1);
+   ma = device_get_ivars(dev);
+   flags = MIIF_NOMANPAUSE;
+   if ((miibus_get_flags(dev) & MIIF_MACPRIV0) != 0)
+   flags |= MIIF_PHYPRIV0;
+   mii_phy_dev_attach(dev, flags, &atphy_funcs, 1);
return (0);
 }
 
@@ -287,9 +293,11 @@ atphy_reset(struct mii_softc *sc)
uint32_t reg;
int i;
 
-   /* Take PHY out of power down mode. */
-   PHY_WRITE(sc, 29, 0x29);
-   PHY_WRITE(sc, 30, 0);
+   if ((sc->mii_flags & MIIF_PHYPRIV0) != 0) {
+   /* Take PHY out of power down mode. */
+   PHY_WRITE(sc, 29, 0x29);
+   PHY_WRITE(sc, 30, 0);
+   }
 
reg = PHY_READ(sc, ATPHY_SCR);
/* Enable automatic crossover. */
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Mon, Mar 04, 2013 at 11:10:59AM +0900, YongHyeon PYUN wrote:
> On Mon, Mar 04, 2013 at 01:53:44AM +, Alexey Dokuchaev wrote:
> > Yes, it did help.  With 2000us delays (I didn't revert them [...]
> 
> Great! But it seems 2ms delays is too much.  Could you revert the change
> (2000us delays) and try it again?

Reverting if_ale.c, making kernel, and reboot gave me 100baseTX again; :-(
second reboot (with the same kernel) did not help.  Bumping delays to 2ms
(just to make sure) restored GigE mode upon 1st reboot after "make kernel".

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread YongHyeon PYUN
On Mon, Mar 04, 2013 at 01:53:44AM +, Alexey Dokuchaev wrote:
> On Mon, Mar 04, 2013 at 09:50:44AM +0900, YongHyeon PYUN wrote:
> > On Sun, Mar 03, 2013 at 12:00:10PM +, Alexey Dokuchaev wrote:
> > > Alas, after "make kernel", link come up as 100mbps again, playing with
> > > delays and rebooting (several times) did not make it GigE.  I'm not sure
> > > what's actually affecting it. :-(
> > 
> > Would you try attached patch?
> 
> Yes, it did help.  With 2000us delays (I didn't revert them since you didn't

Great! But it seems 2ms delays is too much.

> ask), machine came up after "make kernel" and reboot with ale0 in GigE mode.
> 
> I'll be happy to conduct more tests for you, if needed, thanks!

Could you revert the change(2000us delays) and try it again?
If that change works I still have to find a specific PHY model to
exclude the blind PHY wakeup.

> 
> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Mon, Mar 04, 2013 at 09:50:44AM +0900, YongHyeon PYUN wrote:
> On Sun, Mar 03, 2013 at 12:00:10PM +, Alexey Dokuchaev wrote:
> > Alas, after "make kernel", link come up as 100mbps again, playing with
> > delays and rebooting (several times) did not make it GigE.  I'm not sure
> > what's actually affecting it. :-(
> 
> Would you try attached patch?

Yes, it did help.  With 2000us delays (I didn't revert them since you didn't
ask), machine came up after "make kernel" and reboot with ale0 in GigE mode.

I'll be happy to conduct more tests for you, if needed, thanks!

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread YongHyeon PYUN
On Sun, Mar 03, 2013 at 12:00:10PM +, Alexey Dokuchaev wrote:
> On Sun, Mar 03, 2013 at 09:53:30AM +, Alexey Dokuchaev wrote:
> > However, after reboot ale0 come up at 1000baseT , with patched
> > driver (longer delays in ale_phy_reset()).  I've reverted this change and
> > rebooted again, but it again come up as GigE.
> 
> Alas, after "make kernel", link come up as 100mbps again, playing with
> delays and rebooting (several times) did not make it GigE.  I'm not sure
> what's actually affecting it. :-(

Would you try attached patch?

> 
> ./danfe
Index: sys/dev/mii/atphy.c
===
--- sys/dev/mii/atphy.c	(revision 247382)
+++ sys/dev/mii/atphy.c	(working copy)
@@ -287,9 +287,11 @@ atphy_reset(struct mii_softc *sc)
 	uint32_t reg;
 	int i;
 
+#if 0
 	/* Take PHY out of power down mode. */
 	PHY_WRITE(sc, 29, 0x29);
 	PHY_WRITE(sc, 30, 0);
+#endif
 
 	reg = PHY_READ(sc, ATPHY_SCR);
 	/* Enable automatic crossover. */
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Sun, Mar 03, 2013 at 09:53:30AM +, Alexey Dokuchaev wrote:
> However, after reboot ale0 come up at 1000baseT , with patched
> driver (longer delays in ale_phy_reset()).  I've reverted this change and
> rebooted again, but it again come up as GigE.

Alas, after "make kernel", link come up as 100mbps again, playing with
delays and rebooting (several times) did not make it GigE.  I'm not sure
what's actually affecting it. :-(

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-03-03 Thread Alexey Dokuchaev
On Mon, Feb 25, 2013 at 05:23:44PM +0900, YongHyeon PYUN wrote:
> Then have no idea at this moment. Can you try other OS and check
> whether it can establish a gigabit link?

I did not have a chance to try other OS, because machine paniced during
tinderbuilding of a large port.  Unfortunately I don't have a backtrace, as
I needed to ask my friends to reboot it (I myself do not have direct access
to it right now).

However, after reboot ale0 come up at 1000baseT , with patched
driver (longer delays in ale_phy_reset()).  I've reverted this change and
rebooted again, but it again come up as GigE.  I cannot power down the box
completely, since there is no one around who can bring it back right now
(press the power button).

That said, it looks quite weird to me at this point.  Previously it was
rebooted a few times, and link speed was always 100mbps.  Patching the
driver and re-kldloading it did not help, but after reboot, link speed is
1000ish even with unpatched driver.  :-/

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-02-25 Thread YongHyeon PYUN
On Fri, Feb 22, 2013 at 01:56:07AM +, Alexey Dokuchaev wrote:
> On Fri, Feb 22, 2013 at 10:13:08AM +0900, YongHyeon PYUN wrote:
> > On Thu, Feb 21, 2013 at 12:43:44PM +, Alexey Dokuchaev wrote:
> > > ale_flags = 0x0040
> > 
> > Thanks for the info. Indeed, your controller is AR8121 Gigabit
> > etherent(L1E). I guess the PHY initialization is not complete.
> > Would you try attached patch?
> 
> Thanks for the patch.  Unfortunately, it's still "100baseTX "
> after driver reload.  Even tried delaying for 3000, no difference. :(
> 

Then have no idea at this moment. Can you try other OS and check
whether it can establish a gigabit link?

> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-02-21 Thread Alexey Dokuchaev
On Fri, Feb 22, 2013 at 10:13:08AM +0900, YongHyeon PYUN wrote:
> On Thu, Feb 21, 2013 at 12:43:44PM +, Alexey Dokuchaev wrote:
> > ale_flags = 0x0040
> 
> Thanks for the info. Indeed, your controller is AR8121 Gigabit
> etherent(L1E). I guess the PHY initialization is not complete.
> Would you try attached patch?

Thanks for the patch.  Unfortunately, it's still "100baseTX "
after driver reload.  Even tried delaying for 3000, no difference. :(

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-02-21 Thread YongHyeon PYUN
On Thu, Feb 21, 2013 at 12:43:44PM +, Alexey Dokuchaev wrote:
> On Thu, Feb 21, 2013 at 05:33:35PM +0900, YongHyeon PYUN wrote:
> > On Wed, Feb 20, 2013 at 06:08:53AM +, Alexey Dokuchaev wrote:
> > > $ dmesg | egrep ale\|atphy
> > > ale0:  port 0xcc00-0xcc7f mem 
> > > 0xfe9c-0xfe9f irq 17 at device 0.0 on pci2
> > > ale0: 960 Tx FIFO, 1024 Rx FIFO
> > > ale0: Using 1 MSI messages.
> > > ale0: 4GB boundary crossed, switching to 32bit DMA addressing mode.
> > > miibus0:  on ale0
> > > atphy0:  PHY 0 on miibus0
> > > atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 
> > > 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow
> > > 
> > > $ devinfo -rv | grep atphy
> > > atphy0 pnpinfo oui=0xc82e model=0x1 rev=0x9 at phyno=0
> > 
> > Hmm, it's still not clear whether the controller is Gigabit or not.
> > Could you try attached patch and let me the output?
> 
> ale_flags = 0x0040

Thanks for the info. Indeed, your controller is AR8121 Gigabit
etherent(L1E). I guess the PHY initialization is not complete.
Would you try attached patch?

> 
> ./danfe
Index: sys/dev/ale/if_ale.c
===
--- sys/dev/ale/if_ale.c(revision 246937)
+++ sys/dev/ale/if_ale.c(working copy)
@@ -406,11 +406,11 @@
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE | GPHY_CTRL_SEL_ANA_RESET |
GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   DELAY(2000);
CSR_WRITE_2(sc, ALE_GPHY_CTRL,
GPHY_CTRL_EXT_RESET | GPHY_CTRL_HIB_EN | GPHY_CTRL_HIB_PULSE |
GPHY_CTRL_SEL_ANA_RESET | GPHY_CTRL_PHY_PLL_ON);
-   DELAY(1000);
+   DELAY(2000);
 
 #defineATPHY_DBG_ADDR  0x1D
 #defineATPHY_DBG_DATA  0x1E
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2013-02-21 Thread Alexey Dokuchaev
On Thu, Feb 21, 2013 at 05:33:35PM +0900, YongHyeon PYUN wrote:
> On Wed, Feb 20, 2013 at 06:08:53AM +, Alexey Dokuchaev wrote:
> > $ dmesg | egrep ale\|atphy
> > ale0:  port 0xcc00-0xcc7f mem 
> > 0xfe9c-0xfe9f irq 17 at device 0.0 on pci2
> > ale0: 960 Tx FIFO, 1024 Rx FIFO
> > ale0: Using 1 MSI messages.
> > ale0: 4GB boundary crossed, switching to 32bit DMA addressing mode.
> > miibus0:  on ale0
> > atphy0:  PHY 0 on miibus0
> > atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 
> > 1000baseT-FDX, 1000baseT-FDX-master, auto, auto-flow
> > 
> > $ devinfo -rv | grep atphy
> > atphy0 pnpinfo oui=0xc82e model=0x1 rev=0x9 at phyno=0
> 
> Hmm, it's still not clear whether the controller is Gigabit or not.
> Could you try attached patch and let me the output?

ale_flags = 0x0040

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-02-21 Thread YongHyeon PYUN
On Wed, Feb 20, 2013 at 06:08:53AM +, Alexey Dokuchaev wrote:
> On Wed, Feb 20, 2013 at 01:37:39PM +0900, YongHyeon PYUN wrote:
> > On Tue, Feb 19, 2013 at 08:23:02AM +, Alexey Dokuchaev wrote:
> > > ale0@pci0:2:0:0:class=0x02 card=0x82261043 chip=0x10261969
> > > rev=0xb0 hdr=0x00
> > > vendor = 'Atheros Communications Inc.'
> > > device = 'AR8121/AR8113/AR8114 Gigabit or Fast Ethernet'
> > > class  = network
> > > subclass   = ethernet
> > > 
> > > According the the specs, it should be GigE. [...]
> > 
> > There is a fast etherenet version(L2E) so I'm not sure what you
> > have. Could you show me dmesg output(ale(4) & atphy(4) only) and
> > "devinfo -rv | grep atphy"?
> 
> $ dmesg | egrep ale\|atphy
> ale0:  port 0xcc00-0xcc7f mem 
> 0xfe9c-0xfe9f irq 17 at device 0.0 on pci2
> ale0: 960 Tx FIFO, 1024 Rx FIFO
> ale0: Using 1 MSI messages.
> ale0: 4GB boundary crossed, switching to 32bit DMA addressing mode.
> miibus0:  on ale0
> atphy0:  PHY 0 on miibus0
> atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 
> 1000baseT-FDX-master, auto, auto-flow
> 
> $ devinfo -rv | grep atphy
> atphy0 pnpinfo oui=0xc82e model=0x1 rev=0x9 at phyno=0

Hmm, it's still not clear whether the controller is Gigabit or not.
Could you try attached patch and let me the output?

> 
> > > I'm not sure why it happens; maybe it's somehow related to a handful of
> > > those "ale0: link state changed to DOWN/UP" flip-flops I see in dmesg(8),
> > > before it can finally obtain DHCP lease?
> > 
> > That's normal when you initiate auto-negotiation with dhclient.
> 
> Yes, I've already seen your lengthy explanation [1], thanks!
> 
> > > I remember these adapters had problems in the past, like infamous
> > > "Corrupted MAC on input" disconnect messages, but I don't recall that I
> > > could not use it in GigE mode. [...]
> > 
> > If you still see the "Corrupted MAC on input" message, let me know.
> 
> No, those are long gone now (hopefully; at least I haven't seen them for a
> while).
> 
> ./danfe
> 
> [1] http://lists.freebsd.org/pipermail/freebsd-net/2009-January/020662.html
Index: sys/dev/ale/if_ale.c
===
--- sys/dev/ale/if_ale.c	(revision 246937)
+++ sys/dev/ale/if_ale.c	(working copy)
@@ -497,6 +497,9 @@ ale_attach(device_t dev)
 			sc->ale_flags |= ALE_FLAG_FASTETHER;
 		}
 	}
+#if 1
+	printf("ale_flags = 0x%08x\n", sc->ale_flags);
+#endif
 	/*
 	 * All known controllers seems to require 4 bytes alignment
 	 * of Tx buffers to make Tx checksum offload with custom
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ale(4) cannot negotiate as GigE

2013-02-19 Thread Alexey Dokuchaev
On Wed, Feb 20, 2013 at 01:37:39PM +0900, YongHyeon PYUN wrote:
> On Tue, Feb 19, 2013 at 08:23:02AM +, Alexey Dokuchaev wrote:
> > ale0@pci0:2:0:0:class=0x02 card=0x82261043 chip=0x10261969
> > rev=0xb0 hdr=0x00
> > vendor = 'Atheros Communications Inc.'
> > device = 'AR8121/AR8113/AR8114 Gigabit or Fast Ethernet'
> > class  = network
> > subclass   = ethernet
> > 
> > According the the specs, it should be GigE. [...]
> 
> There is a fast etherenet version(L2E) so I'm not sure what you
> have. Could you show me dmesg output(ale(4) & atphy(4) only) and
> "devinfo -rv | grep atphy"?

$ dmesg | egrep ale\|atphy
ale0:  port 0xcc00-0xcc7f mem 
0xfe9c-0xfe9f irq 17 at device 0.0 on pci2
ale0: 960 Tx FIFO, 1024 Rx FIFO
ale0: Using 1 MSI messages.
ale0: 4GB boundary crossed, switching to 32bit DMA addressing mode.
miibus0:  on ale0
atphy0:  PHY 0 on miibus0
atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 
1000baseT-FDX-master, auto, auto-flow

$ devinfo -rv | grep atphy
atphy0 pnpinfo oui=0xc82e model=0x1 rev=0x9 at phyno=0

> > I'm not sure why it happens; maybe it's somehow related to a handful of
> > those "ale0: link state changed to DOWN/UP" flip-flops I see in dmesg(8),
> > before it can finally obtain DHCP lease?
> 
> That's normal when you initiate auto-negotiation with dhclient.

Yes, I've already seen your lengthy explanation [1], thanks!

> > I remember these adapters had problems in the past, like infamous
> > "Corrupted MAC on input" disconnect messages, but I don't recall that I
> > could not use it in GigE mode. [...]
> 
> If you still see the "Corrupted MAC on input" message, let me know.

No, those are long gone now (hopefully; at least I haven't seen them for a
while).

./danfe

[1] http://lists.freebsd.org/pipermail/freebsd-net/2009-January/020662.html
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ale(4) cannot negotiate as GigE

2013-02-19 Thread YongHyeon PYUN
On Tue, Feb 19, 2013 at 08:23:02AM +, Alexey Dokuchaev wrote:
> Hi there,
> 
> I've recently put back online one of my home servers, updated to the latest
> -CURRENT code.  All went fine, but one thing bothers me.  This box bears
> Asus P5Q Pro mobo, with the following onboard NIC:
> 
> ale0@pci0:2:0:0:class=0x02 card=0x82261043 chip=0x10261969
> rev=0xb0 hdr=0x00
> vendor = 'Atheros Communications Inc.'
> device = 'AR8121/AR8113/AR8114 Gigabit or Fast Ethernet'
> class  = network
> subclass   = ethernet
> 
> According the the specs, it should be GigE.  In fact, when plugged into a
> capable switch, it displays "green" (gig) status (same on the switch), but
> once being initialized by the kernel, it downgrades to yellowish 100mbps
> (real speeds agree).

There is a fast etherenet version(L2E) so I'm not sure what you
have. Could you show me dmesg output(ale(4) & atphy(4) only) and
"devinfo -rv| grep atphy"?

> 
> I'm not sure why it happens; maybe it's somehow related to a handful of
> those "ale0: link state changed to DOWN/UP" flip-flops I see in dmesg(8),
> before it can finally obtain DHCP lease?

That's normal when you initiates auto-negotiation with dhclient.

> 
> I remember these adapters had problems in the past, like infamous "Corrupted
> MAC on input" disconnect messages, but I don't recall that I could not use
> it in GigE mode.  Anything I can do about it?  Googling did not help much:
> most reports date back to ca. 2009, and apparently were ironed out in later
> revisions (e.g. selectively disabling checksum offloading).  Thanks,
> 

If you still see the "Corrupted MAC on input" message, let me know.

> ./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


ale(4) cannot negotiate as GigE

2013-02-19 Thread Alexey Dokuchaev
Hi there,

I've recently put back online one of my home servers, updated to the latest
-CURRENT code.  All went fine, but one thing bothers me.  This box bears
Asus P5Q Pro mobo, with the following onboard NIC:

ale0@pci0:2:0:0:class=0x02 card=0x82261043 chip=0x10261969
rev=0xb0 hdr=0x00
vendor = 'Atheros Communications Inc.'
device = 'AR8121/AR8113/AR8114 Gigabit or Fast Ethernet'
class  = network
subclass   = ethernet

According the the specs, it should be GigE.  In fact, when plugged into a
capable switch, it displays "green" (gig) status (same on the switch), but
once being initialized by the kernel, it downgrades to yellowish 100mbps
(real speeds agree).

I'm not sure why it happens; maybe it's somehow related to a handful of
those "ale0: link state changed to DOWN/UP" flip-flops I see in dmesg(8),
before it can finally obtain DHCP lease?

I remember these adapters had problems in the past, like infamous "Corrupted
MAC on input" disconnect messages, but I don't recall that I could not use
it in GigE mode.  Anything I can do about it?  Googling did not help much:
most reports date back to ca. 2009, and apparently were ironed out in later
revisions (e.g. selectively disabling checksum offloading).  Thanks,

./danfe
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"