Re: NDD-a-like

From: Simon Stewart (sms@lateral.net)
Date: Tue Jan 22 2002 - 09:25:06 EST


On Tue, Jan 22, 2002 at 08:56:59AM -0500, Jeff Garzik wrote:
> Simon Stewart wrote:
> >
> > On Tue, Jan 22, 2002 at 01:56:41PM +0100, Andi Kleen wrote:
> > > On Mon, Jan 21, 2002 at 05:56:25PM +0000, Simon Stewart wrote:

<snip "how to determine link status, speed, etc. of nics">

> > > > In addition, it would be handy to be able to force some of these
> > > > settings (such as connection speed) should I need to. There are tools
> > > > such as mii-diag out there, but these appear to be specific to each
> > > > net device driver, and are therefore wholly unsuitable for automated
> > > > testing (such as by a generic script run from a cron-job)
> > >
> > > mii-tool can do all that for most drivers (but not all because they need to
> > > support some special ioctls) It should be included in newer distributions.
> >
> > I stand corrected. mii-diag does do what I need. Thanks! It looks like
> > there's not much call for a procfs based alternative, is there? Might
> > still be a nice starter project to get into kernel hacking, though....
>
> Actually, "ethtool" is the desired tool for this job.
> http://sf.net/projects/gkernel/
>
> mii-diag only works for a subset of ethernet hardware, the hardware that
> supports MII interface properly. Further, the SIOCxMIIxxx interface
> does not support all the NIC diagnostic and tuning one would like to
> do. That's why ethtool interface was created.
>
> Now, with that said, it should be noted that like mii-diag, not all
> drivers yet support this interface.

Just downloaded and run ethtool, and it's a lot less functional than
mii-diag, at least for my eepro100:

sms@lauren:~/src/ethtool-1.4$ sudo ./ethtool eth0
Settings for eth0:
No data available

sms@lauren:~/src/ethtool-1.4$ sudo ./ethtool -i eth0
driver: eepro100
version: eepro100.c:v1.09j-t 9/29/99 Don
firmware-version:
bus-info: 00:0f.0

sms@lauren:~/src/ethtool-1.4$ sudo mii-diag
Using the default interface 'eth0'.
Basic registers of MII PHY #1: 3000 782d 02a8 0150 05e1 40a1 0001 ffff.
 The autonegotiated capability is 00a0.
The autonegotiated media type is 100baseTx.
 Basic mode control register 0x3000: Auto-negotiation enabled.
 You have link beat, and everything is working OK.
 Your link partner advertised 40a1: 100baseTx 10baseT.
   End of basic transceiver informaion.

mii-diag provides a lot more diagnostic information, which is what I
really want, unless I'm missing something _really_ obvious. So, in
order to get the information that I want from the system, I need to
run the (not necessaryily supported) mii-diag to determine its current
state, and then the (not necessarily supported) ethtool to set various
parameters?

It would be a lot simpler to do something like this to see which
features of the card are supported:

$ ls /proc/net/devices/eth0
speed_10 speed_100 speed_auto link_status
full_duplex half_duplex media_type

And then to see what's being used atm:

$ cat /proc/net/devices/eth0/speed_*
0
1
0

Then, in order to set an attribute, something like:

$ echo 1 > /proc/net/devices/eth0/speed_10
$ cat /proc/net/devices/eth0/speed_*
1
0
0

Okay, so the proposed interface isn't consistant, but you get the
basic idea? Assuming that I get some free time over the next couple of
days, I might attempt to put together a simple module that does some
of this (if only read-only) Would I just be wasting my time, or do any
of you think that this is a handy thing to have in the kernel?

Cheers,

Simon

-- 
Basically, a tool is an object that enables you to take advantage of the
laws of physics and mechanics in such a way that you can seriously injure
yourself.  - Dave Barry, "The Taming of the Screw"
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:01:14 EST