Use module param array code to distinguish between defaults and user
specified values.
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---
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 0ef4131..2128427 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
DPRINTK(PROBE, NOTICE,
Warning: no configuration for board #%i\n, bd);
DPRINTK(PROBE, NOTICE, Using defaults for all values\n);
- bd = E1000_MAX_NIC;
}
{ /* Transmit Descriptor Count */
@@ -342,9 +341,14 @@ e1000_check_options(struct e1000_adapter
opt.arg.r.max = mac_type e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD;
- tx_ring-count = TxDescriptors[bd];
- e1000_validate_option(tx_ring-count, opt, adapter);
- E1000_ROUNDUP(tx_ring-count, REQ_TX_DESCRIPTOR_MULTIPLE);
+ if (num_TxDescriptors bd) {
+ tx_ring-count = TxDescriptors[bd];
+ 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++)
tx_ring[i].count = tx_ring-count;
}
@@ -363,9 +367,14 @@ e1000_check_options(struct e1000_adapter
opt.arg.r.max = mac_type e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD;
- rx_ring-count = RxDescriptors[bd];
- e1000_validate_option(rx_ring-count, opt, adapter);
- E1000_ROUNDUP(rx_ring-count, REQ_RX_DESCRIPTOR_MULTIPLE);
+ if (num_RxDescriptors bd) {
+ rx_ring-count = RxDescriptors[bd];
+ 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++)
rx_ring[i].count = rx_ring-count;
}
@@ -377,9 +386,13 @@ e1000_check_options(struct e1000_adapter
.def = OPTION_ENABLED
};
- int rx_csum = XsumRX[bd];
- e1000_validate_option(rx_csum, opt, adapter);
- adapter-rx_csum = rx_csum;
+ if (num_XsumRX bd) {
+ int rx_csum = XsumRX[bd];
+ e1000_validate_option(rx_csum, opt, adapter);
+ adapter-rx_csum = rx_csum;
+ } else {
+ adapter-rx_csum = opt.def;
+ }
}
{ /* Flow Control */
@@ -399,9 +412,13 @@ e1000_check_options(struct e1000_adapter
.p = fc_list }}
};
- int fc = FlowControl[bd];
- e1000_validate_option(fc, opt, adapter);
- adapter-hw.fc = adapter-hw.original_fc = fc;
+ if (num_FlowControl bd) {
+ int fc = FlowControl[bd];
+ 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 */
struct e1000_option opt = {
@@ -413,8 +430,13 @@ e1000_check_options(struct e1000_adapter
.max = MAX_TXDELAY }}
};
- adapter-tx_int_delay = TxIntDelay[bd];
- e1000_validate_option(adapter-tx_int_delay, opt, adapter);
+ if (num_TxIntDelay bd) {
+ 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 */
struct e1000_option opt = {
@@ -426,9 +448,13 @@ e1000_check_options(struct e1000_adapter
.max = MAX_TXABSDELAY }}
};
- adapter-tx_abs_int_delay = TxAbsIntDelay[bd];
- e1000_validate_option(adapter-tx_abs_int_delay, opt,
- adapter);
+