Commit e085c123 authored by Aristeu Sergio Rozanski Filho's avatar Aristeu Sergio Rozanski Filho Committed by Jeff Garzik

[PATCH] eepro: basic ethtool support

eepro: basic ethtool support
Signed-off-by: default avatarAristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 7d09f0f7
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
This is a compatibility hardware problem. This is a compatibility hardware problem.
Versions: Versions:
0.13b basic ethtool support (aris, 09/13/2004)
0.13a in memory shortage, drop packets also in board 0.13a in memory shortage, drop packets also in board
(Michael Westermann <mw@microdata-pos.de>, 07/30/2002) (Michael Westermann <mw@microdata-pos.de>, 07/30/2002)
0.13 irq sharing, rewrote probe function, fixed a nasty bug in 0.13 irq sharing, rewrote probe function, fixed a nasty bug in
...@@ -104,7 +105,7 @@ ...@@ -104,7 +105,7 @@
*/ */
static const char version[] = static const char version[] =
"eepro.c: v0.13 11/08/2001 aris@cathedrallabs.org\n"; "eepro.c: v0.13b 09/13/2004 aris@cathedrallabs.org\n";
#include <linux/module.h> #include <linux/module.h>
...@@ -146,19 +147,21 @@ static const char version[] = ...@@ -146,19 +147,21 @@ static const char version[] =
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/ethtool.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/dma.h> #include <asm/dma.h>
#define DRV_NAME "eepro" #define DRV_NAME "eepro"
#define DRV_VERSION "0.13b"
#define compat_dev_kfree_skb( skb, mode ) dev_kfree_skb( (skb) ) #define compat_dev_kfree_skb( skb, mode ) dev_kfree_skb( (skb) )
/* I had reports of looong delays with SLOW_DOWN defined as udelay(2) */ /* I had reports of looong delays with SLOW_DOWN defined as udelay(2) */
#define SLOW_DOWN inb(0x80) #define SLOW_DOWN inb(0x80)
/* udelay(2) */ /* udelay(2) */
#define compat_init_data __initdata #define compat_init_data __initdata
enum iftype { AUI=0, BNC=1, TPE=2 };
/* First, a few definitions that the brave might change. */ /* First, a few definitions that the brave might change. */
/* A zero-terminated list of I/O addresses to be probed. */ /* A zero-terminated list of I/O addresses to be probed. */
...@@ -743,16 +746,17 @@ static void __init eepro_print_info (struct net_device *dev) ...@@ -743,16 +746,17 @@ static void __init eepro_print_info (struct net_device *dev)
printEEPROMInfo(dev); printEEPROMInfo(dev);
} }
static struct ethtool_ops eepro_ethtool_ops;
/* This is the real probe routine. Linux has a history of friendly device /* This is the real probe routine. Linux has a history of friendly device
probes on the ISA bus. A good device probe avoids doing writes, and probes on the ISA bus. A good device probe avoids doing writes, and
verifies that the correct device exists and functions. */ verifies that the correct device exists and functions. */
static int __init eepro_probe1(struct net_device *dev, int autoprobe) static int __init eepro_probe1(struct net_device *dev, int autoprobe)
{ {
unsigned short station_addr[6], id, counter; unsigned short station_addr[3], id, counter;
int i; int i;
struct eepro_local *lp; struct eepro_local *lp;
enum iftype { AUI=0, BNC=1, TPE=2 };
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
/* Grab the region so we can find another board if autoIRQ fails. */ /* Grab the region so we can find another board if autoIRQ fails. */
...@@ -862,6 +866,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe) ...@@ -862,6 +866,7 @@ static int __init eepro_probe1(struct net_device *dev, int autoprobe)
dev->set_multicast_list = &set_multicast_list; dev->set_multicast_list = &set_multicast_list;
dev->tx_timeout = eepro_tx_timeout; dev->tx_timeout = eepro_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT; dev->watchdog_timeo = TX_TIMEOUT;
dev->ethtool_ops = &eepro_ethtool_ops;
/* print boot time info */ /* print boot time info */
eepro_print_info(dev); eepro_print_info(dev);
...@@ -1082,8 +1087,6 @@ static int eepro_open(struct net_device *dev) ...@@ -1082,8 +1087,6 @@ static int eepro_open(struct net_device *dev)
old9 = inb(ioaddr + 9); old9 = inb(ioaddr + 9);
if (irqMask==ee_FX_INT2IRQ) { if (irqMask==ee_FX_INT2IRQ) {
enum iftype { AUI=0, BNC=1, TPE=2 };
if (net_debug > 3) { if (net_debug > 3) {
printk(KERN_DEBUG "IrqMask: %#x\n",irqMask); printk(KERN_DEBUG "IrqMask: %#x\n",irqMask);
printk(KERN_DEBUG "i82595FX detected!\n"); printk(KERN_DEBUG "i82595FX detected!\n");
...@@ -1713,6 +1716,64 @@ eepro_transmit_interrupt(struct net_device *dev) ...@@ -1713,6 +1716,64 @@ eepro_transmit_interrupt(struct net_device *dev)
} }
} }
static int eepro_ethtool_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd)
{
struct eepro_local *lp = (struct eepro_local *)dev->priv;
cmd->supported = SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full |
SUPPORTED_Autoneg;
cmd->advertising = ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full |
ADVERTISED_Autoneg;
if (GetBit(lp->word[5], ee_PortTPE)) {
cmd->supported |= SUPPORTED_TP;
cmd->advertising |= ADVERTISED_TP;
}
if (GetBit(lp->word[5], ee_PortBNC)) {
cmd->supported |= SUPPORTED_BNC;
cmd->advertising |= ADVERTISED_BNC;
}
if (GetBit(lp->word[5], ee_PortAUI)) {
cmd->supported |= SUPPORTED_AUI;
cmd->advertising |= ADVERTISED_AUI;
}
cmd->speed = SPEED_10;
if (dev->if_port == TPE && lp->word[1] & ee_Duplex) {
cmd->duplex = DUPLEX_FULL;
}
else {
cmd->duplex = DUPLEX_HALF;
}
cmd->port = dev->if_port;
cmd->phy_address = dev->base_addr;
cmd->transceiver = XCVR_INTERNAL;
if (lp->word[0] & ee_AutoNeg) {
cmd->autoneg = 1;
}
return 0;
}
static void eepro_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{
strcpy(drvinfo->driver, DRV_NAME);
strcpy(drvinfo->version, DRV_VERSION);
sprintf(drvinfo->bus_info, "ISA 0x%lx", dev->base_addr);
}
static struct ethtool_ops eepro_ethtool_ops = {
.get_settings = eepro_ethtool_get_settings,
.get_drvinfo = eepro_ethtool_get_drvinfo,
};
#ifdef MODULE #ifdef MODULE
#define MAX_EEPRO 8 #define MAX_EEPRO 8
...@@ -1728,7 +1789,7 @@ static int autodetect; ...@@ -1728,7 +1789,7 @@ static int autodetect;
static int n_eepro; static int n_eepro;
/* For linux 2.1.xx */ /* For linux 2.1.xx */
MODULE_AUTHOR("Pascal Dupuis, and aris@cathedrallabs.org"); MODULE_AUTHOR("Pascal Dupuis and others");
MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver"); MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
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