diff options
Diffstat (limited to 'drivers/net/e1000/e1000_param.c')
-rw-r--r-- | drivers/net/e1000/e1000_param.c | 161 |
1 files changed, 110 insertions, 51 deletions
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c index 0ef413172c68..212842738972 100644 --- a/drivers/net/e1000/e1000_param.c +++ b/drivers/net/e1000/e1000_param.c | |||
@@ -324,7 +324,6 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
324 | DPRINTK(PROBE, NOTICE, | 324 | DPRINTK(PROBE, NOTICE, |
325 | "Warning: no configuration for board #%i\n", bd); | 325 | "Warning: no configuration for board #%i\n", bd); |
326 | DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); | 326 | DPRINTK(PROBE, NOTICE, "Using defaults for all values\n"); |
327 | bd = E1000_MAX_NIC; | ||
328 | } | 327 | } |
329 | 328 | ||
330 | { /* Transmit Descriptor Count */ | 329 | { /* Transmit Descriptor Count */ |
@@ -342,9 +341,14 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
342 | opt.arg.r.max = mac_type < e1000_82544 ? | 341 | opt.arg.r.max = mac_type < e1000_82544 ? |
343 | E1000_MAX_TXD : E1000_MAX_82544_TXD; | 342 | E1000_MAX_TXD : E1000_MAX_82544_TXD; |
344 | 343 | ||
345 | tx_ring->count = TxDescriptors[bd]; | 344 | if (num_TxDescriptors > bd) { |
346 | e1000_validate_option(&tx_ring->count, &opt, adapter); | 345 | tx_ring->count = TxDescriptors[bd]; |
347 | E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE); | 346 | e1000_validate_option(&tx_ring->count, &opt, adapter); |
347 | E1000_ROUNDUP(tx_ring->count, | ||
348 | REQ_TX_DESCRIPTOR_MULTIPLE); | ||
349 | } else { | ||
350 | tx_ring->count = opt.def; | ||
351 | } | ||
348 | for (i = 0; i < adapter->num_tx_queues; i++) | 352 | for (i = 0; i < adapter->num_tx_queues; i++) |
349 | tx_ring[i].count = tx_ring->count; | 353 | tx_ring[i].count = tx_ring->count; |
350 | } | 354 | } |
@@ -363,9 +367,14 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
363 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : | 367 | opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD : |
364 | E1000_MAX_82544_RXD; | 368 | E1000_MAX_82544_RXD; |
365 | 369 | ||
366 | rx_ring->count = RxDescriptors[bd]; | 370 | if (num_RxDescriptors > bd) { |
367 | e1000_validate_option(&rx_ring->count, &opt, adapter); | 371 | rx_ring->count = RxDescriptors[bd]; |
368 | E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE); | 372 | e1000_validate_option(&rx_ring->count, &opt, adapter); |
373 | E1000_ROUNDUP(rx_ring->count, | ||
374 | REQ_RX_DESCRIPTOR_MULTIPLE); | ||
375 | } else { | ||
376 | rx_ring->count = opt.def; | ||
377 | } | ||
369 | for (i = 0; i < adapter->num_rx_queues; i++) | 378 | for (i = 0; i < adapter->num_rx_queues; i++) |
370 | rx_ring[i].count = rx_ring->count; | 379 | rx_ring[i].count = rx_ring->count; |
371 | } | 380 | } |
@@ -377,9 +386,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
377 | .def = OPTION_ENABLED | 386 | .def = OPTION_ENABLED |
378 | }; | 387 | }; |
379 | 388 | ||
380 | int rx_csum = XsumRX[bd]; | 389 | if (num_XsumRX > bd) { |
381 | e1000_validate_option(&rx_csum, &opt, adapter); | 390 | int rx_csum = XsumRX[bd]; |
382 | adapter->rx_csum = rx_csum; | 391 | e1000_validate_option(&rx_csum, &opt, adapter); |
392 | adapter->rx_csum = rx_csum; | ||
393 | } else { | ||
394 | adapter->rx_csum = opt.def; | ||
395 | } | ||
383 | } | 396 | } |
384 | { /* Flow Control */ | 397 | { /* Flow Control */ |
385 | 398 | ||
@@ -399,9 +412,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
399 | .p = fc_list }} | 412 | .p = fc_list }} |
400 | }; | 413 | }; |
401 | 414 | ||
402 | int fc = FlowControl[bd]; | 415 | if (num_FlowControl > bd) { |
403 | e1000_validate_option(&fc, &opt, adapter); | 416 | int fc = FlowControl[bd]; |
404 | adapter->hw.fc = adapter->hw.original_fc = fc; | 417 | e1000_validate_option(&fc, &opt, adapter); |
418 | adapter->hw.fc = adapter->hw.original_fc = fc; | ||
419 | } else { | ||
420 | adapter->hw.fc = adapter->hw.original_fc = opt.def; | ||
421 | } | ||
405 | } | 422 | } |
406 | { /* Transmit Interrupt Delay */ | 423 | { /* Transmit Interrupt Delay */ |
407 | struct e1000_option opt = { | 424 | struct e1000_option opt = { |
@@ -413,8 +430,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
413 | .max = MAX_TXDELAY }} | 430 | .max = MAX_TXDELAY }} |
414 | }; | 431 | }; |
415 | 432 | ||
416 | adapter->tx_int_delay = TxIntDelay[bd]; | 433 | if (num_TxIntDelay > bd) { |
417 | e1000_validate_option(&adapter->tx_int_delay, &opt, adapter); | 434 | adapter->tx_int_delay = TxIntDelay[bd]; |
435 | e1000_validate_option(&adapter->tx_int_delay, &opt, | ||
436 | adapter); | ||
437 | } else { | ||
438 | adapter->tx_int_delay = opt.def; | ||
439 | } | ||
418 | } | 440 | } |
419 | { /* Transmit Absolute Interrupt Delay */ | 441 | { /* Transmit Absolute Interrupt Delay */ |
420 | struct e1000_option opt = { | 442 | struct e1000_option opt = { |
@@ -426,9 +448,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
426 | .max = MAX_TXABSDELAY }} | 448 | .max = MAX_TXABSDELAY }} |
427 | }; | 449 | }; |
428 | 450 | ||
429 | adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; | 451 | if (num_TxAbsIntDelay > bd) { |
430 | e1000_validate_option(&adapter->tx_abs_int_delay, &opt, | 452 | adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; |
431 | adapter); | 453 | e1000_validate_option(&adapter->tx_abs_int_delay, &opt, |
454 | adapter); | ||
455 | } else { | ||
456 | adapter->tx_abs_int_delay = opt.def; | ||
457 | } | ||
432 | } | 458 | } |
433 | { /* Receive Interrupt Delay */ | 459 | { /* Receive Interrupt Delay */ |
434 | struct e1000_option opt = { | 460 | struct e1000_option opt = { |
@@ -440,8 +466,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
440 | .max = MAX_RXDELAY }} | 466 | .max = MAX_RXDELAY }} |
441 | }; | 467 | }; |
442 | 468 | ||
443 | adapter->rx_int_delay = RxIntDelay[bd]; | 469 | if (num_RxIntDelay > bd) { |
444 | e1000_validate_option(&adapter->rx_int_delay, &opt, adapter); | 470 | adapter->rx_int_delay = RxIntDelay[bd]; |
471 | e1000_validate_option(&adapter->rx_int_delay, &opt, | ||
472 | adapter); | ||
473 | } else { | ||
474 | adapter->rx_int_delay = opt.def; | ||
475 | } | ||
445 | } | 476 | } |
446 | { /* Receive Absolute Interrupt Delay */ | 477 | { /* Receive Absolute Interrupt Delay */ |
447 | struct e1000_option opt = { | 478 | struct e1000_option opt = { |
@@ -453,9 +484,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
453 | .max = MAX_RXABSDELAY }} | 484 | .max = MAX_RXABSDELAY }} |
454 | }; | 485 | }; |
455 | 486 | ||
456 | adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; | 487 | if (num_RxAbsIntDelay > bd) { |
457 | e1000_validate_option(&adapter->rx_abs_int_delay, &opt, | 488 | adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; |
458 | adapter); | 489 | e1000_validate_option(&adapter->rx_abs_int_delay, &opt, |
490 | adapter); | ||
491 | } else { | ||
492 | adapter->rx_abs_int_delay = opt.def; | ||
493 | } | ||
459 | } | 494 | } |
460 | { /* Interrupt Throttling Rate */ | 495 | { /* Interrupt Throttling Rate */ |
461 | struct e1000_option opt = { | 496 | struct e1000_option opt = { |
@@ -467,18 +502,24 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
467 | .max = MAX_ITR }} | 502 | .max = MAX_ITR }} |
468 | }; | 503 | }; |
469 | 504 | ||
470 | adapter->itr = InterruptThrottleRate[bd]; | 505 | if (num_InterruptThrottleRate > bd) { |
471 | switch (adapter->itr) { | 506 | adapter->itr = InterruptThrottleRate[bd]; |
472 | case 0: | 507 | switch (adapter->itr) { |
473 | DPRINTK(PROBE, INFO, "%s turned off\n", opt.name); | 508 | case 0: |
474 | break; | 509 | DPRINTK(PROBE, INFO, "%s turned off\n", |
475 | case 1: | 510 | opt.name); |
476 | DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", | 511 | break; |
477 | opt.name); | 512 | case 1: |
478 | break; | 513 | DPRINTK(PROBE, INFO, "%s set to dynamic mode\n", |
479 | default: | 514 | opt.name); |
480 | e1000_validate_option(&adapter->itr, &opt, adapter); | 515 | break; |
481 | break; | 516 | default: |
517 | e1000_validate_option(&adapter->itr, &opt, | ||
518 | adapter); | ||
519 | break; | ||
520 | } | ||
521 | } else { | ||
522 | adapter->itr = opt.def; | ||
482 | } | 523 | } |
483 | } | 524 | } |
484 | { /* Smart Power Down */ | 525 | { /* Smart Power Down */ |
@@ -489,9 +530,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
489 | .def = OPTION_DISABLED | 530 | .def = OPTION_DISABLED |
490 | }; | 531 | }; |
491 | 532 | ||
492 | int spd = SmartPowerDownEnable[bd]; | 533 | if (num_SmartPowerDownEnable > bd) { |
493 | e1000_validate_option(&spd, &opt, adapter); | 534 | int spd = SmartPowerDownEnable[bd]; |
494 | adapter->smart_power_down = spd; | 535 | e1000_validate_option(&spd, &opt, adapter); |
536 | adapter->smart_power_down = spd; | ||
537 | } else { | ||
538 | adapter->smart_power_down = opt.def; | ||
539 | } | ||
495 | } | 540 | } |
496 | { /* Kumeran Lock Loss Workaround */ | 541 | { /* Kumeran Lock Loss Workaround */ |
497 | struct e1000_option opt = { | 542 | struct e1000_option opt = { |
@@ -501,9 +546,13 @@ e1000_check_options(struct e1000_adapter *adapter) | |||
501 | .def = OPTION_ENABLED | 546 | .def = OPTION_ENABLED |
502 | }; | 547 | }; |
503 | 548 | ||
549 | if (num_KumeranLockLoss > bd) { | ||
504 | int kmrn_lock_loss = KumeranLockLoss[bd]; | 550 | int kmrn_lock_loss = KumeranLockLoss[bd]; |
505 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | 551 | e1000_validate_option(&kmrn_lock_loss, &opt, adapter); |
506 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; | 552 | adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss; |
553 | } else { | ||
554 | adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def; | ||
555 | } | ||
507 | } | 556 | } |
508 | 557 | ||
509 | switch (adapter->hw.media_type) { | 558 | switch (adapter->hw.media_type) { |
@@ -530,18 +579,17 @@ static void __devinit | |||
530 | e1000_check_fiber_options(struct e1000_adapter *adapter) | 579 | e1000_check_fiber_options(struct e1000_adapter *adapter) |
531 | { | 580 | { |
532 | int bd = adapter->bd_number; | 581 | int bd = adapter->bd_number; |
533 | bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; | 582 | if (num_Speed > bd) { |
534 | if ((Speed[bd] != OPTION_UNSET)) { | ||
535 | DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " | 583 | DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, " |
536 | "parameter ignored\n"); | 584 | "parameter ignored\n"); |
537 | } | 585 | } |
538 | 586 | ||
539 | if ((Duplex[bd] != OPTION_UNSET)) { | 587 | if (num_Duplex > bd) { |
540 | DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " | 588 | DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, " |
541 | "parameter ignored\n"); | 589 | "parameter ignored\n"); |
542 | } | 590 | } |
543 | 591 | ||
544 | if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) { | 592 | if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) { |
545 | DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " | 593 | DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is " |
546 | "not valid for fiber adapters, " | 594 | "not valid for fiber adapters, " |
547 | "parameter ignored\n"); | 595 | "parameter ignored\n"); |
@@ -560,7 +608,6 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
560 | { | 608 | { |
561 | int speed, dplx, an; | 609 | int speed, dplx, an; |
562 | int bd = adapter->bd_number; | 610 | int bd = adapter->bd_number; |
563 | bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd; | ||
564 | 611 | ||
565 | { /* Speed */ | 612 | { /* Speed */ |
566 | struct e1000_opt_list speed_list[] = {{ 0, "" }, | 613 | struct e1000_opt_list speed_list[] = {{ 0, "" }, |
@@ -577,8 +624,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
577 | .p = speed_list }} | 624 | .p = speed_list }} |
578 | }; | 625 | }; |
579 | 626 | ||
580 | speed = Speed[bd]; | 627 | if (num_Speed > bd) { |
581 | e1000_validate_option(&speed, &opt, adapter); | 628 | speed = Speed[bd]; |
629 | e1000_validate_option(&speed, &opt, adapter); | ||
630 | } else { | ||
631 | speed = opt.def; | ||
632 | } | ||
582 | } | 633 | } |
583 | { /* Duplex */ | 634 | { /* Duplex */ |
584 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, | 635 | struct e1000_opt_list dplx_list[] = {{ 0, "" }, |
@@ -600,11 +651,15 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
600 | "Speed/Duplex/AutoNeg parameter ignored.\n"); | 651 | "Speed/Duplex/AutoNeg parameter ignored.\n"); |
601 | return; | 652 | return; |
602 | } | 653 | } |
603 | dplx = Duplex[bd]; | 654 | if (num_Duplex > bd) { |
604 | e1000_validate_option(&dplx, &opt, adapter); | 655 | dplx = Duplex[bd]; |
656 | e1000_validate_option(&dplx, &opt, adapter); | ||
657 | } else { | ||
658 | dplx = opt.def; | ||
659 | } | ||
605 | } | 660 | } |
606 | 661 | ||
607 | if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) { | 662 | if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) { |
608 | DPRINTK(PROBE, INFO, | 663 | DPRINTK(PROBE, INFO, |
609 | "AutoNeg specified along with Speed or Duplex, " | 664 | "AutoNeg specified along with Speed or Duplex, " |
610 | "parameter ignored\n"); | 665 | "parameter ignored\n"); |
@@ -653,15 +708,19 @@ e1000_check_copper_options(struct e1000_adapter *adapter) | |||
653 | .p = an_list }} | 708 | .p = an_list }} |
654 | }; | 709 | }; |
655 | 710 | ||
656 | an = AutoNeg[bd]; | 711 | if (num_AutoNeg > bd) { |
657 | e1000_validate_option(&an, &opt, adapter); | 712 | an = AutoNeg[bd]; |
713 | e1000_validate_option(&an, &opt, adapter); | ||
714 | } else { | ||
715 | an = opt.def; | ||
716 | } | ||
658 | adapter->hw.autoneg_advertised = an; | 717 | adapter->hw.autoneg_advertised = an; |
659 | } | 718 | } |
660 | 719 | ||
661 | switch (speed + dplx) { | 720 | switch (speed + dplx) { |
662 | case 0: | 721 | case 0: |
663 | adapter->hw.autoneg = adapter->fc_autoneg = 1; | 722 | adapter->hw.autoneg = adapter->fc_autoneg = 1; |
664 | if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET) | 723 | if ((num_Speed > bd) && (speed != 0 || dplx != 0)) |
665 | DPRINTK(PROBE, INFO, | 724 | DPRINTK(PROBE, INFO, |
666 | "Speed and duplex autonegotiation enabled\n"); | 725 | "Speed and duplex autonegotiation enabled\n"); |
667 | break; | 726 | break; |