RE: Programmatically get ethernet interface speed?

From: Hen, Shmulik (shmulik.hen@intel.com)
Date: Thu Jul 12 2001 - 09:32:31 EST


Has anyone tested this interface with the below mentioned adapters ?

I've had a bad experience with an AceNIC Gigabit copper. For some reason,
when disconnecting the cable from a 1000Mbps switch, the speed does not drop
to 0 as expected. I tried modifying the driver's code and adding debug
prints and it looks like the adapter isn't reporting speeds correctly. I
tried posting to linux-acenic@sunsite.dk but got no help there. Below is my
original mail about the problem, please look at it and let me know if
something can be done to correct the situation. (I really need a working
EthTool interface working over an AceNIC ;-).

        Thanks in advance,
        Shmulik Hen
      Software Engineer
        Linux Advanced Networking Services
        Intel Network Communications Group
        Jerusalem, Israel

> Hello,
>
> * I have an AceNIC Giga adapter that is identified by lspci as:
> "Alteon Networks Inc. AceNIC Gigabit Ethernet (Copper) (rev01)"
> (vendor=0x12ae, device=0x0002, subsystem=0x12ae0002).
> * I'm using the acenic.c driver version 0.80 from kernel 2.4.5
> * I'm using EthTool version 1.2
>
> I'm having problems getting correct information about link status and
speed.
> When it is connected to a 1000Mbps port on a Gigabit switch I get the
> correct speed, but if I disconnect the cable the adapter keeps telling me
> its still in 1000Mbps (a debug print like "eth0: Optical Link Down"
appears
> but the speed remains). Looking at the code I could see that ace_ioctl()
> does the following:
>
> [snip]
> link = readl(&regs->GigLnkState);
> if (link & LNK_1000MB)
> ecmd.speed = SPEED_1000;
> else {
> link = readl(&regs->FastLnkState);
> if (link & LNK_100MB)
> ecmd.speed = SPEED_100;
> else if (link & LNK_10MB)
> ecmd.speed = SPEED_10;
> else
> ecmd.speed = 0;
> }
> [snip]
>
> By adding debug prints I could see that GigLnkState always has the
LNK_1000
> bit set and the only thing that changes with connections/disconnections
is
> the LNK_UP bit (from 0xe0ac0000 to 0x60ac0000). I tried modifying the
code
> to do:
>
> link = readl(&regs->GigLnkState);
> if (link & LNK_UP) {
> if (link & LNK_1000MB)
> ecmd.speed = SPEED_1000;
> }
> else {
> link2 = readl(&regs->FastLnkState);
> if (link2 & LNK_100MB)
> ecmd.speed = SPEED_100;
> else if (link2 & LNK_10MB)
> ecmd.speed = SPEED_10;
> else
> ecmd.speed = 0;
> }
>
> So now the driver can correctly report transitions from 1000Mbps to
100Mbps
> and back but it still cannot detect a disconnection
> (speed=0) or connection to a 10BaseT hub (speed=10) because FastLnkState
> always stays the same (0xe0aa0000). The driver's original debug prints
are
> always correct.
>
> Has anyone tested this hardware and verified the EthTool interface is
> working properly ?
> Can this adapter work at all with non autonegotiating ports on
switches/hubs ?
> Could this just be a faulty adapter ?
> Is there a way to add the MII diag interface to this driver ?
> Any ideas what I might have to do to get the correct info ?
>
> Thanks in advance,
> Shmulik.

-----Original Message-----
From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com]
Sent: Thursday, July 12, 2001 4:52 AM
To: David S. Miller
Cc: Andrew Morton; Will; linux-net@vger.kernel.org
Subject: Re: Programmatically get ethernet interface speed?

"David S. Miller" wrote:
>
> Andrew Morton writes:
> > Seems that only sunhme and acenic implement this at present.
>
> Add ioc3-eth and starfire to that list.
>
> ? egrep ETHTOOL_GSET drivers/net/*.c
> drivers/net/acenic.c: if (ecmd.cmd == ETHTOOL_GSET) {
> drivers/net/ioc3-eth.c: if (ecmd.cmd == ETHTOOL_GSET) {
> drivers/net/starfire.c: case ETHTOOL_GSET:
> drivers/net/sunhme.c: if (ecmd.cmd == ETHTOOL_GSET) {
> ?

And the code I posted a month ago or so adds the capability to many net
drivers at once.

-- 
Jeff Garzik      | A recent study has shown that too much soup
Building 1024    | can cause malaise in laboratory mice.
MandrakeSoft     |
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org



This archive was generated by hypermail 2b29 : Sun Jul 15 2001 - 21:00:25 EST