29 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37 #define IXGB_MAX_NIC 8
39 #define OPTION_UNSET -1
40 #define OPTION_DISABLED 0
41 #define OPTION_ENABLED 1
48 #define IXGB_PARAM_INIT { [0 ... IXGB_MAX_NIC] = OPTION_UNSET }
49 #define IXGB_PARAM(X, desc) \
50 static int __devinitdata X[IXGB_MAX_NIC+1] \
52 static unsigned int num_##X = 0; \
53 module_param_array_named(X, X, int, &num_##X, 0); \
54 MODULE_PARM_DESC(X, desc);
63 IXGB_PARAM(TxDescriptors,
"Number of transmit descriptors");
72 IXGB_PARAM(RxDescriptors,
"Number of receive descriptors");
97 IXGB_PARAM(XsumRX,
"Disable or enable Receive Checksum offload");
106 IXGB_PARAM(TxIntDelay,
"Transmit Interrupt Delay");
115 IXGB_PARAM(RxIntDelay,
"Receive Interrupt Delay");
125 IXGB_PARAM(RxFCHighThresh,
"Receive Flow Control High Threshold");
136 IXGB_PARAM(RxFCLowThresh,
"Receive Flow Control Low Threshold");
146 IXGB_PARAM(FCReqTimeout,
"Flow Control Request Timeout");
158 IXGB_PARAM(IntDelayEnable,
"Transmit Interrupt Delay Enable");
161 #define DEFAULT_TIDV 32
162 #define MAX_TIDV 0xFFFF
165 #define DEFAULT_RDTR 72
166 #define MAX_RDTR 0xFFFF
169 #define XSUMRX_DEFAULT OPTION_ENABLED
171 #define DEFAULT_FCRTL 0x28000
172 #define DEFAULT_FCRTH 0x30000
174 #define MAX_FCRTL 0x3FFE8
176 #define MAX_FCRTH 0x3FFF0
178 #define MIN_FCPAUSE 1
179 #define MAX_FCPAUSE 0xffff
180 #define DEFAULT_FCPAUSE 0xFFFF
194 const struct ixgb_opt_list {
222 if (*value >= opt->
arg.
r.min && *value <= opt->
arg.r.max) {
229 const struct ixgb_opt_list *
ent;
231 for (i = 0; i < opt->
arg.
l.nr; i++) {
232 ent = &opt->
arg.
l.p[
i];
233 if (*value == ent->i) {
234 if (ent->str[0] !=
'\0')
245 pr_info(
"Invalid %s specified (%i) %s\n", opt->
name, *value, opt->
err);
265 pr_notice(
"Warning: no configuration for board #%i\n", bd);
266 pr_notice(
"Using defaults for all values\n");
272 .name =
"Transmit Descriptors",
275 .arg = { .r = { .min =
MIN_TXD,
280 if (num_TxDescriptors > bd) {
281 tx_ring->
count = TxDescriptors[bd];
282 ixgb_validate_option(&tx_ring->
count, &opt);
291 .name =
"Receive Descriptors",
294 .arg = { .r = { .min =
MIN_RXD,
299 if (num_RxDescriptors > bd) {
300 rx_ring->
count = RxDescriptors[bd];
301 ixgb_validate_option(&rx_ring->
count, &opt);
310 .name =
"Receive Checksum Offload",
311 .err =
"defaulting to Enabled",
315 if (num_XsumRX > bd) {
316 unsigned int rx_csum = XsumRX[bd];
317 ixgb_validate_option(&rx_csum, &opt);
325 static const struct ixgb_opt_list fc_list[] = {
335 .name =
"Flow Control",
336 .err =
"reading default settings from EEPROM",
342 if (num_FlowControl > bd) {
344 ixgb_validate_option(&fc, &opt);
345 adapter->
hw.fc.type =
fc;
347 adapter->
hw.fc.type = opt.
def;
353 .name =
"Rx Flow Control High Threshold",
360 if (num_RxFCHighThresh > bd) {
361 adapter->
hw.fc.high_water = RxFCHighThresh[bd];
362 ixgb_validate_option(&adapter->
hw.fc.high_water, &opt);
364 adapter->
hw.fc.high_water = opt.
def;
367 pr_info(
"Ignoring RxFCHighThresh when no RxFC\n");
372 .name =
"Rx Flow Control Low Threshold",
379 if (num_RxFCLowThresh > bd) {
380 adapter->
hw.fc.low_water = RxFCLowThresh[bd];
381 ixgb_validate_option(&adapter->
hw.fc.low_water, &opt);
383 adapter->
hw.fc.low_water = opt.
def;
386 pr_info(
"Ignoring RxFCLowThresh when no RxFC\n");
391 .name =
"Flow Control Pause Time Request",
398 if (num_FCReqTimeout > bd) {
399 unsigned int pause_time = FCReqTimeout[bd];
400 ixgb_validate_option(&pause_time, &opt);
401 adapter->
hw.fc.pause_time = pause_time;
403 adapter->
hw.fc.pause_time = opt.
def;
406 pr_info(
"Ignoring FCReqTimeout when no RxFC\n");
411 if (adapter->
hw.fc.high_water < (adapter->
hw.fc.low_water + 8)) {
413 pr_info(
"RxFCHighThresh must be >= (RxFCLowThresh + 8), Using Defaults\n");
421 .name =
"Receive Interrupt Delay",
428 if (num_RxIntDelay > bd) {
438 .name =
"Transmit Interrupt Delay",
445 if (num_TxIntDelay > bd) {
456 .name =
"Tx Interrupt Delay Enable",
457 .err =
"defaulting to Enabled",
461 if (num_IntDelayEnable > bd) {
462 unsigned int ide = IntDelayEnable[bd];
463 ixgb_validate_option(&ide, &opt);