e1000: Use module param array code
Use module param array code to distinguish between defaults and user specified values. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
This commit is contained in:
parent
e7b4411704
commit
1db2740d78
@ -324,7 +324,6 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
DPRINTK(PROBE, NOTICE,
|
DPRINTK(PROBE, NOTICE,
|
||||||
"Warning: no configuration for board #%i\n", bd);
|
"Warning: no configuration for board #%i\n", bd);
|
||||||
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
|
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
|
||||||
bd = E1000_MAX_NIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ /* Transmit Descriptor Count */
|
{ /* Transmit Descriptor Count */
|
||||||
@ -342,9 +341,14 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
opt.arg.r.max = mac_type < e1000_82544 ?
|
opt.arg.r.max = mac_type < e1000_82544 ?
|
||||||
E1000_MAX_TXD : E1000_MAX_82544_TXD;
|
E1000_MAX_TXD : E1000_MAX_82544_TXD;
|
||||||
|
|
||||||
tx_ring->count = TxDescriptors[bd];
|
if (num_TxDescriptors > bd) {
|
||||||
e1000_validate_option(&tx_ring->count, &opt, adapter);
|
tx_ring->count = TxDescriptors[bd];
|
||||||
E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
|
e1000_validate_option(&tx_ring->count, &opt, adapter);
|
||||||
|
E1000_ROUNDUP(tx_ring->count,
|
||||||
|
REQ_TX_DESCRIPTOR_MULTIPLE);
|
||||||
|
} else {
|
||||||
|
tx_ring->count = opt.def;
|
||||||
|
}
|
||||||
for (i = 0; i < adapter->num_tx_queues; i++)
|
for (i = 0; i < adapter->num_tx_queues; i++)
|
||||||
tx_ring[i].count = tx_ring->count;
|
tx_ring[i].count = tx_ring->count;
|
||||||
}
|
}
|
||||||
@ -363,9 +367,14 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
|
opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
|
||||||
E1000_MAX_82544_RXD;
|
E1000_MAX_82544_RXD;
|
||||||
|
|
||||||
rx_ring->count = RxDescriptors[bd];
|
if (num_RxDescriptors > bd) {
|
||||||
e1000_validate_option(&rx_ring->count, &opt, adapter);
|
rx_ring->count = RxDescriptors[bd];
|
||||||
E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
|
e1000_validate_option(&rx_ring->count, &opt, adapter);
|
||||||
|
E1000_ROUNDUP(rx_ring->count,
|
||||||
|
REQ_RX_DESCRIPTOR_MULTIPLE);
|
||||||
|
} else {
|
||||||
|
rx_ring->count = opt.def;
|
||||||
|
}
|
||||||
for (i = 0; i < adapter->num_rx_queues; i++)
|
for (i = 0; i < adapter->num_rx_queues; i++)
|
||||||
rx_ring[i].count = rx_ring->count;
|
rx_ring[i].count = rx_ring->count;
|
||||||
}
|
}
|
||||||
@ -377,9 +386,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.def = OPTION_ENABLED
|
.def = OPTION_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
int rx_csum = XsumRX[bd];
|
if (num_XsumRX > bd) {
|
||||||
e1000_validate_option(&rx_csum, &opt, adapter);
|
int rx_csum = XsumRX[bd];
|
||||||
adapter->rx_csum = rx_csum;
|
e1000_validate_option(&rx_csum, &opt, adapter);
|
||||||
|
adapter->rx_csum = rx_csum;
|
||||||
|
} else {
|
||||||
|
adapter->rx_csum = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Flow Control */
|
{ /* Flow Control */
|
||||||
|
|
||||||
@ -399,9 +412,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.p = fc_list }}
|
.p = fc_list }}
|
||||||
};
|
};
|
||||||
|
|
||||||
int fc = FlowControl[bd];
|
if (num_FlowControl > bd) {
|
||||||
e1000_validate_option(&fc, &opt, adapter);
|
int fc = FlowControl[bd];
|
||||||
adapter->hw.fc = adapter->hw.original_fc = fc;
|
e1000_validate_option(&fc, &opt, adapter);
|
||||||
|
adapter->hw.fc = adapter->hw.original_fc = fc;
|
||||||
|
} else {
|
||||||
|
adapter->hw.fc = adapter->hw.original_fc = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Transmit Interrupt Delay */
|
{ /* Transmit Interrupt Delay */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -413,8 +430,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.max = MAX_TXDELAY }}
|
.max = MAX_TXDELAY }}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter->tx_int_delay = TxIntDelay[bd];
|
if (num_TxIntDelay > bd) {
|
||||||
e1000_validate_option(&adapter->tx_int_delay, &opt, adapter);
|
adapter->tx_int_delay = TxIntDelay[bd];
|
||||||
|
e1000_validate_option(&adapter->tx_int_delay, &opt,
|
||||||
|
adapter);
|
||||||
|
} else {
|
||||||
|
adapter->tx_int_delay = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Transmit Absolute Interrupt Delay */
|
{ /* Transmit Absolute Interrupt Delay */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -426,9 +448,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.max = MAX_TXABSDELAY }}
|
.max = MAX_TXABSDELAY }}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
|
if (num_TxAbsIntDelay > bd) {
|
||||||
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
|
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
|
||||||
adapter);
|
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
|
||||||
|
adapter);
|
||||||
|
} else {
|
||||||
|
adapter->tx_abs_int_delay = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Receive Interrupt Delay */
|
{ /* Receive Interrupt Delay */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -440,8 +466,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.max = MAX_RXDELAY }}
|
.max = MAX_RXDELAY }}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter->rx_int_delay = RxIntDelay[bd];
|
if (num_RxIntDelay > bd) {
|
||||||
e1000_validate_option(&adapter->rx_int_delay, &opt, adapter);
|
adapter->rx_int_delay = RxIntDelay[bd];
|
||||||
|
e1000_validate_option(&adapter->rx_int_delay, &opt,
|
||||||
|
adapter);
|
||||||
|
} else {
|
||||||
|
adapter->rx_int_delay = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Receive Absolute Interrupt Delay */
|
{ /* Receive Absolute Interrupt Delay */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -453,9 +484,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.max = MAX_RXABSDELAY }}
|
.max = MAX_RXABSDELAY }}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
|
if (num_RxAbsIntDelay > bd) {
|
||||||
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
|
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
|
||||||
adapter);
|
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
|
||||||
|
adapter);
|
||||||
|
} else {
|
||||||
|
adapter->rx_abs_int_delay = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Interrupt Throttling Rate */
|
{ /* Interrupt Throttling Rate */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -467,18 +502,24 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.max = MAX_ITR }}
|
.max = MAX_ITR }}
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter->itr = InterruptThrottleRate[bd];
|
if (num_InterruptThrottleRate > bd) {
|
||||||
switch (adapter->itr) {
|
adapter->itr = InterruptThrottleRate[bd];
|
||||||
case 0:
|
switch (adapter->itr) {
|
||||||
DPRINTK(PROBE, INFO, "%s turned off\n", opt.name);
|
case 0:
|
||||||
break;
|
DPRINTK(PROBE, INFO, "%s turned off\n",
|
||||||
case 1:
|
opt.name);
|
||||||
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
|
break;
|
||||||
opt.name);
|
case 1:
|
||||||
break;
|
DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
|
||||||
default:
|
opt.name);
|
||||||
e1000_validate_option(&adapter->itr, &opt, adapter);
|
break;
|
||||||
break;
|
default:
|
||||||
|
e1000_validate_option(&adapter->itr, &opt,
|
||||||
|
adapter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
adapter->itr = opt.def;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ /* Smart Power Down */
|
{ /* Smart Power Down */
|
||||||
@ -489,9 +530,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.def = OPTION_DISABLED
|
.def = OPTION_DISABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
int spd = SmartPowerDownEnable[bd];
|
if (num_SmartPowerDownEnable > bd) {
|
||||||
e1000_validate_option(&spd, &opt, adapter);
|
int spd = SmartPowerDownEnable[bd];
|
||||||
adapter->smart_power_down = spd;
|
e1000_validate_option(&spd, &opt, adapter);
|
||||||
|
adapter->smart_power_down = spd;
|
||||||
|
} else {
|
||||||
|
adapter->smart_power_down = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Kumeran Lock Loss Workaround */
|
{ /* Kumeran Lock Loss Workaround */
|
||||||
struct e1000_option opt = {
|
struct e1000_option opt = {
|
||||||
@ -501,9 +546,13 @@ e1000_check_options(struct e1000_adapter *adapter)
|
|||||||
.def = OPTION_ENABLED
|
.def = OPTION_ENABLED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (num_KumeranLockLoss > bd) {
|
||||||
int kmrn_lock_loss = KumeranLockLoss[bd];
|
int kmrn_lock_loss = KumeranLockLoss[bd];
|
||||||
e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
|
e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
|
||||||
adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
|
adapter->hw.kmrn_lock_loss_workaround_disabled = !kmrn_lock_loss;
|
||||||
|
} else {
|
||||||
|
adapter->hw.kmrn_lock_loss_workaround_disabled = !opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (adapter->hw.media_type) {
|
switch (adapter->hw.media_type) {
|
||||||
@ -530,18 +579,17 @@ static void __devinit
|
|||||||
e1000_check_fiber_options(struct e1000_adapter *adapter)
|
e1000_check_fiber_options(struct e1000_adapter *adapter)
|
||||||
{
|
{
|
||||||
int bd = adapter->bd_number;
|
int bd = adapter->bd_number;
|
||||||
bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
|
if (num_Speed > bd) {
|
||||||
if ((Speed[bd] != OPTION_UNSET)) {
|
|
||||||
DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
|
DPRINTK(PROBE, INFO, "Speed not valid for fiber adapters, "
|
||||||
"parameter ignored\n");
|
"parameter ignored\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Duplex[bd] != OPTION_UNSET)) {
|
if (num_Duplex > bd) {
|
||||||
DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
|
DPRINTK(PROBE, INFO, "Duplex not valid for fiber adapters, "
|
||||||
"parameter ignored\n");
|
"parameter ignored\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((AutoNeg[bd] != OPTION_UNSET) && (AutoNeg[bd] != 0x20)) {
|
if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
|
||||||
DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
|
DPRINTK(PROBE, INFO, "AutoNeg other than 1000/Full is "
|
||||||
"not valid for fiber adapters, "
|
"not valid for fiber adapters, "
|
||||||
"parameter ignored\n");
|
"parameter ignored\n");
|
||||||
@ -560,7 +608,6 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
|
|||||||
{
|
{
|
||||||
int speed, dplx, an;
|
int speed, dplx, an;
|
||||||
int bd = adapter->bd_number;
|
int bd = adapter->bd_number;
|
||||||
bd = bd > E1000_MAX_NIC ? E1000_MAX_NIC : bd;
|
|
||||||
|
|
||||||
{ /* Speed */
|
{ /* Speed */
|
||||||
struct e1000_opt_list speed_list[] = {{ 0, "" },
|
struct e1000_opt_list speed_list[] = {{ 0, "" },
|
||||||
@ -577,8 +624,12 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
|
|||||||
.p = speed_list }}
|
.p = speed_list }}
|
||||||
};
|
};
|
||||||
|
|
||||||
speed = Speed[bd];
|
if (num_Speed > bd) {
|
||||||
e1000_validate_option(&speed, &opt, adapter);
|
speed = Speed[bd];
|
||||||
|
e1000_validate_option(&speed, &opt, adapter);
|
||||||
|
} else {
|
||||||
|
speed = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{ /* Duplex */
|
{ /* Duplex */
|
||||||
struct e1000_opt_list dplx_list[] = {{ 0, "" },
|
struct e1000_opt_list dplx_list[] = {{ 0, "" },
|
||||||
@ -600,11 +651,15 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
|
|||||||
"Speed/Duplex/AutoNeg parameter ignored.\n");
|
"Speed/Duplex/AutoNeg parameter ignored.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dplx = Duplex[bd];
|
if (num_Duplex > bd) {
|
||||||
e1000_validate_option(&dplx, &opt, adapter);
|
dplx = Duplex[bd];
|
||||||
|
e1000_validate_option(&dplx, &opt, adapter);
|
||||||
|
} else {
|
||||||
|
dplx = opt.def;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AutoNeg[bd] != OPTION_UNSET && (speed != 0 || dplx != 0)) {
|
if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
|
||||||
DPRINTK(PROBE, INFO,
|
DPRINTK(PROBE, INFO,
|
||||||
"AutoNeg specified along with Speed or Duplex, "
|
"AutoNeg specified along with Speed or Duplex, "
|
||||||
"parameter ignored\n");
|
"parameter ignored\n");
|
||||||
@ -653,15 +708,19 @@ e1000_check_copper_options(struct e1000_adapter *adapter)
|
|||||||
.p = an_list }}
|
.p = an_list }}
|
||||||
};
|
};
|
||||||
|
|
||||||
an = AutoNeg[bd];
|
if (num_AutoNeg > bd) {
|
||||||
e1000_validate_option(&an, &opt, adapter);
|
an = AutoNeg[bd];
|
||||||
|
e1000_validate_option(&an, &opt, adapter);
|
||||||
|
} else {
|
||||||
|
an = opt.def;
|
||||||
|
}
|
||||||
adapter->hw.autoneg_advertised = an;
|
adapter->hw.autoneg_advertised = an;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (speed + dplx) {
|
switch (speed + dplx) {
|
||||||
case 0:
|
case 0:
|
||||||
adapter->hw.autoneg = adapter->fc_autoneg = 1;
|
adapter->hw.autoneg = adapter->fc_autoneg = 1;
|
||||||
if (Speed[bd] != OPTION_UNSET || Duplex[bd] != OPTION_UNSET)
|
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
|
||||||
DPRINTK(PROBE, INFO,
|
DPRINTK(PROBE, INFO,
|
||||||
"Speed and duplex autonegotiation enabled\n");
|
"Speed and duplex autonegotiation enabled\n");
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user