Commit c91c43bf authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/misc

into pobox.com:/garz/repo/net-drivers-2.6
parents b99e712b adf8db03
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
#include <linux/udp.h> #include <linux/udp.h>
#include <net/pkt_sched.h> #include <net/pkt_sched.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/rtnetlink.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#ifdef NETIF_F_TSO #ifdef NETIF_F_TSO
#include <net/checksum.h> #include <net/checksum.h>
...@@ -73,7 +72,6 @@ ...@@ -73,7 +72,6 @@
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/moduleparam.h>
#define BAR_0 0 #define BAR_0 0
#define BAR_1 1 #define BAR_1 1
......
...@@ -249,7 +249,8 @@ e1000_set_pauseparam(struct net_device *netdev, ...@@ -249,7 +249,8 @@ e1000_set_pauseparam(struct net_device *netdev,
e1000_reset(adapter); e1000_reset(adapter);
} }
else else
return e1000_force_mac_fc(hw); return ((hw->media_type == e1000_media_type_fiber) ?
e1000_setup_link(hw) : e1000_force_mac_fc(hw));
return 0; return 0;
} }
...@@ -592,6 +593,9 @@ e1000_set_ringparam(struct net_device *netdev, ...@@ -592,6 +593,9 @@ e1000_set_ringparam(struct net_device *netdev,
tx_old = adapter->tx_ring; tx_old = adapter->tx_ring;
rx_old = adapter->rx_ring; rx_old = adapter->rx_ring;
if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
return -EINVAL;
if(netif_running(adapter->netdev)) if(netif_running(adapter->netdev))
e1000_down(adapter); e1000_down(adapter);
...@@ -637,7 +641,6 @@ e1000_set_ringparam(struct net_device *netdev, ...@@ -637,7 +641,6 @@ e1000_set_ringparam(struct net_device *netdev,
return err; return err;
} }
#define REG_PATTERN_TEST(R, M, W) \ #define REG_PATTERN_TEST(R, M, W) \
{ \ { \
uint32_t pat, value; \ uint32_t pat, value; \
...@@ -1017,8 +1020,8 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter) ...@@ -1017,8 +1020,8 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i); struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rxdr, i);
struct sk_buff *skb; struct sk_buff *skb;
if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN, if(!(skb = alloc_skb(E1000_RXBUFFER_2048 + NET_IP_ALIGN,
GFP_KERNEL))) { GFP_KERNEL))) {
ret_val = 6; ret_val = 6;
goto err_nomem; goto err_nomem;
} }
...@@ -1442,6 +1445,8 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -1442,6 +1445,8 @@ e1000_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
case E1000_DEV_ID_82543GC_COPPER: case E1000_DEV_ID_82543GC_COPPER:
case E1000_DEV_ID_82544EI_FIBER: case E1000_DEV_ID_82544EI_FIBER:
case E1000_DEV_ID_82546EB_QUAD_COPPER: case E1000_DEV_ID_82546EB_QUAD_COPPER:
case E1000_DEV_ID_82545EM_FIBER:
case E1000_DEV_ID_82545EM_COPPER:
wol->supported = 0; wol->supported = 0;
wol->wolopts = 0; wol->wolopts = 0;
return; return;
......
...@@ -65,6 +65,7 @@ static void e1000_release_eeprom(struct e1000_hw *hw); ...@@ -65,6 +65,7 @@ static void e1000_release_eeprom(struct e1000_hw *hw);
static void e1000_standby_eeprom(struct e1000_hw *hw); static void e1000_standby_eeprom(struct e1000_hw *hw);
static int32_t e1000_id_led_init(struct e1000_hw * hw); static int32_t e1000_id_led_init(struct e1000_hw * hw);
static int32_t e1000_set_vco_speed(struct e1000_hw *hw); static int32_t e1000_set_vco_speed(struct e1000_hw *hw);
static int32_t e1000_polarity_reversal_workaround(struct e1000_hw *hw);
static int32_t e1000_set_phy_mode(struct e1000_hw *hw); static int32_t e1000_set_phy_mode(struct e1000_hw *hw);
/* IGP cable length table */ /* IGP cable length table */
...@@ -1594,6 +1595,15 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) ...@@ -1594,6 +1595,15 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw)
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data); ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
if(ret_val) if(ret_val)
return ret_val; return ret_val;
if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
(!hw->autoneg) &&
(hw->forced_speed_duplex == e1000_10_full ||
hw->forced_speed_duplex == e1000_10_half)) {
ret_val = e1000_polarity_reversal_workaround(hw);
if(ret_val)
return ret_val;
}
} }
return E1000_SUCCESS; return E1000_SUCCESS;
} }
...@@ -1983,6 +1993,7 @@ e1000_check_for_link(struct e1000_hw *hw) ...@@ -1983,6 +1993,7 @@ e1000_check_for_link(struct e1000_hw *hw)
uint32_t ctrl; uint32_t ctrl;
uint32_t status; uint32_t status;
uint32_t rctl; uint32_t rctl;
uint32_t icr;
uint32_t signal = 0; uint32_t signal = 0;
int32_t ret_val; int32_t ret_val;
uint16_t phy_data; uint16_t phy_data;
...@@ -2032,6 +2043,25 @@ e1000_check_for_link(struct e1000_hw *hw) ...@@ -2032,6 +2043,25 @@ e1000_check_for_link(struct e1000_hw *hw)
* link-up */ * link-up */
e1000_check_downshift(hw); e1000_check_downshift(hw);
/* If we are on 82544 or 82543 silicon and speed/duplex
* are forced to 10H or 10F, then we will implement the polarity
* reversal workaround. We disable interrupts first, and upon
* returning, place the devices interrupt state to its previous
* value except for the link status change interrupt which will
* happen due to the execution of this workaround.
*/
if((hw->mac_type == e1000_82544 || hw->mac_type == e1000_82543) &&
(!hw->autoneg) &&
(hw->forced_speed_duplex == e1000_10_full ||
hw->forced_speed_duplex == e1000_10_half)) {
E1000_WRITE_REG(hw, IMC, 0xffffffff);
ret_val = e1000_polarity_reversal_workaround(hw);
icr = E1000_READ_REG(hw, ICR);
E1000_WRITE_REG(hw, ICS, (icr & ~E1000_ICS_LSC));
E1000_WRITE_REG(hw, IMS, IMS_ENABLE_MASK);
}
} else { } else {
/* No link detected */ /* No link detected */
e1000_config_dsp_after_link_change(hw, FALSE); e1000_config_dsp_after_link_change(hw, FALSE);
...@@ -5191,28 +5221,88 @@ e1000_set_vco_speed(struct e1000_hw *hw) ...@@ -5191,28 +5221,88 @@ e1000_set_vco_speed(struct e1000_hw *hw)
return E1000_SUCCESS; return E1000_SUCCESS;
} }
/****************************************************************************** static int32_t
* Verifies the hardware needs to allow ARPs to be processed by the host e1000_polarity_reversal_workaround(struct e1000_hw *hw)
*
* hw - Struct containing variables accessed by shared code
*
* returns: - TRUE/FALSE
*
*****************************************************************************/
uint32_t
e1000_enable_mng_pass_thru(struct e1000_hw *hw)
{ {
uint32_t manc; int32_t ret_val;
uint16_t mii_status_reg;
uint16_t i;
if (hw->asf_firmware_present) { /* Polarity reversal workaround for forced 10F/10H links. */
manc = E1000_READ_REG(hw, MANC);
/* Disable the transmitter on the PHY */
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019);
if(ret_val)
return ret_val;
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFFF);
if(ret_val)
return ret_val;
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000);
if(ret_val)
return ret_val;
/* This loop will early-out if the NO link condition has been met. */
for(i = PHY_FORCE_TIME; i > 0; i--) {
/* Read the MII Status Register and wait for Link Status bit
* to be clear.
*/
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
if(ret_val)
return ret_val;
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
if(ret_val)
return ret_val;
if((mii_status_reg & ~MII_SR_LINK_STATUS) == 0) break;
msec_delay_irq(100);
}
/* Recommended delay time after link has been lost */
msec_delay_irq(1000);
/* Now we will re-enable th transmitter on the PHY */
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0019);
if(ret_val)
return ret_val;
msec_delay_irq(50);
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFFF0);
if(ret_val)
return ret_val;
msec_delay_irq(50);
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xFF00);
if(ret_val)
return ret_val;
msec_delay_irq(50);
ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0x0000);
if(ret_val)
return ret_val;
if (!(manc & E1000_MANC_RCV_TCO_EN) || ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_PAGE_SELECT, 0x0000);
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER)) if(ret_val)
return FALSE; return ret_val;
if ((manc & E1000_MANC_SMBUS_EN) && !(manc & E1000_MANC_ASF_EN))
return TRUE; /* This loop will early-out if the link condition has been met. */
for(i = PHY_FORCE_TIME; i > 0; i--) {
/* Read the MII Status Register and wait for Link Status bit
* to be set.
*/
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
if(ret_val)
return ret_val;
ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &mii_status_reg);
if(ret_val)
return ret_val;
if(mii_status_reg & MII_SR_LINK_STATUS) break;
msec_delay_irq(100);
} }
return FALSE; return E1000_SUCCESS;
} }
...@@ -48,7 +48,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; ...@@ -48,7 +48,7 @@ char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
#else #else
#define DRIVERNAPI "-NAPI" #define DRIVERNAPI "-NAPI"
#endif #endif
char e1000_driver_version[] = "5.3.19-k2"DRIVERNAPI; char e1000_driver_version[] = "5.5.4-k2"DRIVERNAPI;
char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation."; char e1000_copyright[] = "Copyright (c) 1999-2004 Intel Corporation.";
/* e1000_pci_tbl - PCI Device ID Table /* e1000_pci_tbl - PCI Device ID Table
...@@ -311,7 +311,8 @@ e1000_down(struct e1000_adapter *adapter) ...@@ -311,7 +311,8 @@ e1000_down(struct e1000_adapter *adapter)
void void
e1000_reset(struct e1000_adapter *adapter) e1000_reset(struct e1000_adapter *adapter)
{ {
uint32_t pba, manc; uint32_t pba;
/* Repartition Pba for greater than 9k mtu /* Repartition Pba for greater than 9k mtu
* To take effect CTRL.RST is required. * To take effect CTRL.RST is required.
*/ */
...@@ -354,12 +355,6 @@ e1000_reset(struct e1000_adapter *adapter) ...@@ -354,12 +355,6 @@ e1000_reset(struct e1000_adapter *adapter)
e1000_reset_adaptive(&adapter->hw); e1000_reset_adaptive(&adapter->hw);
e1000_phy_get_info(&adapter->hw, &adapter->phy_info); e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
if(adapter->en_mng_pt) {
manc = E1000_READ_REG(&adapter->hw, MANC);
manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
E1000_WRITE_REG(&adapter->hw, MANC, manc);
}
} }
/** /**
...@@ -422,11 +417,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -422,11 +417,6 @@ e1000_probe(struct pci_dev *pdev,
adapter->hw.back = adapter; adapter->hw.back = adapter;
adapter->msg_enable = (1 << debug) - 1; adapter->msg_enable = (1 << debug) - 1;
rtnl_lock();
/* we need to set the name early for the DPRINTK macro */
if(dev_alloc_name(netdev, netdev->name) < 0)
goto err_free_unlock;
mmio_start = pci_resource_start(pdev, BAR_0); mmio_start = pci_resource_start(pdev, BAR_0);
mmio_len = pci_resource_len(pdev, BAR_0); mmio_len = pci_resource_len(pdev, BAR_0);
...@@ -466,6 +456,7 @@ e1000_probe(struct pci_dev *pdev, ...@@ -466,6 +456,7 @@ e1000_probe(struct pci_dev *pdev,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
netdev->poll_controller = e1000_netpoll; netdev->poll_controller = e1000_netpoll;
#endif #endif
strcpy(netdev->name, pci_name(pdev));
netdev->mem_start = mmio_start; netdev->mem_start = mmio_start;
netdev->mem_end = mmio_start + mmio_len; netdev->mem_end = mmio_start + mmio_len;
...@@ -502,8 +493,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -502,8 +493,6 @@ e1000_probe(struct pci_dev *pdev,
/* hard_start_xmit is safe against parallel locking */ /* hard_start_xmit is safe against parallel locking */
netdev->features |= NETIF_F_LLTX; netdev->features |= NETIF_F_LLTX;
adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw);
/* before reading the EEPROM, reset the controller to /* before reading the EEPROM, reset the controller to
* put the device in a known good starting state */ * put the device in a known good starting state */
...@@ -553,7 +542,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -553,7 +542,6 @@ e1000_probe(struct pci_dev *pdev,
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_stop_queue(netdev); netif_stop_queue(netdev);
DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
e1000_check_options(adapter); e1000_check_options(adapter);
/* Initial Wake on LAN setting /* Initial Wake on LAN setting
...@@ -586,12 +574,13 @@ e1000_probe(struct pci_dev *pdev, ...@@ -586,12 +574,13 @@ e1000_probe(struct pci_dev *pdev,
/* reset the hardware with the new settings */ /* reset the hardware with the new settings */
e1000_reset(adapter); e1000_reset(adapter);
/* We're already holding the rtnl lock; call the no-lock version */ strcpy(netdev->name, "eth%d");
if((err = register_netdevice(netdev))) if((err = register_netdev(netdev)))
goto err_register; goto err_register;
DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
cards_found++; cards_found++;
rtnl_unlock();
return 0; return 0;
err_register: err_register:
...@@ -599,8 +588,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -599,8 +588,6 @@ e1000_probe(struct pci_dev *pdev,
err_eeprom: err_eeprom:
iounmap(adapter->hw.hw_addr); iounmap(adapter->hw.hw_addr);
err_ioremap: err_ioremap:
err_free_unlock:
rtnl_unlock();
free_netdev(netdev); free_netdev(netdev);
err_alloc_etherdev: err_alloc_etherdev:
pci_release_regions(pdev); pci_release_regions(pdev);
...@@ -2337,8 +2324,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter) ...@@ -2337,8 +2324,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
if(unlikely(adapter->vlgrp && if(unlikely(adapter->vlgrp &&
(rx_desc->status & E1000_RXD_STAT_VP))) { (rx_desc->status & E1000_RXD_STAT_VP))) {
vlan_hwaccel_receive_skb(skb, adapter->vlgrp, vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
le16_to_cpu(rx_desc->special & le16_to_cpu(rx_desc->special) &
E1000_RXD_SPC_VLAN_MASK)); E1000_RXD_SPC_VLAN_MASK);
} else { } else {
netif_receive_skb(skb); netif_receive_skb(skb);
} }
...@@ -2346,8 +2333,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter) ...@@ -2346,8 +2333,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter)
if(unlikely(adapter->vlgrp && if(unlikely(adapter->vlgrp &&
(rx_desc->status & E1000_RXD_STAT_VP))) { (rx_desc->status & E1000_RXD_STAT_VP))) {
vlan_hwaccel_rx(skb, adapter->vlgrp, vlan_hwaccel_rx(skb, adapter->vlgrp,
le16_to_cpu(rx_desc->special & le16_to_cpu(rx_desc->special) &
E1000_RXD_SPC_VLAN_MASK)); E1000_RXD_SPC_VLAN_MASK);
} else { } else {
netif_rx(skb); netif_rx(skb);
} }
...@@ -2896,9 +2883,9 @@ e1000_resume(struct pci_dev *pdev) ...@@ -2896,9 +2883,9 @@ e1000_resume(struct pci_dev *pdev)
{ {
struct net_device *netdev = pci_get_drvdata(pdev); struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev->priv; struct e1000_adapter *adapter = netdev->priv;
uint32_t manc; uint32_t manc, ret;
pci_enable_device(pdev); ret = pci_enable_device(pdev);
pci_set_power_state(pdev, 0); pci_set_power_state(pdev, 0);
pci_restore_state(pdev); pci_restore_state(pdev);
......
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
set_current_state(TASK_UNINTERRUPTIBLE); \ set_current_state(TASK_UNINTERRUPTIBLE); \
schedule_timeout((x * HZ)/1000 + 2); \ schedule_timeout((x * HZ)/1000 + 2); \
} } while(0) } } while(0)
/* Some workarounds require millisecond delays and are run during interrupt
* context. Most notably, when establishing link, the phy may need tweaking
* but cannot process phy register reads/writes faster than millisecond
* intervals...and we establish link due to a "link status change" interrupt.
*/
#define msec_delay_irq(x) mdelay(x)
#endif #endif
#define PCI_COMMAND_REGISTER PCI_COMMAND #define PCI_COMMAND_REGISTER PCI_COMMAND
......
...@@ -34,31 +34,21 @@ ...@@ -34,31 +34,21 @@
#define E1000_MAX_NIC 32 #define E1000_MAX_NIC 32
#define OPTION_UNSET -1 #define OPTION_UNSET -1
#define OPTION_DISABLED 0 #define OPTION_DISABLED 0
#define OPTION_ENABLED 1 #define OPTION_ENABLED 1
/* Module Parameters are always initialized to -1, so that the driver
* can tell the difference between no user specified value or the
* user asking for the default value.
* The true default values are loaded in when e1000_check_options is called.
*
* This is a GCC extension to ANSI C.
* See the item "Labeled Elements in Initializers" in the section
* "Extensions to the C Language Family" of the GCC documentation.
*/
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
/* All parameters are treated the same, as an integer array of values. /* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code * This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs). * over and over (plus this helps to avoid typo bugs).
*/ */
#define E1000_PARAM(X, S) \ #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
static const int __devinitdata X[E1000_MAX_NIC + 1] = E1000_PARAM_INIT; \ #define E1000_PARAM(X, desc) \
MODULE_PARM(X, "1-" __MODULE_STRING(E1000_MAX_NIC) "i"); \ static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
MODULE_PARM_DESC(X, S); static int num_##X = 0; \
module_param_array(X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count /* Transmit Descriptor Count
* *
...@@ -305,7 +295,6 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -305,7 +295,6 @@ e1000_check_options(struct e1000_adapter *adapter)
DPRINTK(PROBE, NOTICE, DPRINTK(PROBE, NOTICE,
"Warning: no configuration for board #%i\n", bd); "Warning: no configuration for board #%i\n", bd);
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
bd = E1000_MAX_NIC;
} }
{ /* Transmit Descriptor Count */ { /* Transmit Descriptor Count */
...@@ -322,9 +311,14 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -322,9 +311,14 @@ e1000_check_options(struct e1000_adapter *adapter)
opt.arg.r.max = mac_type < e1000_82544 ? opt.arg.r.max = mac_type < e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD; E1000_MAX_TXD : E1000_MAX_82544_TXD;
tx_ring->count = TxDescriptors[bd]; if (num_TxDescriptors > bd) {
e1000_validate_option(&tx_ring->count, &opt, adapter); tx_ring->count = TxDescriptors[bd];
E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); e1000_validate_option(&tx_ring->count, &opt, adapter);
E1000_ROUNDUP(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring->count = opt.def;
}
} }
{ /* Receive Descriptor Count */ { /* Receive Descriptor Count */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -340,9 +334,14 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -340,9 +334,14 @@ e1000_check_options(struct e1000_adapter *adapter)
opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD; E1000_MAX_82544_RXD;
rx_ring->count = RxDescriptors[bd]; if (num_RxDescriptors > bd) {
e1000_validate_option(&rx_ring->count, &opt, adapter); rx_ring->count = RxDescriptors[bd];
E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); e1000_validate_option(&rx_ring->count, &opt, adapter);
E1000_ROUNDUP(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE);
} else {
rx_ring->count = opt.def;
}
} }
{ /* Checksum Offload Enable/Disable */ { /* Checksum Offload Enable/Disable */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -352,9 +351,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -352,9 +351,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.def = OPTION_ENABLED .def = OPTION_ENABLED
}; };
int rx_csum = XsumRX[bd]; if (num_XsumRX > bd) {
e1000_validate_option(&rx_csum, &opt, adapter); int rx_csum = XsumRX[bd];
adapter->rx_csum = rx_csum; e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
} else {
adapter->rx_csum = opt.def;
}
} }
{ /* Flow Control */ { /* Flow Control */
...@@ -374,9 +377,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -374,9 +377,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.p = fc_list }} .p = fc_list }}
}; };
int fc = FlowControl[bd]; if (num_FlowControl > bd) {
e1000_validate_option(&fc, &opt, adapter); int fc = FlowControl[bd];
adapter->hw.fc = adapter->hw.original_fc = fc; e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
} else {
adapter->hw.fc = opt.def;
}
} }
{ /* Transmit Interrupt Delay */ { /* Transmit Interrupt Delay */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -388,8 +395,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -388,8 +395,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.max = MAX_TXDELAY }} .max = MAX_TXDELAY }}
}; };
adapter->tx_int_delay = TxIntDelay[bd]; if (num_TxIntDelay > bd) {
e1000_validate_option(&adapter->tx_int_delay, &opt, adapter); adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter);
} else {
adapter->tx_int_delay = opt.def;
}
} }
{ /* Transmit Absolute Interrupt Delay */ { /* Transmit Absolute Interrupt Delay */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -401,8 +413,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -401,8 +413,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.max = MAX_TXABSDELAY }} .max = MAX_TXABSDELAY }}
}; };
adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; if (num_TxAbsIntDelay > bd) {
e1000_validate_option(&adapter->tx_abs_int_delay, &opt, adapter); adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter);
} else {
adapter->tx_abs_int_delay = opt.def;
}
} }
{ /* Receive Interrupt Delay */ { /* Receive Interrupt Delay */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -414,8 +431,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -414,8 +431,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.max = MAX_RXDELAY }} .max = MAX_RXDELAY }}
}; };
adapter->rx_int_delay = RxIntDelay[bd]; if (num_RxIntDelay > bd) {
e1000_validate_option(&adapter->rx_int_delay, &opt, adapter); adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter);
} else {
adapter->rx_int_delay = opt.def;
}
} }
{ /* Receive Absolute Interrupt Delay */ { /* Receive Absolute Interrupt Delay */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -427,8 +449,13 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -427,8 +449,13 @@ e1000_check_options(struct e1000_adapter *adapter)
.max = MAX_RXABSDELAY }} .max = MAX_RXABSDELAY }}
}; };
adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; if (num_RxAbsIntDelay > bd) {
e1000_validate_option(&adapter->rx_abs_int_delay, &opt, adapter); adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter);
} else {
adapter->rx_abs_int_delay = opt.def;
}
} }
{ /* Interrupt Throttling Rate */ { /* Interrupt Throttling Rate */
struct e1000_option opt = { struct e1000_option opt = {
...@@ -440,20 +467,27 @@ e1000_check_options(struct e1000_adapter *adapter) ...@@ -440,20 +467,27 @@ e1000_check_options(struct e1000_adapter *adapter)
.max = MAX_ITR }} .max = MAX_ITR }}
}; };
adapter->itr = InterruptThrottleRate[bd]; if (num_InterruptThrottleRate > bd) {
switch(adapter->itr) { adapter->itr = InterruptThrottleRate[bd];
case -1: switch(adapter->itr) {
case -1:
adapter->itr = 1;
break;
case 0:
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
break;
case 1:
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
opt.name);
break;
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
break;
}
} else {
adapter->itr = 1; adapter->itr = 1;
break;
case 0:
DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
break;
case 1:
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", opt.name);
break;
default:
e1000_validate_option(&adapter->itr, &opt, adapter);
break;
} }
} }
...@@ -481,17 +515,17 @@ static void __devinit ...@@ -481,17 +515,17 @@ static void __devinit
e1000_check_fiber_options(struct e1000_adapter *adapter) e1000_check_fiber_options(struct e1000_adapter *adapter)
{ {
int bd = adapter->bd_number; int bd = adapter->bd_number;
bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; if(num_Speed > bd) {
if((Speed[bd] != OPTION_UNSET)) {
DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
} }
if((Duplex[bd] != OPTION_UNSET)) {
if(num_Duplex > bd) {
DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
} }
if((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
if((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
"not valid for fiber adapters, " "not valid for fiber adapters, "
"parameter ignored\n"); "parameter ignored\n");
...@@ -510,7 +544,6 @@ e1000_check_copper_options(struct e1000_adapter *adapter) ...@@ -510,7 +544,6 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
{ {
int speed, dplx; int speed, dplx;
int bd = adapter->bd_number; int bd = adapter->bd_number;
bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
{ /* Speed */ { /* Speed */
struct e1000_opt_list speed_list[] = {{ 0, "" }, struct e1000_opt_list speed_list[] = {{ 0, "" },
...@@ -527,8 +560,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter) ...@@ -527,8 +560,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
.p = speed_list }} .p = speed_list }}
}; };
speed = Speed[bd]; if (num_Speed > bd) {
e1000_validate_option(&speed, &opt, adapter); speed = Speed[bd];
e1000_validate_option(&speed, &opt, adapter);
} else {
speed = opt.def;
}
} }
{ /* Duplex */ { /* Duplex */
struct e1000_opt_list dplx_list[] = {{ 0, "" }, struct e1000_opt_list dplx_list[] = {{ 0, "" },
...@@ -544,11 +581,15 @@ e1000_check_copper_options(struct e1000_adapter *adapter) ...@@ -544,11 +581,15 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
.p = dplx_list }} .p = dplx_list }}
}; };
dplx = Duplex[bd]; if (num_Duplex > bd) {
e1000_validate_option(&dplx, &opt, adapter); dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt, adapter);
} else {
dplx = opt.def;
}
} }
if(AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) { if((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
DPRINTK(PROBE, INFO, DPRINTK(PROBE, INFO,
"AutoNeg specified along with Speed or Duplex, " "AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n"); "parameter ignored\n");
...@@ -605,7 +646,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter) ...@@ -605,7 +646,7 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
switch (speed + dplx) { switch (speed + dplx) {
case 0: case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1; adapter->hw.autoneg = adapter->fc_autoneg = 1;
if(Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET) if((num_Speed > bd) && (speed != 0 || dplx != 0))
DPRINTK(PROBE, INFO, DPRINTK(PROBE, INFO,
"Speed and duplex autonegotiation enabled\n"); "Speed and duplex autonegotiation enabled\n");
break; break;
......
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