29 #include <linux/netdevice.h>
30 #include <linux/module.h>
31 #include <linux/pci.h>
40 #define E1000_MAX_NIC 32
42 #define OPTION_UNSET -1
43 #define OPTION_DISABLED 0
44 #define OPTION_ENABLED 1
46 #define COPYBREAK_DEFAULT 256
50 "Maximum size of packet that is copied to a new buffer on receive");
58 #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
59 #define E1000_PARAM(X, desc) \
60 static int __devinitdata X[E1000_MAX_NIC+1] \
62 static unsigned int num_##X; \
63 module_param_array_named(X, X, int, &num_##X, 0); \
64 MODULE_PARM_DESC(X, desc);
72 E1000_PARAM(TxIntDelay,
"Transmit Interrupt Delay");
73 #define DEFAULT_TIDV 8
74 #define MAX_TXDELAY 0xFFFF
82 E1000_PARAM(TxAbsIntDelay,
"Transmit Absolute Interrupt Delay");
83 #define DEFAULT_TADV 32
84 #define MAX_TXABSDELAY 0xFFFF
85 #define MIN_TXABSDELAY 0
94 #define MAX_RXDELAY 0xFFFF
102 E1000_PARAM(RxAbsIntDelay,
"Receive Absolute Interrupt Delay");
103 #define MAX_RXABSDELAY 0xFFFF
104 #define MIN_RXABSDELAY 0
111 E1000_PARAM(InterruptThrottleRate,
"Interrupt Throttling Rate");
112 #define DEFAULT_ITR 3
113 #define MAX_ITR 100000
132 #define MAX_INTMODE 2
133 #define MIN_INTMODE 0
142 E1000_PARAM(SmartPowerDownEnable,
"Enable PHY smart power down");
151 E1000_PARAM(KumeranLockLoss,
"Enable Kumeran lock loss workaround");
160 E1000_PARAM(WriteProtectNVM,
"Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
170 "Enable CRC Stripping, disable if your BMC needs the CRC");
184 struct e1000_opt_list {
int i;
char *
str; } *
p;
212 if (*value >= opt->
arg.
r.min && *value <= opt->
arg.r.max) {
220 struct e1000_opt_list *
ent;
222 for (i = 0; i < opt->
arg.
l.nr; i++) {
223 ent = &opt->
arg.
l.p[
i];
224 if (*value == ent->i) {
225 if (ent->str[0] !=
'\0')
237 dev_info(&adapter->
pdev->dev,
"Invalid %s value specified (%i) %s\n",
258 dev_notice(&adapter->
pdev->dev,
259 "Warning: no configuration for board #%i\n", bd);
260 dev_notice(&adapter->
pdev->dev,
261 "Using defaults for all values\n");
267 .name =
"Transmit Interrupt Delay",
268 .err =
"using default of "
275 if (num_TxIntDelay > bd) {
286 .name =
"Transmit Absolute Interrupt Delay",
287 .err =
"using default of "
294 if (num_TxAbsIntDelay > bd) {
305 .name =
"Receive Interrupt Delay",
306 .err =
"using default of "
313 if (num_RxIntDelay > bd) {
324 .name =
"Receive Absolute Interrupt Delay",
325 .err =
"using default of "
332 if (num_RxAbsIntDelay > bd) {
343 .name =
"Interrupt Throttling Rate (ints/sec)",
344 .err =
"using default of "
347 .arg = { .r = { .min =
MIN_ITR,
351 if (num_InterruptThrottleRate > bd) {
352 adapter->
itr = InterruptThrottleRate[bd];
360 if ((adapter->
itr > 4) &&
361 e1000_validate_option(&adapter->
itr, &opt, adapter))
374 if (adapter->
itr > 4)
376 "%s set to default %d\n", opt.
name,
381 switch (adapter->
itr) {
388 "%s set to dynamic mode\n", opt.
name);
389 adapter->
itr = 20000;
393 "%s set to dynamic conservative mode\n",
395 adapter->
itr = 20000;
399 "%s set to simplified (2000-8000 ints) mode\n",
417 .name =
"Interrupt Mode",
418 #ifndef CONFIG_PCI_MSI
419 .err =
"defaulting to 0 (legacy)",
421 .arg = { .r = { .min = 0,
426 #ifdef CONFIG_PCI_MSI
440 "Failed to allocate memory\n");
445 if (num_IntMode > bd) {
446 unsigned int int_mode = IntMode[bd];
447 e1000_validate_option(&int_mode, &opt, adapter);
453 #ifdef CONFIG_PCI_MSI
460 .name =
"PHY Smart Power Down",
461 .err =
"defaulting to Disabled",
465 if (num_SmartPowerDownEnable > bd) {
466 unsigned int spd = SmartPowerDownEnable[bd];
467 e1000_validate_option(&spd, &opt, adapter);
476 .name =
"CRC Stripping",
477 .err =
"defaulting to Enabled",
481 if (num_CrcStripping > bd) {
482 unsigned int crc_stripping = CrcStripping[bd];
483 e1000_validate_option(&crc_stripping, &opt, adapter);
496 .name =
"Kumeran Lock Loss Workaround",
497 .err =
"defaulting to Enabled",
501 if (num_KumeranLockLoss > bd) {
502 unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
503 e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
516 .name =
"Write-protect NVM",
517 .err =
"defaulting to Enabled",
522 if (num_WriteProtectNVM > bd) {
523 unsigned int write_protect_nvm = WriteProtectNVM[bd];
524 e1000_validate_option(&write_protect_nvm, &opt,
526 if (write_protect_nvm)