Commit 39b7aeb5 authored by Phil Blundell's avatar Phil Blundell

Add mii-tool from David Hinds.

parent 755caa7c
......@@ -82,6 +82,9 @@ PROGS := ifconfig hostname arp netstat route rarp slattach plipconfig
ifeq ($(HAVE_IP_TOOLS),1)
PROGS += iptunnel ipmaddr
endif
ifeq ($(HAVE_MII),1)
PROGS += mii-tool
endif
# Compiler and Linker Options
# You may need to uncomment and edit these if you are using libc5 and IPv6.
......@@ -211,6 +214,9 @@ iptunnel: $(NET-LIB) iptunnel.o
ipmaddr: $(NET-LIB) ipmaddr.o
$(CC) $(LDFLAGS) -o ipmaddr ipmaddr.o $(NLIB) $(RESLIB)
mii-tool: mii-tool.o
$(CC) $(LDFLAGS) -o mii-tool mii-tool.o
installbin:
install -m 0755 -d ${BASEDIR}/sbin
install -m 0755 -d ${BASEDIR}/bin
......@@ -225,6 +231,9 @@ installbin:
ifeq ($(HAVE_IP_TOOLS),1)
install -m 0755 ipmaddr $(BASEDIR)/sbin
install -m 0755 iptunnel $(BASEDIR)/sbin
endif
ifeq ($(HAVE_MII),1)
install -m 0755 mii-tool $(BASEDIR)/sbin
endif
ln -fs hostname $(BASEDIR)/bin/dnsdomainname
ln -fs hostname $(BASEDIR)/bin/ypdomainname
......
......@@ -88,3 +88,4 @@ bool 'Econet hardware support' HAVE_HWEC n
*
bool 'IP Masquerading support' HAVE_FW_MASQUERADE n
bool 'Build iptunnel and ipmaddr' HAVE_IP_TOOLS n
bool 'Build mii-tool' HAVE_MII n
/*
* mii.h 1.4 2000/04/25 22:06:15
*
* Media Independent Interface support: register layout and ioctl's
*
* Copyright (C) 2000 David A. Hinds -- dhinds@pcmcia.sourceforge.org
*/
#ifndef _LINUX_MII_H
#define _LINUX_MII_H
/* network interface ioctl's for MII commands */
#ifndef SIOCGMIIPHY
#define SIOCGMIIPHY (SIOCDEVPRIVATE) /* Read from current PHY */
#define SIOCGMIIREG (SIOCDEVPRIVATE+1) /* Read any PHY register */
#define SIOCSMIIREG (SIOCDEVPRIVATE+2) /* Write any PHY register */
#define SIOCGPARAMS (SIOCDEVPRIVATE+3) /* Read operational parameters */
#define SIOCSPARAMS (SIOCDEVPRIVATE+4) /* Set operational parameters */
#endif
#include <linux/types.h>
/* This data structure is used for all the MII ioctl's */
struct mii_data {
__u16 phy_id;
__u16 reg_num;
__u16 val_in;
__u16 val_out;
};
/* Basic Mode Control Register */
#define MII_BMCR 0x00
#define MII_BMCR_RESET 0x8000
#define MII_BMCR_LOOPBACK 0x4000
#define MII_BMCR_100MBIT 0x2000
#define MII_BMCR_AN_ENA 0x1000
#define MII_BMCR_ISOLATE 0x0400
#define MII_BMCR_RESTART 0x0200
#define MII_BMCR_DUPLEX 0x0100
#define MII_BMCR_COLTEST 0x0080
/* Basic Mode Status Register */
#define MII_BMSR 0x01
#define MII_BMSR_CAP_MASK 0xf800
#define MII_BMSR_100BASET4 0x8000
#define MII_BMSR_100BASETX_FD 0x4000
#define MII_BMSR_100BASETX_HD 0x2000
#define MII_BMSR_10BASET_FD 0x1000
#define MII_BMSR_10BASET_HD 0x0800
#define MII_BMSR_NO_PREAMBLE 0x0040
#define MII_BMSR_AN_COMPLETE 0x0020
#define MII_BMSR_REMOTE_FAULT 0x0010
#define MII_BMSR_AN_ABLE 0x0008
#define MII_BMSR_LINK_VALID 0x0004
#define MII_BMSR_JABBER 0x0002
#define MII_BMSR_EXT_CAP 0x0001
#define MII_PHY_ID1 0x02
#define MII_PHY_ID2 0x03
/* Auto-Negotiation Advertisement Register */
#define MII_ANAR 0x04
/* Auto-Negotiation Link Partner Ability Register */
#define MII_ANLPAR 0x05
#define MII_AN_NEXT_PAGE 0x8000
#define MII_AN_ACK 0x4000
#define MII_AN_REMOTE_FAULT 0x2000
#define MII_AN_ABILITY_MASK 0x07e0
#define MII_AN_FLOW_CONTROL 0x0400
#define MII_AN_100BASET4 0x0200
#define MII_AN_100BASETX_FD 0x0100
#define MII_AN_100BASETX_HD 0x0080
#define MII_AN_10BASET_FD 0x0040
#define MII_AN_10BASET_HD 0x0020
#define MII_AN_PROT_MASK 0x001f
#define MII_AN_PROT_802_3 0x0001
/* Auto-Negotiation Expansion Register */
#define MII_ANER 0x06
#define MII_ANER_MULT_FAULT 0x0010
#define MII_ANER_LP_NP_ABLE 0x0008
#define MII_ANER_NP_ABLE 0x0004
#define MII_ANER_PAGE_RX 0x0002
#define MII_ANER_LP_AN_ABLE 0x0001
#endif /* _LINUX_MII_H */
.\" Copyright (C) 2000 David A. Hinds -- dhinds@pcmcia.sourceforge.org
.\" mii-tool.8 1.5 2000/04/25 22:58:19
.\"
.TH MII-TOOL 8 "2000/04/25 22:58:19" "net-tools"
.SH NAME
mii-tool \- view, manipulate media-independent interface status
.SH SYNOPSIS
.B mii-tool
[\fB\-v\fR, \fB\-\-verbose\fR]
[\fB\-V\fR, \fB\-\-version\fR]
[\fB\-R\fR, \fB\-\-reset\fR]
[\fB\-r\fR, \fB\-\-restart\fR]
[\fB\-w\fR, \fB\-\-watch\fR]
[\fB\-l\fR, \fB\-\-log\fR]
[\fB\-A\fR, \fB\-\-advertise=\fImedia,...\fR]
[\fB\-F\fR, \fB\-\-force=\fImedia\fR]
.RI [ "interface\ ..." ]
.SH DESCRIPTION
This utility checks or sets the status of a network interface's Media
Independent Interface (MII) unit. Most fast ethernet adapters use an
MII to autonegotiate link speed and duplex setting.
.PP
Most intelligent network devices use an autonegotiation protocol to
communicate what media technologies they support, and then select the
fastest mutually supported media technology. The \fB\-A\fR or
\fB\-\-advertise\fR options can be used to tell the MII to only
advertise a subset of its capabilities. Some passive devices, such as
single-speed hubs, are unable to autonegotiate. To handle such
devices, the MII protocol also allows for establishing a link by
simply detecting either a 10baseT or 100baseT link beat. The \fB\-F\fR
or \fB\-\-force\fR options can be used to force the MII to operate in
one mode, instead of autonegotiating. The \fB\-A\fR and \fB-F\fR
options are mutually exclusive.
.PP
The default short output reports the negotiated link speed and link
status for each interface. If an interface or interfaces are not
specified on the command line, then \fBmii-tool\fR will check any
available interfaces from \fBeth0\fR through \fBeth7\fR.
.SH OPTIONS
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Display more detailed MII status information. If used twice, also
display raw MII register contents.
.TP
\fB\-V\fR, \fB\-\-version\fR
Display program version information.
.TP
\fB\-R\fR, \fB\-\-reset\fR
Reset the MII to its default configuration.
.TP
\fB\-r\fR, \fB\-\-restart\fR
Restart autonegotiation.
.TP
\fB\-w\fR, \fB\-\-watch\fR
Watch interface(s) and report changes in link status. The MII
interfaces are polled at one second intervals.
.TP
\fB\-l\fR, \fB\-\-log\fR
Used with \fB-w\fR, records link status changes in the system log
instead of printing on standard output.
.TP
\fB\-F\fI media\fR, \fB\-\-force=\fImedia\fR
Disable autonegotiation, and force the MII to either \fB100baseTx-FD\fR,
\fB100baseTx-HD\fR, \fB10baseT-FD\fR, or \fB10baseT-HD\fR operation.
.TP
\fB\-A\fI media,...\fR, \fB\-\-advertise=\fImedia,...\fR
Enable and restart autonegotiation, and advertise only the specified
media technologies. Multiple technologies should be separated by
commas. Valid media are \fB100baseT4\fR, \fB100baseTx-FD\fR,
\fB100baseTx-HD\fR, \fB10baseT-FD\fR, and \fB10baseT-HD\fR.
.SH AUTHORS
David Hinds \- dhinds@pcmcia.sourceforge.org
.br
Donald Becker \- becker@scyld.com
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment