ch1010832@1996: /******************************************************************************* ch1010832@1996: ch1010832@1996: Intel PRO/1000 Linux driver ch1010832@1996: Copyright(c) 1999 - 2006 Intel Corporation. ch1010832@1996: ch1010832@1996: This program is free software; you can redistribute it and/or modify it ch1010832@1996: under the terms and conditions of the GNU General Public License, ch1010832@1996: version 2, as published by the Free Software Foundation. ch1010832@1996: ch1010832@1996: This program is distributed in the hope it will be useful, but WITHOUT ch1010832@1996: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ch1010832@1996: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ch1010832@1996: more details. ch1010832@1996: ch1010832@1996: You should have received a copy of the GNU General Public License along with ch1010832@1996: this program; if not, write to the Free Software Foundation, Inc., ch1010832@1996: 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. ch1010832@1996: ch1010832@1996: The full GNU General Public License is included in this distribution in ch1010832@1996: the file called "COPYING". ch1010832@1996: ch1010832@1996: Contact Information: ch1010832@1996: Linux NICS ch1010832@1996: e1000-devel Mailing List ch1010832@1996: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 ch1010832@1996: ch1010832@1996: *******************************************************************************/ ch1010832@1996: ch1010832@1996: #include "e1000.h" ch1010832@1996: ch1010832@1996: /* This is the only thing that needs to be changed to adjust the ch1010832@1996: * maximum number of ports that the driver can manage. ch1010832@1996: */ ch1010832@1996: ch1010832@1996: #define E1000_MAX_NIC 32 ch1010832@1996: ch1010832@1996: #define OPTION_UNSET -1 ch1010832@1996: #define OPTION_DISABLED 0 ch1010832@1996: #define OPTION_ENABLED 1 ch1010832@1996: ch1010832@1996: /* All parameters are treated the same, as an integer array of values. ch1010832@1996: * This macro just reduces the need to repeat the same declaration code ch1010832@1996: * over and over (plus this helps to avoid typo bugs). ch1010832@1996: */ ch1010832@1996: ch1010832@1996: #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } ch1010832@1996: #define E1000_PARAM(X, desc) \ ch1010832@1996: static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \ ch1010832@1996: static unsigned int num_##X; \ ch1010832@1996: module_param_array_named(X, X, int, &num_##X, 0); \ ch1010832@1996: MODULE_PARM_DESC(X, desc); ch1010832@1996: ch1010832@1996: /* Transmit Descriptor Count ch1010832@1996: * ch1010832@1996: * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers ch1010832@1996: * Valid Range: 80-4096 for 82544 and newer ch1010832@1996: * ch1010832@1996: * Default Value: 256 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(TxDescriptors, "Number of transmit descriptors"); ch1010832@1996: ch1010832@1996: /* Receive Descriptor Count ch1010832@1996: * ch1010832@1996: * Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers ch1010832@1996: * Valid Range: 80-4096 for 82544 and newer ch1010832@1996: * ch1010832@1996: * Default Value: 256 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(RxDescriptors, "Number of receive descriptors"); ch1010832@1996: ch1010832@1996: /* User Specified Speed Override ch1010832@1996: * ch1010832@1996: * Valid Range: 0, 10, 100, 1000 ch1010832@1996: * - 0 - auto-negotiate at all supported speeds ch1010832@1996: * - 10 - only link at 10 Mbps ch1010832@1996: * - 100 - only link at 100 Mbps ch1010832@1996: * - 1000 - only link at 1000 Mbps ch1010832@1996: * ch1010832@1996: * Default Value: 0 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(Speed, "Speed setting"); ch1010832@1996: ch1010832@1996: /* User Specified Duplex Override ch1010832@1996: * ch1010832@1996: * Valid Range: 0-2 ch1010832@1996: * - 0 - auto-negotiate for duplex ch1010832@1996: * - 1 - only link at half duplex ch1010832@1996: * - 2 - only link at full duplex ch1010832@1996: * ch1010832@1996: * Default Value: 0 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(Duplex, "Duplex setting"); ch1010832@1996: ch1010832@1996: /* Auto-negotiation Advertisement Override ch1010832@1996: * ch1010832@1996: * Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber) ch1010832@1996: * ch1010832@1996: * The AutoNeg value is a bit mask describing which speed and duplex ch1010832@1996: * combinations should be advertised during auto-negotiation. ch1010832@1996: * The supported speed and duplex modes are listed below ch1010832@1996: * ch1010832@1996: * Bit 7 6 5 4 3 2 1 0 ch1010832@1996: * Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10 ch1010832@1996: * Duplex Full Full Half Full Half ch1010832@1996: * ch1010832@1996: * Default Value: 0x2F (copper); 0x20 (fiber) ch1010832@1996: */ ch1010832@1996: E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting"); ch1010832@1996: #define AUTONEG_ADV_DEFAULT 0x2F ch1010832@1996: #define AUTONEG_ADV_MASK 0x2F ch1010832@1996: ch1010832@1996: /* User Specified Flow Control Override ch1010832@1996: * ch1010832@1996: * Valid Range: 0-3 ch1010832@1996: * - 0 - No Flow Control ch1010832@1996: * - 1 - Rx only, respond to PAUSE frames but do not generate them ch1010832@1996: * - 2 - Tx only, generate PAUSE frames but ignore them on receive ch1010832@1996: * - 3 - Full Flow Control Support ch1010832@1996: * ch1010832@1996: * Default Value: Read flow control settings from the EEPROM ch1010832@1996: */ ch1010832@1996: E1000_PARAM(FlowControl, "Flow Control setting"); ch1010832@1996: #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL ch1010832@1996: ch1010832@1996: /* XsumRX - Receive Checksum Offload Enable/Disable ch1010832@1996: * ch1010832@1996: * Valid Range: 0, 1 ch1010832@1996: * - 0 - disables all checksum offload ch1010832@1996: * - 1 - enables receive IP/TCP/UDP checksum offload ch1010832@1996: * on 82543 and newer -based NICs ch1010832@1996: * ch1010832@1996: * Default Value: 1 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload"); ch1010832@1996: ch1010832@1996: /* Transmit Interrupt Delay in units of 1.024 microseconds ch1010832@1996: * Tx interrupt delay needs to typically be set to something non zero ch1010832@1996: * ch1010832@1996: * Valid Range: 0-65535 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); ch1010832@1996: #define DEFAULT_TIDV 8 ch1010832@1996: #define MAX_TXDELAY 0xFFFF ch1010832@1996: #define MIN_TXDELAY 0 ch1010832@1996: ch1010832@1996: /* Transmit Absolute Interrupt Delay in units of 1.024 microseconds ch1010832@1996: * ch1010832@1996: * Valid Range: 0-65535 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); ch1010832@1996: #define DEFAULT_TADV 32 ch1010832@1996: #define MAX_TXABSDELAY 0xFFFF ch1010832@1996: #define MIN_TXABSDELAY 0 ch1010832@1996: ch1010832@1996: /* Receive Interrupt Delay in units of 1.024 microseconds ch1010832@1996: * hardware will likely hang if you set this to anything but zero. ch1010832@1996: * ch1010832@1996: * Valid Range: 0-65535 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); ch1010832@1996: #define DEFAULT_RDTR 0 ch1010832@1996: #define MAX_RXDELAY 0xFFFF ch1010832@1996: #define MIN_RXDELAY 0 ch1010832@1996: ch1010832@1996: /* Receive Absolute Interrupt Delay in units of 1.024 microseconds ch1010832@1996: * ch1010832@1996: * Valid Range: 0-65535 ch1010832@1996: */ ch1010832@1996: E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); ch1010832@1996: #define DEFAULT_RADV 8 ch1010832@1996: #define MAX_RXABSDELAY 0xFFFF ch1010832@1996: #define MIN_RXABSDELAY 0 ch1010832@1996: ch1010832@1996: /* Interrupt Throttle Rate (interrupts/sec) ch1010832@1996: * ch1010832@1996: * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) ch1010832@1996: */ ch1010832@1996: E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); ch1010832@1996: #define DEFAULT_ITR 3 ch1010832@1996: #define MAX_ITR 100000 ch1010832@1996: #define MIN_ITR 100 ch1010832@1996: ch1010832@1996: /* Enable Smart Power Down of the PHY ch1010832@1996: * ch1010832@1996: * Valid Range: 0, 1 ch1010832@1996: * ch1010832@1996: * Default Value: 0 (disabled) ch1010832@1996: */ ch1010832@1996: E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); ch1010832@1996: ch1010832@1996: /* Enable Kumeran Lock Loss workaround ch1010832@1996: * ch1010832@1996: * Valid Range: 0, 1 ch1010832@1996: * ch1010832@1996: * Default Value: 1 (enabled) ch1010832@1996: */ ch1010832@1996: E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); ch1010832@1996: ch1010832@1996: struct e1000_option { ch1010832@1996: enum { enable_option, range_option, list_option } type; ch1010832@1996: const char *name; ch1010832@1996: const char *err; ch1010832@1996: int def; ch1010832@1996: union { ch1010832@1996: struct { /* range_option info */ ch1010832@1996: int min; ch1010832@1996: int max; ch1010832@1996: } r; ch1010832@1996: struct { /* list_option info */ ch1010832@1996: int nr; ch1010832@1996: const struct e1000_opt_list { int i; char *str; } *p; ch1010832@1996: } l; ch1010832@1996: } arg; ch1010832@1996: }; ch1010832@1996: ch1010832@1996: static int __devinit e1000_validate_option(unsigned int *value, ch1010832@1996: const struct e1000_option *opt, ch1010832@1996: struct e1000_adapter *adapter) ch1010832@1996: { ch1010832@1996: if (*value == OPTION_UNSET) { ch1010832@1996: *value = opt->def; ch1010832@1996: return 0; ch1010832@1996: } ch1010832@1996: ch1010832@1996: switch (opt->type) { ch1010832@1996: case enable_option: ch1010832@1996: switch (*value) { ch1010832@1996: case OPTION_ENABLED: ch1010832@1996: DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name); ch1010832@1996: return 0; ch1010832@1996: case OPTION_DISABLED: ch1010832@1996: DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name); ch1010832@1996: return 0; ch1010832@1996: } ch1010832@1996: break; ch1010832@1996: case range_option: ch1010832@1996: if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "%s set to %i\n", opt->name, *value); ch1010832@1996: return 0; ch1010832@1996: } ch1010832@1996: break; ch1010832@1996: case list_option: { ch1010832@1996: int i; ch1010832@1996: const struct e1000_opt_list *ent; ch1010832@1996: ch1010832@1996: for (i = 0; i < opt->arg.l.nr; i++) { ch1010832@1996: ent = &opt->arg.l.p[i]; ch1010832@1996: if (*value == ent->i) { ch1010832@1996: if (ent->str[0] != '\0') ch1010832@1996: DPRINTK(PROBE, INFO, "%s\n", ent->str); ch1010832@1996: return 0; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: } ch1010832@1996: break; ch1010832@1996: default: ch1010832@1996: BUG(); ch1010832@1996: } ch1010832@1996: ch1010832@1996: DPRINTK(PROBE, INFO, "Invalid %s value specified (%i) %s\n", ch1010832@1996: opt->name, *value, opt->err); ch1010832@1996: *value = opt->def; ch1010832@1996: return -1; ch1010832@1996: } ch1010832@1996: ch1010832@1996: static void e1000_check_fiber_options(struct e1000_adapter *adapter); ch1010832@1996: static void e1000_check_copper_options(struct e1000_adapter *adapter); ch1010832@1996: ch1010832@1996: /** ch1010832@1996: * e1000_check_options - Range Checking for Command Line Parameters ch1010832@1996: * @adapter: board private structure ch1010832@1996: * ch1010832@1996: * This routine checks all command line parameters for valid user ch1010832@1996: * input. If an invalid value is given, or if no user specified ch1010832@1996: * value exists, a default value is used. The final value is stored ch1010832@1996: * in a variable in the adapter structure. ch1010832@1996: **/ ch1010832@1996: ch1010832@1996: void __devinit e1000_check_options(struct e1000_adapter *adapter) ch1010832@1996: { ch1010832@1996: struct e1000_option opt; ch1010832@1996: int bd = adapter->bd_number; ch1010832@1996: ch1010832@1996: if (bd >= E1000_MAX_NIC) { ch1010832@1996: DPRINTK(PROBE, NOTICE, ch1010832@1996: "Warning: no configuration for board #%i\n", bd); ch1010832@1996: DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); ch1010832@1996: } ch1010832@1996: ch1010832@1996: { /* Transmit Descriptor Count */ ch1010832@1996: struct e1000_tx_ring *tx_ring = adapter->tx_ring; ch1010832@1996: int i; ch1010832@1996: e1000_mac_type mac_type = adapter->hw.mac_type; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Transmit Descriptors", ch1010832@1996: .err = "using default of " ch1010832@1996: __MODULE_STRING(E1000_DEFAULT_TXD), ch1010832@1996: .def = E1000_DEFAULT_TXD, ch1010832@1996: .arg = { .r = { ch1010832@1996: .min = E1000_MIN_TXD, ch1010832@1996: .max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD ch1010832@1996: }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_TxDescriptors > bd) { ch1010832@1996: tx_ring->count = TxDescriptors[bd]; ch1010832@1996: e1000_validate_option(&tx_ring->count, &opt, adapter); ch1010832@1996: tx_ring->count = ALIGN(tx_ring->count, ch1010832@1996: REQ_TX_DESCRIPTOR_MULTIPLE); ch1010832@1996: } else { ch1010832@1996: tx_ring->count = opt.def; ch1010832@1996: } ch1010832@1996: for (i = 0; i < adapter->num_tx_queues; i++) ch1010832@1996: tx_ring[i].count = tx_ring->count; ch1010832@1996: } ch1010832@1996: { /* Receive Descriptor Count */ ch1010832@1996: struct e1000_rx_ring *rx_ring = adapter->rx_ring; ch1010832@1996: int i; ch1010832@1996: e1000_mac_type mac_type = adapter->hw.mac_type; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Receive Descriptors", ch1010832@1996: .err = "using default of " ch1010832@1996: __MODULE_STRING(E1000_DEFAULT_RXD), ch1010832@1996: .def = E1000_DEFAULT_RXD, ch1010832@1996: .arg = { .r = { ch1010832@1996: .min = E1000_MIN_RXD, ch1010832@1996: .max = mac_type < e1000_82544 ? E1000_MAX_RXD : E1000_MAX_82544_RXD ch1010832@1996: }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_RxDescriptors > bd) { ch1010832@1996: rx_ring->count = RxDescriptors[bd]; ch1010832@1996: e1000_validate_option(&rx_ring->count, &opt, adapter); ch1010832@1996: rx_ring->count = ALIGN(rx_ring->count, ch1010832@1996: REQ_RX_DESCRIPTOR_MULTIPLE); ch1010832@1996: } else { ch1010832@1996: rx_ring->count = opt.def; ch1010832@1996: } ch1010832@1996: for (i = 0; i < adapter->num_rx_queues; i++) ch1010832@1996: rx_ring[i].count = rx_ring->count; ch1010832@1996: } ch1010832@1996: { /* Checksum Offload Enable/Disable */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = enable_option, ch1010832@1996: .name = "Checksum Offload", ch1010832@1996: .err = "defaulting to Enabled", ch1010832@1996: .def = OPTION_ENABLED ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_XsumRX > bd) { ch1010832@1996: unsigned int rx_csum = XsumRX[bd]; ch1010832@1996: e1000_validate_option(&rx_csum, &opt, adapter); ch1010832@1996: adapter->rx_csum = rx_csum; ch1010832@1996: } else { ch1010832@1996: adapter->rx_csum = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Flow Control */ ch1010832@1996: ch1010832@1996: struct e1000_opt_list fc_list[] = ch1010832@1996: {{ E1000_FC_NONE, "Flow Control Disabled" }, ch1010832@1996: { E1000_FC_RX_PAUSE,"Flow Control Receive Only" }, ch1010832@1996: { E1000_FC_TX_PAUSE,"Flow Control Transmit Only" }, ch1010832@1996: { E1000_FC_FULL, "Flow Control Enabled" }, ch1010832@1996: { E1000_FC_DEFAULT, "Flow Control Hardware Default" }}; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = list_option, ch1010832@1996: .name = "Flow Control", ch1010832@1996: .err = "reading default settings from EEPROM", ch1010832@1996: .def = E1000_FC_DEFAULT, ch1010832@1996: .arg = { .l = { .nr = ARRAY_SIZE(fc_list), ch1010832@1996: .p = fc_list }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_FlowControl > bd) { ch1010832@1996: unsigned int fc = FlowControl[bd]; ch1010832@1996: e1000_validate_option(&fc, &opt, adapter); ch1010832@1996: adapter->hw.fc = adapter->hw.original_fc = fc; ch1010832@1996: } else { ch1010832@1996: adapter->hw.fc = adapter->hw.original_fc = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Transmit Interrupt Delay */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Transmit Interrupt Delay", ch1010832@1996: .err = "using default of " __MODULE_STRING(DEFAULT_TIDV), ch1010832@1996: .def = DEFAULT_TIDV, ch1010832@1996: .arg = { .r = { .min = MIN_TXDELAY, ch1010832@1996: .max = MAX_TXDELAY }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_TxIntDelay > bd) { ch1010832@1996: adapter->tx_int_delay = TxIntDelay[bd]; ch1010832@1996: e1000_validate_option(&adapter->tx_int_delay, &opt, ch1010832@1996: adapter); ch1010832@1996: } else { ch1010832@1996: adapter->tx_int_delay = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Transmit Absolute Interrupt Delay */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Transmit Absolute Interrupt Delay", ch1010832@1996: .err = "using default of " __MODULE_STRING(DEFAULT_TADV), ch1010832@1996: .def = DEFAULT_TADV, ch1010832@1996: .arg = { .r = { .min = MIN_TXABSDELAY, ch1010832@1996: .max = MAX_TXABSDELAY }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_TxAbsIntDelay > bd) { ch1010832@1996: adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; ch1010832@1996: e1000_validate_option(&adapter->tx_abs_int_delay, &opt, ch1010832@1996: adapter); ch1010832@1996: } else { ch1010832@1996: adapter->tx_abs_int_delay = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Receive Interrupt Delay */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Receive Interrupt Delay", ch1010832@1996: .err = "using default of " __MODULE_STRING(DEFAULT_RDTR), ch1010832@1996: .def = DEFAULT_RDTR, ch1010832@1996: .arg = { .r = { .min = MIN_RXDELAY, ch1010832@1996: .max = MAX_RXDELAY }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_RxIntDelay > bd) { ch1010832@1996: adapter->rx_int_delay = RxIntDelay[bd]; ch1010832@1996: e1000_validate_option(&adapter->rx_int_delay, &opt, ch1010832@1996: adapter); ch1010832@1996: } else { ch1010832@1996: adapter->rx_int_delay = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Receive Absolute Interrupt Delay */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Receive Absolute Interrupt Delay", ch1010832@1996: .err = "using default of " __MODULE_STRING(DEFAULT_RADV), ch1010832@1996: .def = DEFAULT_RADV, ch1010832@1996: .arg = { .r = { .min = MIN_RXABSDELAY, ch1010832@1996: .max = MAX_RXABSDELAY }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_RxAbsIntDelay > bd) { ch1010832@1996: adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; ch1010832@1996: e1000_validate_option(&adapter->rx_abs_int_delay, &opt, ch1010832@1996: adapter); ch1010832@1996: } else { ch1010832@1996: adapter->rx_abs_int_delay = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Interrupt Throttling Rate */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = range_option, ch1010832@1996: .name = "Interrupt Throttling Rate (ints/sec)", ch1010832@1996: .err = "using default of " __MODULE_STRING(DEFAULT_ITR), ch1010832@1996: .def = DEFAULT_ITR, ch1010832@1996: .arg = { .r = { .min = MIN_ITR, ch1010832@1996: .max = MAX_ITR }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_InterruptThrottleRate > bd) { ch1010832@1996: adapter->itr = InterruptThrottleRate[bd]; ch1010832@1996: switch (adapter->itr) { ch1010832@1996: case 0: ch1010832@1996: DPRINTK(PROBE, INFO, "%s turned off\n", ch1010832@1996: opt.name); ch1010832@1996: break; ch1010832@1996: case 1: ch1010832@1996: DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", ch1010832@1996: opt.name); ch1010832@1996: adapter->itr_setting = adapter->itr; ch1010832@1996: adapter->itr = 20000; ch1010832@1996: break; ch1010832@1996: case 3: ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "%s set to dynamic conservative mode\n", ch1010832@1996: opt.name); ch1010832@1996: adapter->itr_setting = adapter->itr; ch1010832@1996: adapter->itr = 20000; ch1010832@1996: break; ch1010832@1996: default: ch1010832@1996: e1000_validate_option(&adapter->itr, &opt, ch1010832@1996: adapter); ch1010832@1996: /* save the setting, because the dynamic bits change itr */ ch1010832@1996: /* clear the lower two bits because they are ch1010832@1996: * used as control */ ch1010832@1996: adapter->itr_setting = adapter->itr & ~3; ch1010832@1996: break; ch1010832@1996: } ch1010832@1996: } else { ch1010832@1996: adapter->itr_setting = opt.def; ch1010832@1996: adapter->itr = 20000; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Smart Power Down */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = enable_option, ch1010832@1996: .name = "PHY Smart Power Down", ch1010832@1996: .err = "defaulting to Disabled", ch1010832@1996: .def = OPTION_DISABLED ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_SmartPowerDownEnable > bd) { ch1010832@1996: unsigned int spd = SmartPowerDownEnable[bd]; ch1010832@1996: e1000_validate_option(&spd, &opt, adapter); ch1010832@1996: adapter->smart_power_down = spd; ch1010832@1996: } else { ch1010832@1996: adapter->smart_power_down = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Kumeran Lock Loss Workaround */ ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = enable_option, ch1010832@1996: .name = "Kumeran Lock Loss Workaround", ch1010832@1996: .err = "defaulting to Enabled", ch1010832@1996: .def = OPTION_ENABLED ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_KumeranLockLoss > bd) { ch1010832@1996: unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; ch1010832@1996: e1000_validate_option(&kmrn_lock_loss, &opt, adapter); ch1010832@1996: adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; ch1010832@1996: } else { ch1010832@1996: adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: ch1010832@1996: switch (adapter->hw.media_type) { ch1010832@1996: case e1000_media_type_fiber: ch1010832@1996: case e1000_media_type_internal_serdes: ch1010832@1996: e1000_check_fiber_options(adapter); ch1010832@1996: break; ch1010832@1996: case e1000_media_type_copper: ch1010832@1996: e1000_check_copper_options(adapter); ch1010832@1996: break; ch1010832@1996: default: ch1010832@1996: BUG(); ch1010832@1996: } ch1010832@1996: } ch1010832@1996: ch1010832@1996: /** ch1010832@1996: * e1000_check_fiber_options - Range Checking for Link Options, Fiber Version ch1010832@1996: * @adapter: board private structure ch1010832@1996: * ch1010832@1996: * Handles speed and duplex options on fiber adapters ch1010832@1996: **/ ch1010832@1996: ch1010832@1996: static void __devinit e1000_check_fiber_options(struct e1000_adapter *adapter) ch1010832@1996: { ch1010832@1996: int bd = adapter->bd_number; ch1010832@1996: if (num_Speed > bd) { ch1010832@1996: DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " ch1010832@1996: "parameter ignored\n"); ch1010832@1996: } ch1010832@1996: ch1010832@1996: if (num_Duplex > bd) { ch1010832@1996: DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " ch1010832@1996: "parameter ignored\n"); ch1010832@1996: } ch1010832@1996: ch1010832@1996: if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { ch1010832@1996: DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " ch1010832@1996: "not valid for fiber adapters, " ch1010832@1996: "parameter ignored\n"); ch1010832@1996: } ch1010832@1996: } ch1010832@1996: ch1010832@1996: /** ch1010832@1996: * e1000_check_copper_options - Range Checking for Link Options, Copper Version ch1010832@1996: * @adapter: board private structure ch1010832@1996: * ch1010832@1996: * Handles speed and duplex options on copper adapters ch1010832@1996: **/ ch1010832@1996: ch1010832@1996: static void __devinit e1000_check_copper_options(struct e1000_adapter *adapter) ch1010832@1996: { ch1010832@1996: struct e1000_option opt; ch1010832@1996: unsigned int speed, dplx, an; ch1010832@1996: int bd = adapter->bd_number; ch1010832@1996: ch1010832@1996: { /* Speed */ ch1010832@1996: static const struct e1000_opt_list speed_list[] = { ch1010832@1996: { 0, "" }, ch1010832@1996: { SPEED_10, "" }, ch1010832@1996: { SPEED_100, "" }, ch1010832@1996: { SPEED_1000, "" }}; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = list_option, ch1010832@1996: .name = "Speed", ch1010832@1996: .err = "parameter ignored", ch1010832@1996: .def = 0, ch1010832@1996: .arg = { .l = { .nr = ARRAY_SIZE(speed_list), ch1010832@1996: .p = speed_list }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_Speed > bd) { ch1010832@1996: speed = Speed[bd]; ch1010832@1996: e1000_validate_option(&speed, &opt, adapter); ch1010832@1996: } else { ch1010832@1996: speed = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: { /* Duplex */ ch1010832@1996: static const struct e1000_opt_list dplx_list[] = { ch1010832@1996: { 0, "" }, ch1010832@1996: { HALF_DUPLEX, "" }, ch1010832@1996: { FULL_DUPLEX, "" }}; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = list_option, ch1010832@1996: .name = "Duplex", ch1010832@1996: .err = "parameter ignored", ch1010832@1996: .def = 0, ch1010832@1996: .arg = { .l = { .nr = ARRAY_SIZE(dplx_list), ch1010832@1996: .p = dplx_list }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (e1000_check_phy_reset_block(&adapter->hw)) { ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "Link active due to SoL/IDER Session. " ch1010832@1996: "Speed/Duplex/AutoNeg parameter ignored.\n"); ch1010832@1996: return; ch1010832@1996: } ch1010832@1996: if (num_Duplex > bd) { ch1010832@1996: dplx = Duplex[bd]; ch1010832@1996: e1000_validate_option(&dplx, &opt, adapter); ch1010832@1996: } else { ch1010832@1996: dplx = opt.def; ch1010832@1996: } ch1010832@1996: } ch1010832@1996: ch1010832@1996: if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "AutoNeg specified along with Speed or Duplex, " ch1010832@1996: "parameter ignored\n"); ch1010832@1996: adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT; ch1010832@1996: } else { /* Autoneg */ ch1010832@1996: static const struct e1000_opt_list an_list[] = ch1010832@1996: #define AA "AutoNeg advertising " ch1010832@1996: {{ 0x01, AA "10/HD" }, ch1010832@1996: { 0x02, AA "10/FD" }, ch1010832@1996: { 0x03, AA "10/FD, 10/HD" }, ch1010832@1996: { 0x04, AA "100/HD" }, ch1010832@1996: { 0x05, AA "100/HD, 10/HD" }, ch1010832@1996: { 0x06, AA "100/HD, 10/FD" }, ch1010832@1996: { 0x07, AA "100/HD, 10/FD, 10/HD" }, ch1010832@1996: { 0x08, AA "100/FD" }, ch1010832@1996: { 0x09, AA "100/FD, 10/HD" }, ch1010832@1996: { 0x0a, AA "100/FD, 10/FD" }, ch1010832@1996: { 0x0b, AA "100/FD, 10/FD, 10/HD" }, ch1010832@1996: { 0x0c, AA "100/FD, 100/HD" }, ch1010832@1996: { 0x0d, AA "100/FD, 100/HD, 10/HD" }, ch1010832@1996: { 0x0e, AA "100/FD, 100/HD, 10/FD" }, ch1010832@1996: { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" }, ch1010832@1996: { 0x20, AA "1000/FD" }, ch1010832@1996: { 0x21, AA "1000/FD, 10/HD" }, ch1010832@1996: { 0x22, AA "1000/FD, 10/FD" }, ch1010832@1996: { 0x23, AA "1000/FD, 10/FD, 10/HD" }, ch1010832@1996: { 0x24, AA "1000/FD, 100/HD" }, ch1010832@1996: { 0x25, AA "1000/FD, 100/HD, 10/HD" }, ch1010832@1996: { 0x26, AA "1000/FD, 100/HD, 10/FD" }, ch1010832@1996: { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" }, ch1010832@1996: { 0x28, AA "1000/FD, 100/FD" }, ch1010832@1996: { 0x29, AA "1000/FD, 100/FD, 10/HD" }, ch1010832@1996: { 0x2a, AA "1000/FD, 100/FD, 10/FD" }, ch1010832@1996: { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" }, ch1010832@1996: { 0x2c, AA "1000/FD, 100/FD, 100/HD" }, ch1010832@1996: { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" }, ch1010832@1996: { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" }, ch1010832@1996: { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }}; ch1010832@1996: ch1010832@1996: opt = (struct e1000_option) { ch1010832@1996: .type = list_option, ch1010832@1996: .name = "AutoNeg", ch1010832@1996: .err = "parameter ignored", ch1010832@1996: .def = AUTONEG_ADV_DEFAULT, ch1010832@1996: .arg = { .l = { .nr = ARRAY_SIZE(an_list), ch1010832@1996: .p = an_list }} ch1010832@1996: }; ch1010832@1996: ch1010832@1996: if (num_AutoNeg > bd) { ch1010832@1996: an = AutoNeg[bd]; ch1010832@1996: e1000_validate_option(&an, &opt, adapter); ch1010832@1996: } else { ch1010832@1996: an = opt.def; ch1010832@1996: } ch1010832@1996: adapter->hw.autoneg_advertised = an; ch1010832@1996: } ch1010832@1996: ch1010832@1996: switch (speed + dplx) { ch1010832@1996: case 0: ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: if ((num_Speed > bd) && (speed != 0 || dplx != 0)) ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "Speed and duplex autonegotiation enabled\n"); ch1010832@1996: break; ch1010832@1996: case HALF_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Half Duplex specified without Speed\n"); ch1010832@1996: DPRINTK(PROBE, INFO, "Using Autonegotiation at " ch1010832@1996: "Half Duplex only\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ch1010832@1996: ADVERTISE_100_HALF; ch1010832@1996: break; ch1010832@1996: case FULL_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Full Duplex specified without Speed\n"); ch1010832@1996: DPRINTK(PROBE, INFO, "Using Autonegotiation at " ch1010832@1996: "Full Duplex only\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: adapter->hw.autoneg_advertised = ADVERTISE_10_FULL | ch1010832@1996: ADVERTISE_100_FULL | ch1010832@1996: ADVERTISE_1000_FULL; ch1010832@1996: break; ch1010832@1996: case SPEED_10: ch1010832@1996: DPRINTK(PROBE, INFO, "10 Mbps Speed specified " ch1010832@1996: "without Duplex\n"); ch1010832@1996: DPRINTK(PROBE, INFO, "Using Autonegotiation at 10 Mbps only\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: adapter->hw.autoneg_advertised = ADVERTISE_10_HALF | ch1010832@1996: ADVERTISE_10_FULL; ch1010832@1996: break; ch1010832@1996: case SPEED_10 + HALF_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Half Duplex\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 0; ch1010832@1996: adapter->hw.forced_speed_duplex = e1000_10_half; ch1010832@1996: adapter->hw.autoneg_advertised = 0; ch1010832@1996: break; ch1010832@1996: case SPEED_10 + FULL_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Forcing to 10 Mbps Full Duplex\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 0; ch1010832@1996: adapter->hw.forced_speed_duplex = e1000_10_full; ch1010832@1996: adapter->hw.autoneg_advertised = 0; ch1010832@1996: break; ch1010832@1996: case SPEED_100: ch1010832@1996: DPRINTK(PROBE, INFO, "100 Mbps Speed specified " ch1010832@1996: "without Duplex\n"); ch1010832@1996: DPRINTK(PROBE, INFO, "Using Autonegotiation at " ch1010832@1996: "100 Mbps only\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: adapter->hw.autoneg_advertised = ADVERTISE_100_HALF | ch1010832@1996: ADVERTISE_100_FULL; ch1010832@1996: break; ch1010832@1996: case SPEED_100 + HALF_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Half Duplex\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 0; ch1010832@1996: adapter->hw.forced_speed_duplex = e1000_100_half; ch1010832@1996: adapter->hw.autoneg_advertised = 0; ch1010832@1996: break; ch1010832@1996: case SPEED_100 + FULL_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, "Forcing to 100 Mbps Full Duplex\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 0; ch1010832@1996: adapter->hw.forced_speed_duplex = e1000_100_full; ch1010832@1996: adapter->hw.autoneg_advertised = 0; ch1010832@1996: break; ch1010832@1996: case SPEED_1000: ch1010832@1996: DPRINTK(PROBE, INFO, "1000 Mbps Speed specified without " ch1010832@1996: "Duplex\n"); ch1010832@1996: goto full_duplex_only; ch1010832@1996: case SPEED_1000 + HALF_DUPLEX: ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "Half Duplex is not supported at 1000 Mbps\n"); ch1010832@1996: /* fall through */ ch1010832@1996: case SPEED_1000 + FULL_DUPLEX: ch1010832@1996: full_duplex_only: ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "Using Autonegotiation at 1000 Mbps Full Duplex only\n"); ch1010832@1996: adapter->hw.autoneg = adapter->fc_autoneg = 1; ch1010832@1996: adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL; ch1010832@1996: break; ch1010832@1996: default: ch1010832@1996: BUG(); ch1010832@1996: } ch1010832@1996: ch1010832@1996: /* Speed, AutoNeg and MDI/MDI-X must all play nice */ ch1010832@1996: if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) { ch1010832@1996: DPRINTK(PROBE, INFO, ch1010832@1996: "Speed, AutoNeg and MDI-X specifications are " ch1010832@1996: "incompatible. Setting MDI-X to a compatible value.\n"); ch1010832@1996: } ch1010832@1996: } ch1010832@1996: