netdev
[Top] [All Lists]

ethtool interface

To: netdev@xxxxxxxxxxx
Subject: ethtool interface
From: Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
Date: Sun, 1 Apr 2001 17:28:39 -0500 (CDT)
Sender: owner-netdev@xxxxxxxxxxx
(this is just an "FYI" type message, to make sure people are all on the
same page)

Here is the current ethtool interface, as found in 2.4.3 release kernel
include/linux/ethtool.h.

DaveM has kindly allowed me to take his original ethtool work and start
maintaining and improving it.  As soon as I add support in ethtool for
using the existing net driver MII ioctls, I will be posting tarballs on
http://sourceforge.net/projects/gkernel/   (or maybe a new 'ethtool'
project)

Note that it is my intention to eventually replace mii-tool with ethtool
(mii-tool becomes a wrapper calling ethtool, for back compatibility).  I
also want ethtool to work on 2.2 kernels which don't have the ethtool
interface, which is another reason why supporting the existing, working
MII ioctls is important to me.

Further down the road, I was thinking it would be nice to have
driver-specific ioctl support in ethtool.  That is a vast convenience
for the user, who needs only one tool to tune any NIC.  For the
Becker-derived drivers this is not immediately useful.  For other
drivers (acenic, depca, others) with non-MII-related ioctls, this
seems like a useful feature.  If there are driver-specific tuning items
we want to add in the future, this makes it easy to exploit those new
items in userland.


/*
 * ethtool.h: Defines for Linux ethtool.
 *
 * Copyright (C) 1998 David S. Miller (davem@xxxxxxxxxx)
 * Copyright 2001 Jeff Garzik <jgarzik@xxxxxxxxxxxxxxxx>
 */

#ifndef _LINUX_ETHTOOL_H
#define _LINUX_ETHTOOL_H


/* This should work for both 32 and 64 bit userland. */
struct ethtool_cmd {
        u32     cmd;
        u32     supported;      /* Features this interface supports */
        u32     advertising;    /* Features this interface advertises */
        u16     speed;          /* The forced speed, 10Mb, 100Mb, gigabit */
        u8      duplex;         /* Duplex, half or full */
        u8      port;           /* Which connector port */
        u8      phy_address;
        u8      transceiver;    /* Which tranceiver to use */
        u8      autoneg;        /* Enable or disable autonegotiation */
        u32     maxtxpkt;       /* Tx pkts before generating tx int */
        u32     maxrxpkt;       /* Rx pkts before generating rx int */
        u32     reserved[4];
};

/* these strings are set to whatever the driver author decides... */
struct ethtool_drvinfo {
        u32     cmd;
        char    driver[32];     /* driver short name, "tulip", "eepro100" */
        char    version[32];    /* driver version string */
        char    fw_version[32]; /* firmware version string, if applicable */
        char    bus_info[32];   /* Bus info for this interface.  For PCI
                                 * devices, use pci_dev->slot_name. */
        char    reserved1[32];
        char    reserved2[32];
};

/* CMDs currently supported */
#define ETHTOOL_GSET            0x00000001 /* Get settings. */
#define ETHTOOL_SSET            0x00000002 /* Set settings, privileged. */
#define ETHTOOL_GDRVINFO        0x00000003 /* Get driver info. */

/* compatibility with older code */
#define SPARC_ETH_GSET          ETHTOOL_GSET
#define SPARC_ETH_SSET          ETHTOOL_SSET

/* Indicates what features are supported by the interface. */
#define SUPPORTED_10baseT_Half          (1 << 0)
#define SUPPORTED_10baseT_Full          (1 << 1)
#define SUPPORTED_100baseT_Half         (1 << 2)
#define SUPPORTED_100baseT_Full         (1 << 3)
#define SUPPORTED_1000baseT_Half        (1 << 4)
#define SUPPORTED_1000baseT_Full        (1 << 5)
#define SUPPORTED_Autoneg               (1 << 6)
#define SUPPORTED_TP                    (1 << 7)
#define SUPPORTED_AUI                   (1 << 8)
#define SUPPORTED_MII                   (1 << 9)
#define SUPPORTED_FIBRE                 (1 << 10)

/* Indicates what features are advertised by the interface. */
#define ADVERTISED_10baseT_Half         (1 << 0)
#define ADVERTISED_10baseT_Full         (1 << 1)
#define ADVERTISED_100baseT_Half        (1 << 2)
#define ADVERTISED_100baseT_Full        (1 << 3)
#define ADVERTISED_1000baseT_Half       (1 << 4)
#define ADVERTISED_1000baseT_Full       (1 << 5)
#define ADVERTISED_Autoneg              (1 << 6)
#define ADVERTISED_TP                   (1 << 7)
#define ADVERTISED_AUI                  (1 << 8)
#define ADVERTISED_MII                  (1 << 9)
#define ADVERTISED_FIBRE                (1 << 10)

/* The following are all involved in forcing a particular link
 * mode for the device for setting things.  When getting the
 * devices settings, these indicate the current mode and whether
 * it was foced up into this mode or autonegotiated.
 */

/* The forced speed, 10Mb, 100Mb, gigabit. */
#define SPEED_10                10
#define SPEED_100               100
#define SPEED_1000              1000

/* Duplex, half or full. */
#define DUPLEX_HALF             0x00
#define DUPLEX_FULL             0x01

/* Which connector port. */
#define PORT_TP                 0x00
#define PORT_AUI                0x01
#define PORT_MII                0x02
#define PORT_FIBRE              0x03
#define PORT_BNC                0x04

/* Which tranceiver to use. */
#define XCVR_INTERNAL           0x00
#define XCVR_EXTERNAL           0x01
#define XCVR_DUMMY1             0x02
#define XCVR_DUMMY2             0x03
#define XCVR_DUMMY3             0x04

/* Enable or disable autonegotiation.  If this is set to enable,
 * the forced link modes above are completely ignored.
 */
#define AUTONEG_DISABLE         0x00
#define AUTONEG_ENABLE          0x01

#endif /* _LINUX_ETHTOOL_H */

<Prev in Thread] Current Thread [Next in Thread>
  • ethtool interface, Jeff Garzik <=