RE: Programmatically get ethernet interface speed?

From: Hen, Shmulik (shmulik.hen@intel.com)
Date: Sun Jul 15 2001 - 06:27:03 EST


I may have misunderstood the API by figuring that a link speed 0 means no
connection, but this is based on the acenic code (it is a bit logical too,
isn't it ? no link - no speed). However, I'm pretty sure that the acenic IS
broken in that aspect since the value of the register that holds the link
status and link speeds bits, and which is used to determine what values to
fill in the EthTool fields, does not reflect the correct status when
connecting/disconnecting the link and moving between different port types
(the debug prints I added were in the driver's code, not in the EthTool
application, and they showed an almost fixed value). The changes I made
seemed to improve the situation, but only a little. What I was looking for
is someone who witnessed the described behavior and may have found a
solution (that's why I posted to the acenic list first).

We did consider using the IFF_RUNNING interface once, but it turned out not
many drivers actually contain the netif_carrier_{on,off} calls or selected
to update the status correctly. The EthTool and MII_Diag interfaces looked
much more general and widely supported so we figured they will serve us
better (link speed and duplex mode are also important for us).

Is there a plan to add EthTool i/f support to drivers who already support
the MII helpers ?
Is there a way to combine the two interfaces into one general i/f ?

        Thanks,
        Shmulik Hen.

-----Original Message-----
From: Jeff Garzik [mailto:jgarzik@mandrakesoft.com]
Sent: Thursday, July 12, 2001 6:37 PM
To: Hen, Shmulik
Cc: linux-net@vger.kernel.org; Andrew Morton; David S. Miller;
jes@trained-monkey.org
Subject: Re: Programmatically get ethernet interface speed?

"Hen, Shmulik" wrote:
>
> 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.

That is not expected.

The ethtool interfaces shows the phy media settings. We can certainly
add a ethtool "is carrier present?" ioctl, but it is not in the current
interface.

Currently, check the interface flags. netif_carrier_{on,off} will make
IFF_RUNNING disappear and re-appear.

In 2.5 and maybe later 2.4 too, netif_carrier_{on,off} will send a
netlink message indicating a carrier status change.

> 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 ;-).

Given the above and the message you quoted below, it sounds like you are
misunderstanding the API, not that acenic is broken.

        Jeff

-- 
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



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