Skip to contentSkip to conversation

Ethernet: how to disable gigabit support

DISCUSSION Pavel Machek 4 participants 6 messages Feb 5, 2015 – Feb 12, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi!

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Is there way to do that without hacking the kernel? Should mii-tool do that?

Thanks,
Pavel

root@ib8315:~# mii-tool.net-tools  -A 100baseTx,10baseT eth1
restarting autonegotiation...
root@ib8315:~# [32432.443883] libphy: mdio@e0024520:01 - Link is Down
root@ib8315:~# [32435.447863] libphy: mdio@e0024520:01 - Link is Up - 1000/Full
root@ib8315:~# mii-tool.net-tools -v eth1
eth1: negotiated 1000baseT-FD flow-control, link ok
product info: vendor 00:01:c1, model 3 rev 1
basic mode:   autonegotiation enabled
 basic status: autonegotiation complete, link ok
 capabilities: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 advertising:  1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 link partner: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD flow-control
 root@ib8315:~# mii-tool.net-tools -V
 $Id: mii-tool.c,v 1.9 2006/09/27 20:59:18 ecki Exp $
 (Author: David Hinds based on Donald Becker's mii-diag)
 net-tools 1.60
 root@ib8315:~#
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw
Quoted 10 lines · Pavel Machek

Hi!

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Is there way to do that without hacking the kernel? Should mii-tool do that?

Since you use the PHY library, you should be able to do something like this in your PHY driver prior to starting the PHY state machine:

phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit capability)

See drivers/net/ethernet/broadcom/genet/bcmmii.c for instance where this is done based on the type of interface (RevMII, MII) we are connected to.

Quoted 28 lines

Thanks,
Pavel

root@ib8315:~# mii-tool.net-tools  -A 100baseTx,10baseT eth1
restarting autonegotiation...
root@ib8315:~# [32432.443883] libphy: mdio@e0024520:01 - Link is Down
root@ib8315:~# [32435.447863] libphy: mdio@e0024520:01 - Link is Up - 1000/Full
root@ib8315:~# mii-tool.net-tools -v eth1
eth1: negotiated 1000baseT-FD flow-control, link ok
product info: vendor 00:01:c1, model 3 rev 1
basic mode:   autonegotiation enabled
 basic status: autonegotiation complete, link ok
 capabilities: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 advertising:  1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 link partner: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD flow-control
 root@ib8315:~# mii-tool.net-tools -V
 $Id: mii-tool.c,v 1.9 2006/09/27 20:59:18 ecki Exp $
 (Author: David Hinds based on Donald Becker's mii-diag)
 net-tools 1.60
 root@ib8315:~#
Signature · 1 line
Florian
#2 lore raw
Quoted 9 lines · Florian Fainelli
Quoted 8 lines · Pavel Machek

Hi!

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Quoted 8 lines
Quoted 2 lines

Is there way to do that without hacking the kernel? Should mii-tool do that?

Since you use the PHY library, you should be able to do something like this in your PHY driver prior to starting the PHY state machine:

phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit capability)

Thanks, that did the trick.
Pavel
(But still it would be nice to have a generic way of doing this, using something like mii-tool.)

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 14 lines · On Fri, 06 February 2015 Pavel Machek wrote:
Quoted 13 lines · Florian Fainelli
Quoted 8 lines · Pavel Machek

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Is there way to do that without hacking the kernel? Should mii-tool do that?

Since you use the PHY library, you should be able to do something like this in your PHY driver prior to starting the PHY state machine:

Quoted 7 lines
Quoted 2 lines

phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit capability)

Thanks, that did the trick.
Pavel
(But still it would be nice to have a generic way of doing this, using something like mii-tool.)

You can use ethtool to do so:

ethtool -s ethX advertise 0x0f

c.f. man ethtool:
advertise N

    Sets the speed and duplex advertised by autonegotiation. The argument is
    a hexadecimal value using one or a combination of the following values:

      0x001     10 Half
      0x002     10 Full
      0x004     100 Half
      0x008     100 Full
      0x010     1000 Half        (not supported by IEEE standards)
      0x020     1000 Full
      0x8000    2500 Full        (not supported by IEEE standards)
      0x1000    10000 Full
      0x20000   20000MLD2 Full   (not supported by IEEE standards)
      0x40000   20000KR2 Full    (not supported by IEEE standards)

Bruno

#4 lore raw
In reply to Pavel Machek

2015-02-06 5:57 GMT-08:00 Pavel Machek <[email protected]>:

Quoted 16 lines · Florian Fainelli
Quoted 15 lines · Pavel Machek
Quoted 10 lines

Hi!

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Is there way to do that without hacking the kernel? Should mii-tool do that?

Since you use the PHY library, you should be able to do something like this in your PHY driver prior to starting the PHY state machine:

Quoted 7 lines
Quoted 2 lines

phydev->supported &= PHY_BASIC_FEATURES (effectively masking Gigabit capability)

Thanks, that did the trick.
Pavel
(But still it would be nice to have a generic way of doing this, using something like mii-tool.)

You can also force that by setting the "max-speed" property in the Ethernet PHY node, the PHY library will populate the supported bitmask accordingly and remove speeds which are not supposed to be supported.

I have to admit it has been a while since I used mii-tool, so the ioctl() side on the PHY library might be off.
--
Florian

#5 lore raw
In reply to Pavel Machek
Quoted 8 lines · Pavel Machek

This happened on more than one project: there's gigabit-capable chip, but the connector is not designed for gigabit speed.

I'd like to have speed autonegotiation, but not offer gigabit (as it will not work).

Is there way to do that without hacking the kernel? Should mii-tool do that?

It used to work for me with a 3Com 3c905C adapter when I needed to force
full duplex for an old non-negotiating 100baseTx-FD network switch.

Quoted 6 lines
root@ib8315:~# mii-tool.net-tools  -A 100baseTx,10baseT eth1
restarting autonegotiation...
root@ib8315:~# [32432.443883] libphy: mdio@e0024520:01 - Link is Down
root@ib8315:~# [32435.447863] libphy: mdio@e0024520:01 - Link is Up - 1000/Full
Quoted 16 lines
root@ib8315:~# mii-tool.net-tools -v eth1
eth1: negotiated 1000baseT-FD flow-control, link ok
product info: vendor 00:01:c1, model 3 rev 1
basic mode:   autonegotiation enabled
 basic status: autonegotiation complete, link ok
 capabilities: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 advertising:  1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD
 link partner: 1000baseT-FD 100baseTx-FD 100baseTx-HD
 10baseT-FD 10baseT-HD flow-control
 root@ib8315:~# mii-tool.net-tools -V
 $Id: mii-tool.c,v 1.9 2006/09/27 20:59:18 ecki Exp $
 (Author: David Hinds based on Donald Becker's mii-diag)
 net-tools 1.60
 root@ib8315:~#

You may have to spell out media names in full, e.g.:

# mii-tool -A 100baseTx-FD,100baseTx-HD,10baseT-FD,10baseT-HD eth1

Also the driver may have a way to override the capabilities advertised via a module parameter. This is what I eventually ended up with with the 3c905C adapter.

Maciej