/*******************************************************************************
- Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
+ Copyright(c) 1999 - 2004 Intel Corporation. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Contact Information:
Linux NICS <linux.nics@intel.com>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
*******************************************************************************/
#include "ixgb.h"
* maximum number of ports that the driver can manage.
*/
-#define IXGB_MAX_NIC 8
+#define IXGB_MAX_NIC 8
-#define OPTION_UNSET -1
-#define OPTION_DISABLED 0
-#define OPTION_ENABLED 1
+#define OPTION_UNSET -1
+#define OPTION_DISABLED 0
+#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
IXGB_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
-/* XsumTX - Transmit Checksum Offload Enable/Disable
+/* Transmit Interrupt Delay in units of 0.8192 microseconds
*
- * Valid Range: 0, 1
- * - 0 - disables all checksum offload
- * - 1 - enables transmmit IP/TCP/UDP checksum offload
- * on 82597 based NICs
+ * Valid Range: 0-65535
*
- * Default Value: 1
+ * Default Value: 32
*/
-IXGB_PARAM(XsumTX, "Disable or enable Transmit Checksum offload");
+IXGB_PARAM(TxIntDelay, "Transmit Interrupt Delay");
/* Receive Interrupt Delay in units of 0.8192 microseconds
*
IXGB_PARAM(FCReqTimeout, "Flow Control Request Timeout");
-/* Transmit Interrupt Delay in units of 0.8192 microseconds
- *
- * Valid Range: 0-65535
- *
- * Default Value: 32
- */
-
-IXGB_PARAM(TxIntDelay, "Transmit Interrupt Delay");
-
/* Interrupt Delay Enable
*
* Valid Range: 0, 1
#define DEFAULT_TXD 256
#define MAX_TXD 4096
#define MIN_TXD 64
+
#define DEFAULT_RXD 1024
#define MAX_RXD 4096
#define MIN_RXD 64
-#define DEFAULT_TIDV 32
-#define MAX_TIDV 0xFFFF
+
+#define DEFAULT_TIDV 32
+#define MAX_TIDV 0xFFFF
#define MIN_TIDV 0
-#define DEFAULT_RDTR 72
+
+#define DEFAULT_RDTR 72
#define MAX_RDTR 0xFFFF
#define MIN_RDTR 0
+
#define XSUMRX_DEFAULT OPTION_ENABLED
+
#define FLOW_CONTROL_FULL ixgb_fc_full
#define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
-#define DEFAULT_FCRTL 0x28000
+#define DEFAULT_FCRTL 0x28000
#define DEFAULT_FCRTH 0x30000
#define MIN_FCRTL 0
#define MAX_FCRTL 0x3FFE8
#define MIN_FCRTH 8
#define MAX_FCRTH 0x3FFF0
-#define DEFAULT_FCPAUSE 0x100
+
+#define DEFAULT_FCPAUSE 0x100 /* this may be too long */
#define MIN_FCPAUSE 1
#define MAX_FCPAUSE 0xffff
char *err;
int def;
union {
- struct { /* range option information */
+ struct { /* range_option info */
int min;
int max;
} r;
- struct { /* list option information */
+ struct { /* list_option info */
int nr;
struct ixgb_opt_list {
int i;
} arg;
};
-static int __devinit
-ixgb_validate_option(int *value, struct ixgb_option *opt)
+static int __devinit ixgb_validate_option(int *value, struct ixgb_option *opt)
{
if (*value == OPTION_UNSET) {
*value = opt->def;
return 0;
}
break;
- case list_option:
- {
+ case list_option:{
int i;
struct ixgb_opt_list *ent;
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
- printk(KERN_INFO "%s",
+ printk(KERN_INFO "%s\n",
ent->str);
return 0;
}
BUG();
}
- printk(KERN_INFO "Invalid %s specified (%i) %s\n", opt->name, *value,
- opt->err);
+ printk(KERN_INFO "Invalid %s specified (%i) %s\n",
+ opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
* ixgb_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
- * This routine checks all command line paramters for valid user
+ * This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
-void __devinit
-ixgb_check_options(struct ixgb_adapter *adapter)
+void __devinit ixgb_check_options(struct ixgb_adapter *adapter)
{
- int board = adapter->bd_number;
-
- IXGB_DBG("ixgb_check_options\n");
-
- if (board >= IXGB_MAX_NIC) {
- printk(KERN_NOTICE "Warning: no configuration for board #%i\n",
- board);
+ int bd = adapter->bd_number;
+ if (bd >= IXGB_MAX_NIC) {
+ printk(KERN_NOTICE
+ "Warning: no configuration for board #%i\n", bd);
printk(KERN_NOTICE "Using defaults for all values\n");
- board = IXGB_MAX_NIC;
+ bd = IXGB_MAX_NIC;
}
{ /* Transmit Descriptor Count */
.name = "Transmit Descriptors",
.err = "using default of " __MODULE_STRING(DEFAULT_TXD),
.def = DEFAULT_TXD,
- .arg = {.r = {.min = MIN_TXD,.max = MAX_TXD}}
+ .arg = {.r = {.min = MIN_TXD,
+ .max = MAX_TXD}}
};
struct ixgb_desc_ring *tx_ring = &adapter->tx_ring;
- tx_ring->count = TxDescriptors[board];
+ tx_ring->count = TxDescriptors[bd];
ixgb_validate_option(&tx_ring->count, &opt);
IXGB_ROUNDUP(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
}
-
{ /* Receive Descriptor Count */
struct ixgb_option opt = {
.type = range_option,
.name = "Receive Descriptors",
.err = "using default of " __MODULE_STRING(DEFAULT_RXD),
.def = DEFAULT_RXD,
- .arg = {.r = {.min = MIN_RXD,.max = MAX_RXD}}
+ .arg = {.r = {.min = MIN_RXD,
+ .max = MAX_RXD}}
};
struct ixgb_desc_ring *rx_ring = &adapter->rx_ring;
- rx_ring->count = RxDescriptors[board];
+ rx_ring->count = RxDescriptors[bd];
ixgb_validate_option(&rx_ring->count, &opt);
IXGB_ROUNDUP(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
}
-
{ /* Receive Checksum Offload Enable */
struct ixgb_option opt = {
.type = enable_option,
.name = "Receive Checksum Offload",
.err = "defaulting to Enabled",
- .def = OPTION_ENABLED,
+ .def = OPTION_ENABLED
};
- int rx_csum = XsumRX[board];
+ int rx_csum = XsumRX[bd];
ixgb_validate_option(&rx_csum, &opt);
adapter->rx_csum = rx_csum;
}
-
- { /* Transmit Checksum Offload Enable */
- struct ixgb_option opt = {
- .type = enable_option,
- .name = "Transmit Checksum Offload",
- .err = "defaulting to Enabled",
- .def = OPTION_ENABLED,
- };
- int tx_csum = XsumTX[board];
-
- ixgb_validate_option(&tx_csum, &opt);
- adapter->tx_csum = tx_csum;
- }
-
{ /* Flow Control */
- struct ixgb_opt_list fc_list[] = {
- {ixgb_fc_none, "Flow Control Disabled\n"},
- {ixgb_fc_rx_pause, "Flow Control Receive Only\n"},
- {ixgb_fc_tx_pause, "Flow Control Transmit Only\n"},
- {ixgb_fc_full, "Flow Control Enabled\n"},
- {ixgb_fc_default, "Flow Control Hardware Default\n"}
+
+ struct ixgb_opt_list fc_list[] =
+ { {ixgb_fc_none, "Flow Control Disabled"},
+ {ixgb_fc_rx_pause, "Flow Control Receive Only"},
+ {ixgb_fc_tx_pause, "Flow Control Transmit Only"},
+ {ixgb_fc_full, "Flow Control Enabled"},
+ {ixgb_fc_default, "Flow Control Hardware Default"}
};
struct ixgb_option opt = {
.name = "Flow Control",
.err = "reading default settings from EEPROM",
.def = ixgb_fc_full,
- .arg = {.l = {.nr = LIST_LEN(fc_list),.p = fc_list}}
+ .arg = {.l = {.nr = LIST_LEN(fc_list),
+ .p = fc_list}}
};
- int fc = FlowControl[board];
-
+ int fc = FlowControl[bd];
ixgb_validate_option(&fc, &opt);
adapter->hw.fc.type = fc;
}
{ /* Receive Flow Control High Threshold */
- struct ixgb_option fcrth = {
+ struct ixgb_option opt = {
.type = range_option,
.name = "Rx Flow Control High Threshold",
.err =
"using default of " __MODULE_STRING(DEFAULT_FCRTH),
.def = DEFAULT_FCRTH,
- .arg = {.r = {.min = MIN_FCRTH,.max = MAX_FCRTH}}
+ .arg = {.r = {.min = MIN_FCRTH,
+ .max = MAX_FCRTH}}
};
- adapter->hw.fc.high_water = RxFCHighThresh[board];
- ixgb_validate_option(&adapter->hw.fc.high_water, &fcrth);
+ adapter->hw.fc.high_water = RxFCHighThresh[bd];
+ ixgb_validate_option(&adapter->hw.fc.high_water, &opt);
if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
printk(KERN_INFO
"Ignoring RxFCHighThresh when no RxFC\n");
}
{ /* Receive Flow Control Low Threshold */
- struct ixgb_option fcrtl = {
+ struct ixgb_option opt = {
.type = range_option,
.name = "Rx Flow Control Low Threshold",
.err =
"using default of " __MODULE_STRING(DEFAULT_FCRTL),
.def = DEFAULT_FCRTL,
- .arg = {.r = {.min = MIN_FCRTL,.max = MAX_FCRTL}}
+ .arg = {.r = {.min = MIN_FCRTL,
+ .max = MAX_FCRTL}}
};
- adapter->hw.fc.low_water = RxFCLowThresh[board];
- ixgb_validate_option(&adapter->hw.fc.low_water, &fcrtl);
+ adapter->hw.fc.low_water = RxFCLowThresh[bd];
+ ixgb_validate_option(&adapter->hw.fc.low_water, &opt);
if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
printk(KERN_INFO
"Ignoring RxFCLowThresh when no RxFC\n");
}
{ /* Flow Control Pause Time Request */
- struct ixgb_option fcpap = {
+ struct ixgb_option opt = {
.type = range_option,
.name = "Flow Control Pause Time Request",
.err =
"using default of "
__MODULE_STRING(DEFAULT_FCPAUSE),
.def = DEFAULT_FCPAUSE,
- .arg = {.r = {.min = MIN_FCPAUSE,.max = MAX_FCPAUSE}}
+ .arg = {.r = {.min = MIN_FCPAUSE,
+ .max = MAX_FCPAUSE}}
};
- int pause_time = FCReqTimeout[board];
+ int pause_time = FCReqTimeout[bd];
- ixgb_validate_option(&pause_time, &fcpap);
+ ixgb_validate_option(&pause_time, &opt);
if (!(adapter->hw.fc.type & ixgb_fc_rx_pause))
printk(KERN_INFO
"Ignoring FCReqTimeout when no RxFC\n");
.err =
"using default of " __MODULE_STRING(DEFAULT_RDTR),
.def = DEFAULT_RDTR,
- .arg = {.r = {.min = MIN_RDTR,.max = MAX_RDTR}}
+ .arg = {.r = {.min = MIN_RDTR,
+ .max = MAX_RDTR}}
};
- adapter->rx_int_delay = RxIntDelay[board];
+ adapter->rx_int_delay = RxIntDelay[bd];
ixgb_validate_option(&adapter->rx_int_delay, &opt);
}
{ /* Receive Interrupt Moderation */
.type = enable_option,
.name = "Advanced Receive Interrupt Moderation",
.err = "defaulting to Enabled",
- .def = OPTION_ENABLED,
+ .def = OPTION_ENABLED
};
- int raidc = RAIDC[board];
+ int raidc = RAIDC[bd];
ixgb_validate_option(&raidc, &opt);
adapter->raidc = raidc;
}
-
{ /* Transmit Interrupt Delay */
struct ixgb_option opt = {
.type = range_option,
.err =
"using default of " __MODULE_STRING(DEFAULT_TIDV),
.def = DEFAULT_TIDV,
- .arg = {.r = {.min = MIN_TIDV,.max = MAX_TIDV}}
+ .arg = {.r = {.min = MIN_TIDV,
+ .max = MAX_TIDV}}
};
- adapter->tx_int_delay = TxIntDelay[board];
+ adapter->tx_int_delay = TxIntDelay[bd];
ixgb_validate_option(&adapter->tx_int_delay, &opt);
}
.type = enable_option,
.name = "Tx Interrupt Delay Enable",
.err = "defaulting to Enabled",
- .def = OPTION_ENABLED,
+ .def = OPTION_ENABLED
};
- int ide = IntDelayEnable[board];
+ int ide = IntDelayEnable[bd];
ixgb_validate_option(&ide, &opt);
adapter->tx_int_delay_enable = ide;