35 #define E1000_MAX_NIC 32
37 #define OPTION_UNSET -1
38 #define OPTION_DISABLED 0
39 #define OPTION_ENABLED 1
46 #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
47 #define E1000_PARAM(X, desc) \
48 static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
49 static unsigned int num_##X; \
50 module_param_array_named(X, X, int, &num_##X, 0); \
51 MODULE_PARM_DESC(X, desc);
60 E1000_PARAM(TxDescriptors,
"Number of transmit descriptors");
69 E1000_PARAM(RxDescriptors,
"Number of receive descriptors");
108 E1000_PARAM(AutoNeg,
"Advertised auto-negotiation setting");
109 #define AUTONEG_ADV_DEFAULT 0x2F
110 #define AUTONEG_ADV_MASK 0x2F
123 #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
134 E1000_PARAM(XsumRX,
"Disable or enable Receive Checksum offload");
141 E1000_PARAM(TxIntDelay,
"Transmit Interrupt Delay");
142 #define DEFAULT_TIDV 8
143 #define MAX_TXDELAY 0xFFFF
144 #define MIN_TXDELAY 0
150 E1000_PARAM(TxAbsIntDelay,
"Transmit Absolute Interrupt Delay");
151 #define DEFAULT_TADV 32
152 #define MAX_TXABSDELAY 0xFFFF
153 #define MIN_TXABSDELAY 0
160 E1000_PARAM(RxIntDelay,
"Receive Interrupt Delay");
161 #define DEFAULT_RDTR 0
162 #define MAX_RXDELAY 0xFFFF
163 #define MIN_RXDELAY 0
169 E1000_PARAM(RxAbsIntDelay,
"Receive Absolute Interrupt Delay");
170 #define DEFAULT_RADV 8
171 #define MAX_RXABSDELAY 0xFFFF
172 #define MIN_RXABSDELAY 0
178 E1000_PARAM(InterruptThrottleRate,
"Interrupt Throttling Rate");
179 #define DEFAULT_ITR 3
180 #define MAX_ITR 100000
189 E1000_PARAM(SmartPowerDownEnable,
"Enable PHY smart power down");
203 const struct e1000_opt_list {
int i;
char *
str; } *
p;
229 if (*value >= opt->
arg.
r.min && *value <= opt->
arg.r.max) {
236 const struct e1000_opt_list *
ent;
238 for (i = 0; i < opt->
arg.
l.nr; i++) {
239 ent = &opt->
arg.
l.p[
i];
240 if (*value == ent->i) {
241 if (ent->str[0] !=
'\0')
252 e_dev_info(
"Invalid %s value specified (%i) %s\n",
258 static void e1000_check_fiber_options(
struct e1000_adapter *adapter);
259 static void e1000_check_copper_options(
struct e1000_adapter *adapter);
277 e_dev_warn(
"Warning: no configuration for board #%i "
278 "using defaults for all values\n", bd);
288 .name =
"Transmit Descriptors",
289 .err =
"using default of "
298 if (num_TxDescriptors > bd) {
299 tx_ring->
count = TxDescriptors[bd];
300 e1000_validate_option(&tx_ring->
count, &opt, adapter);
316 .name =
"Receive Descriptors",
317 .err =
"using default of "
326 if (num_RxDescriptors > bd) {
327 rx_ring->
count = RxDescriptors[bd];
328 e1000_validate_option(&rx_ring->
count, &opt, adapter);
340 .name =
"Checksum Offload",
341 .err =
"defaulting to Enabled",
345 if (num_XsumRX > bd) {
346 unsigned int rx_csum = XsumRX[bd];
347 e1000_validate_option(&rx_csum, &opt, adapter);
355 static const struct e1000_opt_list fc_list[] = {
365 .name =
"Flow Control",
366 .err =
"reading default settings from EEPROM",
372 if (num_FlowControl > bd) {
374 e1000_validate_option(&fc, &opt, adapter);
375 adapter->
hw.fc = adapter->
hw.original_fc =
fc;
377 adapter->
hw.fc = adapter->
hw.original_fc = opt.
def;
383 .name =
"Transmit Interrupt Delay",
390 if (num_TxIntDelay > bd) {
401 .name =
"Transmit Absolute Interrupt Delay",
408 if (num_TxAbsIntDelay > bd) {
419 .name =
"Receive Interrupt Delay",
426 if (num_RxIntDelay > bd) {
437 .name =
"Receive Absolute Interrupt Delay",
444 if (num_RxAbsIntDelay > bd) {
455 .name =
"Interrupt Throttling Rate (ints/sec)",
458 .arg = { .r = { .min =
MIN_ITR,
462 if (num_InterruptThrottleRate > bd) {
463 adapter->
itr = InterruptThrottleRate[bd];
464 switch (adapter->
itr) {
472 adapter->
itr = 20000;
478 adapter->
itr = 20000;
482 "(2000-8000) ints mode\n", opt.
name);
486 e1000_validate_option(&adapter->
itr, &opt,
497 adapter->
itr = 20000;
503 .name =
"PHY Smart Power Down",
504 .err =
"defaulting to Disabled",
508 if (num_SmartPowerDownEnable > bd) {
509 unsigned int spd = SmartPowerDownEnable[bd];
510 e1000_validate_option(&spd, &opt, adapter);
517 switch (adapter->
hw.media_type) {
520 e1000_check_fiber_options(adapter);
523 e1000_check_copper_options(adapter);
540 if (num_Speed > bd) {
541 e_dev_info(
"Speed not valid for fiber adapters, parameter "
545 if (num_Duplex > bd) {
546 e_dev_info(
"Duplex not valid for fiber adapters, parameter "
550 if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
551 e_dev_info(
"AutoNeg other than 1000/Full is not valid for fiber"
552 "adapters, parameter ignored\n");
566 unsigned int speed, dplx, an;
570 static const struct e1000_opt_list speed_list[] = {
579 .err =
"parameter ignored",
585 if (num_Speed > bd) {
587 e1000_validate_option(&speed, &opt, adapter);
593 static const struct e1000_opt_list dplx_list[] = {
601 .err =
"parameter ignored",
607 if (num_Duplex > bd) {
609 e1000_validate_option(&dplx, &opt, adapter);
615 if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
616 e_dev_info(
"AutoNeg specified along with Speed or Duplex, "
617 "parameter ignored\n");
620 static const struct e1000_opt_list an_list[] =
621 #define AA "AutoNeg advertising "
622 {{ 0x01,
AA "10/HD" },
623 { 0x02,
AA "10/FD" },
624 { 0x03,
AA "10/FD, 10/HD" },
625 { 0x04,
AA "100/HD" },
626 { 0x05,
AA "100/HD, 10/HD" },
627 { 0x06,
AA "100/HD, 10/FD" },
628 { 0x07,
AA "100/HD, 10/FD, 10/HD" },
629 { 0x08,
AA "100/FD" },
630 { 0x09,
AA "100/FD, 10/HD" },
631 { 0x0a,
AA "100/FD, 10/FD" },
632 { 0x0b,
AA "100/FD, 10/FD, 10/HD" },
633 { 0x0c,
AA "100/FD, 100/HD" },
634 { 0x0d,
AA "100/FD, 100/HD, 10/HD" },
635 { 0x0e,
AA "100/FD, 100/HD, 10/FD" },
636 { 0x0f,
AA "100/FD, 100/HD, 10/FD, 10/HD" },
637 { 0x20,
AA "1000/FD" },
638 { 0x21,
AA "1000/FD, 10/HD" },
639 { 0x22,
AA "1000/FD, 10/FD" },
640 { 0x23,
AA "1000/FD, 10/FD, 10/HD" },
641 { 0x24,
AA "1000/FD, 100/HD" },
642 { 0x25,
AA "1000/FD, 100/HD, 10/HD" },
643 { 0x26,
AA "1000/FD, 100/HD, 10/FD" },
644 { 0x27,
AA "1000/FD, 100/HD, 10/FD, 10/HD" },
645 { 0x28,
AA "1000/FD, 100/FD" },
646 { 0x29,
AA "1000/FD, 100/FD, 10/HD" },
647 { 0x2a,
AA "1000/FD, 100/FD, 10/FD" },
648 { 0x2b,
AA "1000/FD, 100/FD, 10/FD, 10/HD" },
649 { 0x2c,
AA "1000/FD, 100/FD, 100/HD" },
650 { 0x2d,
AA "1000/FD, 100/FD, 100/HD, 10/HD" },
651 { 0x2e,
AA "1000/FD, 100/FD, 100/HD, 10/FD" },
652 { 0x2f,
AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
657 .err =
"parameter ignored",
663 if (num_AutoNeg > bd) {
665 e1000_validate_option(&an, &opt, adapter);
669 adapter->
hw.autoneg_advertised = an;
672 switch (speed + dplx) {
675 if ((num_Speed > bd) && (speed != 0 || dplx != 0))
676 e_dev_info(
"Speed and duplex autonegotiation "
680 e_dev_info(
"Half Duplex specified without Speed\n");
681 e_dev_info(
"Using Autonegotiation at Half Duplex only\n");
687 e_dev_info(
"Full Duplex specified without Speed\n");
688 e_dev_info(
"Using Autonegotiation at Full Duplex only\n");
695 e_dev_info(
"10 Mbps Speed specified without Duplex\n");
696 e_dev_info(
"Using Autonegotiation at 10 Mbps only\n");
702 e_dev_info(
"Forcing to 10 Mbps Half Duplex\n");
705 adapter->
hw.autoneg_advertised = 0;
708 e_dev_info(
"Forcing to 10 Mbps Full Duplex\n");
711 adapter->
hw.autoneg_advertised = 0;
714 e_dev_info(
"100 Mbps Speed specified without Duplex\n");
715 e_dev_info(
"Using Autonegotiation at 100 Mbps only\n");
721 e_dev_info(
"Forcing to 100 Mbps Half Duplex\n");
724 adapter->
hw.autoneg_advertised = 0;
727 e_dev_info(
"Forcing to 100 Mbps Full Duplex\n");
730 adapter->
hw.autoneg_advertised = 0;
733 e_dev_info(
"1000 Mbps Speed specified without Duplex\n");
734 goto full_duplex_only;
736 e_dev_info(
"Half Duplex is not supported at 1000 Mbps\n");
740 e_dev_info(
"Using Autonegotiation at 1000 Mbps Full Duplex "
751 e_dev_info(
"Speed, AutoNeg and MDI-X specs are incompatible. "
752 "Setting MDI-X to a compatible value.\n");