Commit a1360dde authored by Ganesh Venkatesan's avatar Ganesh Venkatesan Committed by Jeff Garzik

[PATCH] e1000 7/7: Support for ethtool msglevel based error

Also included are driver version update and change logs
parent 7190c16a
......@@ -71,6 +71,7 @@
#include <linux/mii.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/moduleparam.h>
#define BAR_0 0
#define BAR_1 1
......@@ -89,6 +90,12 @@ struct e1000_adapter;
#define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
#define PFX "e1000: "
#define DPRINTK(nlevel, klevel, fmt, args...) \
(void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
__FUNCTION__ , ## args))
#define E1000_MAX_INTR 10
/* How many descriptors for TX and RX ? */
......
......@@ -27,55 +27,32 @@
*******************************************************************************/
#include "e1000.h"
#include <linux/rtnetlink.h>
/* Change Log
*
* 5.2.51 5/14/04
* o set default configuration to 'NAPI disabled'. NAPI enabled driver
* causes kernel panic when the interface is shutdown while data is being
* transferred.
* 5.2.47 5/04/04
* o fixed ethtool -t implementation
* 5.2.45 4/29/04
* o fixed ethtool -e implementation
* o Support for ethtool ops [Stephen Hemminger (shemminger@osdl.org)]
* 5.2.42 4/26/04
* o Added support for the DPRINTK macro for enhanced error logging. Some
* parts of the patch were supplied by Jon Mason.
* o Move the register_netdevice() donw in the probe routine due to a
* loading/unloading test issue.
* o Added a long RX byte count the the extra ethtool data members for BER
* testing purposes.
* 5.2.39 3/12/04
* o Added support to read/write eeprom data in proper order.
* By default device eeprom is always little-endian, word
* addressable
* o Disable TSO as the default for the driver until hangs
* reported against non-IA acrhs can be root-caused.
* o Back out the CSA fix for 82547 as it continues to cause
* systems lock-ups with production systems.
* o Fixed FC high/low water mark values to actually be in the
* range of the Rx FIFO area. It was a math error.
* [Dainis Jonitis (dainis_jonitis@exigengroup.lv)]
* o Handle failure to get new resources when doing ethtool
* ring paramater changes. Previously, driver would free old,
* but fails to allocate new, causing problems. Now, driver
* allocates new, and if sucessful, frees old.
* o Changed collision threshold from 16 to 15 to comply with IEEE
* spec.
* o Toggle chip-select when checking ready status on SPI eeproms.
* o Put PHY into class A mode to pass IEEE tests on some designs.
* Designs with EEPROM word 0x7, bit 15 set will have their PHYs
* set to class A mode, rather than the default class AB.
* o Handle failures of register_netdev. Stephen Hemminger
* [shemminger@osdl.org].
* o updated README & MAN pages, number of Transmit/Receive
* descriptors may be denied depending on system resources.
*
* 5.2.30 1/14/03
* o Set VLAN filtering to IEEE 802.1Q after reset so we don't break
* SoL connections that use VLANs.
* o Allow 1000/Full setting for AutoNeg param for Fiber connections
* Jon D Mason [jonmason@us.ibm.com].
* o Race between Tx queue and Tx clean fixed with a spin lock.
* o Added netpoll support.
* o Fixed endianess bug causing ethtool loopback diags to fail on ppc.
* o Use pdev->irq rather than netdev->irq in preparation for MSI support.
* o Report driver message on user override of InterruptThrottleRate
* module parameter.
* o Change I/O address storage from uint32_t to unsigned long.
* o Added ethtool RINGPARAM support.
*
* 5.2.22 10/15/03
*/
char e1000_driver_name[] = "e1000";
char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
char e1000_driver_version[] = "5.2.39-k2";
char e1000_driver_version[] = "5.2.52-k2";
char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table
......@@ -225,6 +202,10 @@ MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver");
MODULE_LICENSE("GPL");
static int debug = 3;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
/**
* e1000_init_module - Driver Registration Routine
*
......@@ -420,6 +401,12 @@ e1000_probe(struct pci_dev *pdev,
adapter->netdev = netdev;
adapter->pdev = pdev;
adapter->hw.back = adapter;
adapter->msg_enable = (1 << debug) - 1;
rtnl_lock();
/* we need to set the name early since the DPRINTK macro needs it set */
if (dev_alloc_name(netdev, netdev->name) < 0)
goto err_free_unlock;
mmio_start = pci_resource_start(pdev, BAR_0);
mmio_len = pci_resource_len(pdev, BAR_0);
......@@ -504,7 +491,7 @@ e1000_probe(struct pci_dev *pdev,
/* make sure the EEPROM is good */
if(e1000_validate_eeprom_checksum(&adapter->hw) < 0) {
printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n");
DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
err = -EIO;
goto err_eeprom;
}
......@@ -538,16 +525,12 @@ e1000_probe(struct pci_dev *pdev,
INIT_WORK(&adapter->tx_timeout_task,
(void (*)(void *))e1000_tx_timeout_task, netdev);
if((err = register_netdev(netdev)))
goto err_register;
/* we're going to reset, so assume we have no link for now */
netif_carrier_off(netdev);
netif_stop_queue(netdev);
printk(KERN_INFO "%s: Intel(R) PRO/1000 Network Connection\n",
netdev->name);
DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
e1000_check_options(adapter);
/* Initial Wake on LAN setting
......@@ -581,7 +564,12 @@ e1000_probe(struct pci_dev *pdev,
e1000_reset(adapter);
/* since we are holding the rtnl lock already, call the no-lock version */
if((err = register_netdevice(netdev)))
goto err_register;
cards_found++;
rtnl_unlock();
return 0;
err_register:
......@@ -589,6 +577,8 @@ e1000_probe(struct pci_dev *pdev,
err_eeprom:
iounmap(adapter->hw.hw_addr);
err_ioremap:
err_free_unlock:
rtnl_unlock();
free_netdev(netdev);
err_alloc_etherdev:
pci_release_regions(pdev);
......@@ -666,7 +656,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
/* identify the MAC */
if (e1000_set_mac_type(hw)) {
E1000_ERR("Unknown MAC Type\n");
DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
return -EIO;
}
......@@ -1393,9 +1383,8 @@ e1000_watchdog(unsigned long data)
&adapter->link_speed,
&adapter->link_duplex);
printk(KERN_INFO
"e1000: %s NIC Link is Up %d Mbps %s\n",
netdev->name, adapter->link_speed,
DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s\n",
adapter->link_speed,
adapter->link_duplex == FULL_DUPLEX ?
"Full Duplex" : "Half Duplex");
......@@ -1408,9 +1397,7 @@ e1000_watchdog(unsigned long data)
if(netif_carrier_ok(netdev)) {
adapter->link_speed = 0;
adapter->link_duplex = 0;
printk(KERN_INFO
"e1000: %s NIC Link is Down\n",
netdev->name);
DPRINTK(LINK, INFO, "NIC Link is Down\n");
netif_carrier_off(netdev);
netif_stop_queue(netdev);
mod_timer(&adapter->phy_info_timer, jiffies + 2 * HZ);
......@@ -1888,7 +1875,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
(max_frame > MAX_JUMBO_FRAME_SIZE)) {
E1000_ERR("Invalid MTU setting\n");
DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
return -EINVAL;
}
......@@ -1896,7 +1883,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
adapter->rx_buffer_len = E1000_RXBUFFER_2048;
} else if(adapter->hw.mac_type < e1000_82543) {
E1000_ERR("Jumbo Frames not supported on 82542\n");
DPRINTK(PROBE, ERR, "Jumbo Frames not supported on 82542\n");
return -EINVAL;
} else if(max_frame <= E1000_RXBUFFER_4096) {
......@@ -2282,7 +2269,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
/* All receives must fit into a single buffer */
E1000_DBG("Receive packet consumed multiple buffers\n");
E1000_DBG("%s: Receive packet consumed multiple buffers\n",
netdev->name);
dev_kfree_skb_irq(skb);
rx_desc->status = 0;
......
......@@ -234,7 +234,8 @@ struct e1000_option {
};
static int __devinit
e1000_validate_option(int *value, struct e1000_option *opt)
e1000_validate_option(int *value, struct e1000_option *opt,
struct e1000_adapter *adapter)
{
if(*value == OPTION_UNSET) {
*value = opt->def;
......@@ -245,16 +246,17 @@ e1000_validate_option(int *value, struct e1000_option *opt)
case enable_option:
switch (*value) {
case OPTION_ENABLED:
printk(KERN_INFO "%s Enabled\n", opt->name);
DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
printk(KERN_INFO "%s Disabled\n", opt->name);
DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if(*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
printk(KERN_INFO "%s set to %i\n", opt->name, *value);
DPRINTK(PROBE, INFO,
"%s set to %i\n", opt->name, *value);
return 0;
}
break;
......@@ -266,7 +268,7 @@ e1000_validate_option(int *value, struct e1000_option *opt)
ent = &opt->arg.l.p[i];
if(*value == ent->i) {
if(ent->str[0] != '\0')
printk(KERN_INFO "%s\n", ent->str);
DPRINTK(PROBE, INFO, "%s\n", ent->str);
return 0;
}
}
......@@ -276,7 +278,7 @@ e1000_validate_option(int *value, struct e1000_option *opt)
BUG();
}
printk(KERN_INFO "Invalid %s specified (%i) %s\n",
DPRINTK(PROBE, INFO, "Invalid %s specified (%i) %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
......@@ -300,9 +302,9 @@ e1000_check_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if(bd >= E1000_MAX_NIC) {
printk(KERN_NOTICE
DPRINTK(PROBE, NOTICE,
"Warning: no configuration for board #%i\n", bd);
printk(KERN_NOTICE "Using defaults for all values\n");
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
bd = E1000_MAX_NIC;
}
......@@ -321,7 +323,7 @@ e1000_check_options(struct e1000_adapter *adapter)
E1000_MAX_TXD : E1000_MAX_82544_TXD;
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt);
e1000_validate_option(&tx_ring->count, &opt, adapter);
E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
}
{ /* Receive Descriptor Count */
......@@ -339,7 +341,7 @@ e1000_check_options(struct e1000_adapter *adapter)
E1000_MAX_82544_RXD;
rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt);
e1000_validate_option(&rx_ring->count, &opt, adapter);
E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
}
{ /* Checksum Offload Enable/Disable */
......@@ -351,7 +353,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
int rx_csum = XsumRX[bd];
e1000_validate_option(&rx_csum, &opt);
e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
}
{ /* Flow Control */
......@@ -373,7 +375,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
int fc = FlowControl[bd];
e1000_validate_option(&fc, &opt);
e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
}
{ /* Transmit Interrupt Delay */
......@@ -387,7 +389,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt);
e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);
}
{ /* Transmit Absolute Interrupt Delay */
struct e1000_option opt = {
......@@ -400,7 +402,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt);
e1000_validate_option(&adapter->tx_abs_int_delay, &opt, adapter);
}
{ /* Receive Interrupt Delay */
struct e1000_option opt = {
......@@ -413,7 +415,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt);
e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);
}
{ /* Receive Absolute Interrupt Delay */
struct e1000_option opt = {
......@@ -426,7 +428,7 @@ e1000_check_options(struct e1000_adapter *adapter)
};
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt);
e1000_validate_option(&adapter->rx_abs_int_delay, &opt, adapter);
}
{ /* Interrupt Throttling Rate */
struct e1000_option opt = {
......@@ -444,13 +446,14 @@ e1000_check_options(struct e1000_adapter *adapter)
adapter->itr = 1;
break;
case 0:
printk(KERN_INFO "%s turned off\n", opt.name);
DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
break;
case 1:
printk(KERN_INFO "%s set to dynamic mode\n", opt.name);
DPRINTK(PROBE, INFO,
"%s set to dynamic mode\n", opt.name);
break;
default:
e1000_validate_option(&adapter->itr, &opt);
e1000_validate_option(&adapter->itr, &opt, adapter);
break;
}
}
......@@ -482,15 +485,15 @@ e1000_check_fiber_options(struct e1000_adapter *adapter)
bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
if((Speed[bd] != OPTION_UNSET)) {
printk(KERN_INFO "Speed not valid for fiber adapters, "
DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
"parameter ignored\n");
}
if((Duplex[bd] != OPTION_UNSET)) {
printk(KERN_INFO "Duplex not valid for fiber adapters, "
DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
"parameter ignored\n");
}
if((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
printk(KERN_INFO "AutoNeg other than Full/1000 is "
DPRINTK(PROBE, INFO, "AutoNeg other than Full/1000 is "
"not valid for fiber adapters, parameter ignored\n");
}
}
......@@ -525,7 +528,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
};
speed = Speed[bd];
e1000_validate_option(&speed, &opt);
e1000_validate_option(&speed, &opt, adapter);
}
{ /* Duplex */
struct e1000_opt_list dplx_list[] = {{ 0, "" },
......@@ -542,11 +545,11 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
};
dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt);
e1000_validate_option(&dplx, &opt, adapter);
}
if(AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
printk(KERN_INFO
DPRINTK(PROBE, INFO,
"AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
......@@ -595,7 +598,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
};
int an = AutoNeg[bd];
e1000_validate_option(&an, &opt);
e1000_validate_option(&an, &opt, adapter);
adapter->hw.autoneg_advertised = an;
}
......@@ -603,78 +606,85 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if(Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
printk(KERN_INFO
DPRINTK(PROBE, INFO,
"Speed and duplex autonegotiation enabled\n");
break;
case HALF_DUPLEX:
printk(KERN_INFO "Half Duplex specified without Speed\n");
printk(KERN_INFO "Using Autonegotiation at Half Duplex only\n");
DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n");
DPRINTK(PROBE, INFO,
"Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
printk(KERN_INFO "Full Duplex specified without Speed\n");
printk(KERN_INFO "Using Autonegotiation at Full Duplex only\n");
DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n");
DPRINTK(PROBE, INFO,
"Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
printk(KERN_INFO "10 Mbps Speed specified without Duplex\n");
printk(KERN_INFO "Using Autonegotiation at 10 Mbps only\n");
DPRINTK(PROBE, INFO,
"10 Mbps Speed specified without Duplex\n");
DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
printk(KERN_INFO "Forcing to 10 Mbps Half Duplex\n");
DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
printk(KERN_INFO "Forcing to 10 Mbps Full Duplex\n");
DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
printk(KERN_INFO "100 Mbps Speed specified without Duplex\n");
printk(KERN_INFO "Using Autonegotiation at 100 Mbps only\n");
DPRINTK(PROBE, INFO,
"100 Mbps Speed specified without Duplex\n");
DPRINTK(PROBE, INFO,
"Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
printk(KERN_INFO "Forcing to 100 Mbps Half Duplex\n");
DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
printk(KERN_INFO "Forcing to 100 Mbps Full Duplex\n");
DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
printk(KERN_INFO "1000 Mbps Speed specified without Duplex\n");
printk(KERN_INFO
DPRINTK(PROBE, INFO,
"1000 Mbps Speed specified without Duplex\n");
DPRINTK(PROBE, INFO,
"Using Autonegotiation at 1000 Mbps Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
case SPEED_1000 + HALF_DUPLEX:
printk(KERN_INFO "Half Duplex is not supported at 1000 Mbps\n");
printk(KERN_INFO
DPRINTK(PROBE, INFO,
"Half Duplex is not supported at 1000 Mbps\n");
DPRINTK(PROBE, INFO,
"Using Autonegotiation at 1000 Mbps Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
case SPEED_1000 + FULL_DUPLEX:
printk(KERN_INFO
DPRINTK(PROBE, INFO,
"Using Autonegotiation at 1000 Mbps Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
......@@ -685,7 +695,8 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
printk(KERN_INFO "Speed, AutoNeg and MDI-X specifications are "
DPRINTK(PROBE, INFO,
"Speed, AutoNeg and MDI-X specifications are "
"incompatible. Setting MDI-X to a compatible value.\n");
}
}
......
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