igb_param.c revision 9ca4a157
1/*******************************************************************************
2
3  Intel(R) Gigabit Ethernet Linux driver
4  Copyright(c) 2007-2013 Intel Corporation.
5
6  This program is free software; you can redistribute it and/or modify it
7  under the terms and conditions of the GNU General Public License,
8  version 2, as published by the Free Software Foundation.
9
10  This program is distributed in the hope it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  more details.
14
15  You should have received a copy of the GNU General Public License along with
16  this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19  The full GNU General Public License is included in this distribution in
20  the file called "LICENSE.GPL".
21
22  Contact Information:
23  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25
26*******************************************************************************/
27
28
29#include <linux/netdevice.h>
30
31#include "igb.h"
32
33/* This is the only thing that needs to be changed to adjust the
34 * maximum number of ports that the driver can manage.
35 */
36
37#define IGB_MAX_NIC 32
38
39#define OPTION_UNSET   -1
40#define OPTION_DISABLED 0
41#define OPTION_ENABLED  1
42#define MAX_NUM_LIST_OPTS 15
43
44/* All parameters are treated the same, as an integer array of values.
45 * This macro just reduces the need to repeat the same declaration code
46 * over and over (plus this helps to avoid typo bugs).
47 */
48
49#define IGB_PARAM_INIT { [0 ... IGB_MAX_NIC] = OPTION_UNSET }
50#ifndef module_param_array
51/* Module Parameters are always initialized to -1, so that the driver
52 * can tell the difference between no user specified value or the
53 * user asking for the default value.
54 * The true default values are loaded in when igb_check_options is called.
55 *
56 * This is a GCC extension to ANSI C.
57 * See the item "Labeled Elements in Initializers" in the section
58 * "Extensions to the C Language Family" of the GCC documentation.
59 */
60
61#define IGB_PARAM(X, desc) \
62	static const int X[IGB_MAX_NIC+1] = IGB_PARAM_INIT; \
63	MODULE_PARM(X, "1-" __MODULE_STRING(IGB_MAX_NIC) "i"); \
64	MODULE_PARM_DESC(X, desc);
65#else
66#define IGB_PARAM(X, desc) \
67	static int X[IGB_MAX_NIC+1] = IGB_PARAM_INIT; \
68	static unsigned int num_##X; \
69	module_param_array_named(X, X, int, &num_##X, 0); \
70	MODULE_PARM_DESC(X, desc);
71#endif
72
73/* Interrupt Throttle Rate (interrupts/sec)
74 *
75 * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
76 */
77IGB_PARAM(InterruptThrottleRate,
78	  "Maximum interrupts per second, per vector, (max 100000), default 3=adaptive");
79#define DEFAULT_ITR                    3
80#define MAX_ITR                   100000
81/* #define MIN_ITR                      120 */
82#define MIN_ITR                      0
83/* IntMode (Interrupt Mode)
84 *
85 * Valid Range: 0 - 2
86 *
87 * Default Value: 2 (MSI-X)
88 */
89IGB_PARAM(IntMode, "Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), default 2");
90#define MAX_INTMODE                    IGB_INT_MODE_MSIX
91#define MIN_INTMODE                    IGB_INT_MODE_LEGACY
92
93IGB_PARAM(Node, "set the starting node to allocate memory on, default -1");
94
95/* LLIPort (Low Latency Interrupt TCP Port)
96 *
97 * Valid Range: 0 - 65535
98 *
99 * Default Value: 0 (disabled)
100 */
101IGB_PARAM(LLIPort, "Low Latency Interrupt TCP Port (0-65535), default 0=off");
102
103#define DEFAULT_LLIPORT                0
104#define MAX_LLIPORT               0xFFFF
105#define MIN_LLIPORT                    0
106
107/* LLIPush (Low Latency Interrupt on TCP Push flag)
108 *
109 * Valid Range: 0, 1
110 *
111 * Default Value: 0 (disabled)
112 */
113IGB_PARAM(LLIPush, "Low Latency Interrupt on TCP Push flag (0,1), default 0=off");
114
115#define DEFAULT_LLIPUSH                0
116#define MAX_LLIPUSH                    1
117#define MIN_LLIPUSH                    0
118
119/* LLISize (Low Latency Interrupt on Packet Size)
120 *
121 * Valid Range: 0 - 1500
122 *
123 * Default Value: 0 (disabled)
124 */
125IGB_PARAM(LLISize, "Low Latency Interrupt on Packet Size (0-1500), default 0=off");
126
127#define DEFAULT_LLISIZE                0
128#define MAX_LLISIZE                 1500
129#define MIN_LLISIZE                    0
130
131/* RSS (Enable RSS multiqueue receive)
132 *
133 * Valid Range: 0 - 8
134 *
135 * Default Value:  1
136 */
137IGB_PARAM(RSS, "Number of Receive-Side Scaling Descriptor Queues (0-8), default 1, 0=number of cpus");
138
139#define DEFAULT_RSS       1
140#define MAX_RSS           8
141#define MIN_RSS           0
142
143/* VMDQ (Enable VMDq multiqueue receive)
144 *
145 * Valid Range: 0 - 8
146 *
147 * Default Value:  0
148 */
149IGB_PARAM(VMDQ, "Number of Virtual Machine Device Queues: 0-1 = disable, 2-8 enable, default 0");
150
151#define DEFAULT_VMDQ      0
152#define MAX_VMDQ          MAX_RSS
153#define MIN_VMDQ          0
154
155/* max_vfs (Enable SR-IOV VF devices)
156 *
157 * Valid Range: 0 - 7
158 *
159 * Default Value:  0
160 */
161IGB_PARAM(max_vfs, "Number of Virtual Functions: 0 = disable, 1-7 enable, default 0");
162
163#define DEFAULT_SRIOV     0
164#define MAX_SRIOV         7
165#define MIN_SRIOV         0
166
167/* MDD (Enable Malicious Driver Detection)
168 *
169 * Only available when SR-IOV is enabled - max_vfs is greater than 0
170 *
171 * Valid Range: 0, 1
172 *
173 * Default Value:  1
174 */
175IGB_PARAM(MDD, "Malicious Driver Detection (0/1), default 1 = enabled. "
176	  "Only available when max_vfs is greater than 0");
177
178#ifdef DEBUG
179
180/* Disable Hardware Reset on Tx Hang
181 *
182 * Valid Range: 0, 1
183 *
184 * Default Value: 0 (disabled, i.e. h/w will reset)
185 */
186IGB_PARAM(DisableHwReset, "Disable reset of hardware on Tx hang");
187
188/* Dump Transmit and Receive buffers
189 *
190 * Valid Range: 0, 1
191 *
192 * Default Value: 0
193 */
194IGB_PARAM(DumpBuffers, "Dump Tx/Rx buffers on Tx hang or by request");
195
196#endif /* DEBUG */
197
198/* QueuePairs (Enable TX/RX queue pairs for interrupt handling)
199 *
200 * Valid Range: 0 - 1
201 *
202 * Default Value:  1
203 */
204IGB_PARAM(QueuePairs, "Enable Tx/Rx queue pairs for interrupt handling (0,1), default 1=on");
205
206#define DEFAULT_QUEUE_PAIRS           1
207#define MAX_QUEUE_PAIRS               1
208#define MIN_QUEUE_PAIRS               0
209
210/* Enable/disable EEE (a.k.a. IEEE802.3az)
211 *
212 * Valid Range: 0, 1
213 *
214 * Default Value: 1
215 */
216 IGB_PARAM(EEE, "Enable/disable on parts that support the feature");
217
218/* Enable/disable DMA Coalescing
219 *
220 * Valid Values: 0(off), 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000,
221 * 9000, 10000(msec), 250(usec), 500(usec)
222 *
223 * Default Value: 0
224 */
225 IGB_PARAM(DMAC, "Disable or set latency for DMA Coalescing ((0=off, 1000-10000(msec), 250, 500 (usec))");
226
227#ifndef IGB_NO_LRO
228/* Enable/disable Large Receive Offload
229 *
230 * Valid Values: 0(off), 1(on)
231 *
232 * Default Value: 0
233 */
234 IGB_PARAM(LRO, "Large Receive Offload (0,1), default 0=off");
235
236#endif
237struct igb_opt_list {
238	int i;
239	char *str;
240};
241struct igb_option {
242	enum { enable_option, range_option, list_option } type;
243	const char *name;
244	const char *err;
245	int def;
246	union {
247		struct { /* range_option info */
248			int min;
249			int max;
250		} r;
251		struct { /* list_option info */
252			int nr;
253			struct igb_opt_list *p;
254		} l;
255	} arg;
256};
257
258static int igb_validate_option(unsigned int *value,
259			       struct igb_option *opt,
260			       struct igb_adapter *adapter)
261{
262	if (*value == OPTION_UNSET) {
263		*value = opt->def;
264		return 0;
265	}
266
267	switch (opt->type) {
268	case enable_option:
269		switch (*value) {
270		case OPTION_ENABLED:
271			DPRINTK(PROBE, INFO, "%s Enabled\n", opt->name);
272			return 0;
273		case OPTION_DISABLED:
274			DPRINTK(PROBE, INFO, "%s Disabled\n", opt->name);
275			return 0;
276		}
277		break;
278	case range_option:
279		if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
280			DPRINTK(PROBE, INFO,
281					"%s set to %d\n", opt->name, *value);
282			return 0;
283		}
284		break;
285	case list_option: {
286		int i;
287		struct igb_opt_list *ent;
288
289		for (i = 0; i < opt->arg.l.nr; i++) {
290			ent = &opt->arg.l.p[i];
291			if (*value == ent->i) {
292				if (ent->str[0] != '\0')
293					DPRINTK(PROBE, INFO, "%s\n", ent->str);
294				return 0;
295			}
296		}
297	}
298		break;
299	default:
300		BUG();
301	}
302
303	DPRINTK(PROBE, INFO, "Invalid %s value specified (%d) %s\n",
304	       opt->name, *value, opt->err);
305	*value = opt->def;
306	return -1;
307}
308
309/**
310 * igb_check_options - Range Checking for Command Line Parameters
311 * @adapter: board private structure
312 *
313 * This routine checks all command line parameters for valid user
314 * input.  If an invalid value is given, or if no user specified
315 * value exists, a default value is used.  The final value is stored
316 * in a variable in the adapter structure.
317 **/
318
319void igb_check_options(struct igb_adapter *adapter)
320{
321	int bd = adapter->bd_number;
322	struct e1000_hw *hw = &adapter->hw;
323
324	if (bd >= IGB_MAX_NIC) {
325		DPRINTK(PROBE, NOTICE,
326		       "Warning: no configuration for board #%d\n", bd);
327		DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
328#ifndef module_param_array
329		bd = IGB_MAX_NIC;
330#endif
331	}
332
333	{ /* Interrupt Throttling Rate */
334		struct igb_option opt = {
335			.type = range_option,
336			.name = "Interrupt Throttling Rate (ints/sec)",
337			.err  = "using default of " __MODULE_STRING(DEFAULT_ITR),
338			.def  = DEFAULT_ITR,
339			.arg  = { .r = { .min = MIN_ITR,
340					 .max = MAX_ITR } }
341		};
342
343#ifdef module_param_array
344		if (num_InterruptThrottleRate > bd) {
345#endif
346			unsigned int itr = InterruptThrottleRate[bd];
347
348			switch (itr) {
349			case 0:
350				DPRINTK(PROBE, INFO, "%s turned off\n",
351				        opt.name);
352				if (hw->mac.type >= e1000_i350)
353					adapter->dmac = IGB_DMAC_DISABLE;
354				adapter->rx_itr_setting = itr;
355				break;
356			case 1:
357				DPRINTK(PROBE, INFO, "%s set to dynamic mode\n",
358					opt.name);
359				adapter->rx_itr_setting = itr;
360				break;
361			case 3:
362				DPRINTK(PROBE, INFO,
363				        "%s set to dynamic conservative mode\n",
364					opt.name);
365				adapter->rx_itr_setting = itr;
366				break;
367			default:
368				igb_validate_option(&itr, &opt, adapter);
369				/* Save the setting, because the dynamic bits
370				 * change itr.  In case of invalid user value,
371				 * default to conservative mode, else need to
372				 * clear the lower two bits because they are
373				 * used as control */
374				if (itr == 3) {
375					adapter->rx_itr_setting = itr;
376				} else {
377					adapter->rx_itr_setting = 1000000000 /
378					                          (itr * 256);
379					adapter->rx_itr_setting &= ~3;
380				}
381				break;
382			}
383#ifdef module_param_array
384		} else {
385			adapter->rx_itr_setting = opt.def;
386		}
387#endif
388		adapter->tx_itr_setting = adapter->rx_itr_setting;
389	}
390	{ /* Interrupt Mode */
391		struct igb_option opt = {
392			.type = range_option,
393			.name = "Interrupt Mode",
394			.err  = "defaulting to 2 (MSI-X)",
395			.def  = IGB_INT_MODE_MSIX,
396			.arg  = { .r = { .min = MIN_INTMODE,
397					 .max = MAX_INTMODE } }
398		};
399
400#ifdef module_param_array
401		if (num_IntMode > bd) {
402#endif
403			unsigned int int_mode = IntMode[bd];
404			igb_validate_option(&int_mode, &opt, adapter);
405			adapter->int_mode = int_mode;
406#ifdef module_param_array
407		} else {
408			adapter->int_mode = opt.def;
409		}
410#endif
411	}
412	{ /* Low Latency Interrupt TCP Port */
413		struct igb_option opt = {
414			.type = range_option,
415			.name = "Low Latency Interrupt TCP Port",
416			.err  = "using default of " __MODULE_STRING(DEFAULT_LLIPORT),
417			.def  = DEFAULT_LLIPORT,
418			.arg  = { .r = { .min = MIN_LLIPORT,
419					 .max = MAX_LLIPORT } }
420		};
421
422#ifdef module_param_array
423		if (num_LLIPort > bd) {
424#endif
425			adapter->lli_port = LLIPort[bd];
426			if (adapter->lli_port) {
427				igb_validate_option(&adapter->lli_port, &opt,
428				        adapter);
429			} else {
430				DPRINTK(PROBE, INFO, "%s turned off\n",
431					opt.name);
432			}
433#ifdef module_param_array
434		} else {
435			adapter->lli_port = opt.def;
436		}
437#endif
438	}
439	{ /* Low Latency Interrupt on Packet Size */
440		struct igb_option opt = {
441			.type = range_option,
442			.name = "Low Latency Interrupt on Packet Size",
443			.err  = "using default of " __MODULE_STRING(DEFAULT_LLISIZE),
444			.def  = DEFAULT_LLISIZE,
445			.arg  = { .r = { .min = MIN_LLISIZE,
446					 .max = MAX_LLISIZE } }
447		};
448
449#ifdef module_param_array
450		if (num_LLISize > bd) {
451#endif
452			adapter->lli_size = LLISize[bd];
453			if (adapter->lli_size) {
454				igb_validate_option(&adapter->lli_size, &opt,
455				        adapter);
456			} else {
457				DPRINTK(PROBE, INFO, "%s turned off\n",
458					opt.name);
459			}
460#ifdef module_param_array
461		} else {
462			adapter->lli_size = opt.def;
463		}
464#endif
465	}
466	{ /* Low Latency Interrupt on TCP Push flag */
467		struct igb_option opt = {
468			.type = enable_option,
469			.name = "Low Latency Interrupt on TCP Push flag",
470			.err  = "defaulting to Disabled",
471			.def  = OPTION_DISABLED
472		};
473
474#ifdef module_param_array
475		if (num_LLIPush > bd) {
476#endif
477			unsigned int lli_push = LLIPush[bd];
478			igb_validate_option(&lli_push, &opt, adapter);
479			adapter->flags |= lli_push ? IGB_FLAG_LLI_PUSH : 0;
480#ifdef module_param_array
481		} else {
482			adapter->flags |= opt.def ? IGB_FLAG_LLI_PUSH : 0;
483		}
484#endif
485	}
486	{ /* SRIOV - Enable SR-IOV VF devices */
487		struct igb_option opt = {
488			.type = range_option,
489			.name = "max_vfs - SR-IOV VF devices",
490			.err  = "using default of " __MODULE_STRING(DEFAULT_SRIOV),
491			.def  = DEFAULT_SRIOV,
492			.arg  = { .r = { .min = MIN_SRIOV,
493					 .max = MAX_SRIOV } }
494		};
495
496#ifdef module_param_array
497		if (num_max_vfs > bd) {
498#endif
499			adapter->vfs_allocated_count = max_vfs[bd];
500			igb_validate_option(&adapter->vfs_allocated_count, &opt, adapter);
501
502#ifdef module_param_array
503		} else {
504			adapter->vfs_allocated_count = opt.def;
505		}
506#endif
507		if (adapter->vfs_allocated_count) {
508			switch (hw->mac.type) {
509			case e1000_82575:
510			case e1000_82580:
511			case e1000_i210:
512			case e1000_i211:
513			case e1000_i354:
514				adapter->vfs_allocated_count = 0;
515				DPRINTK(PROBE, INFO, "SR-IOV option max_vfs not supported.\n");
516			default:
517				break;
518			}
519		}
520	}
521	{ /* VMDQ - Enable VMDq multiqueue receive */
522		struct igb_option opt = {
523			.type = range_option,
524			.name = "VMDQ - VMDq multiqueue queue count",
525			.err  = "using default of " __MODULE_STRING(DEFAULT_VMDQ),
526			.def  = DEFAULT_VMDQ,
527			.arg  = { .r = { .min = MIN_VMDQ,
528					 .max = (MAX_VMDQ - adapter->vfs_allocated_count) } }
529		};
530		if ((hw->mac.type != e1000_i210) ||
531		    (hw->mac.type != e1000_i211)) {
532#ifdef module_param_array
533		if (num_VMDQ > bd) {
534#endif
535			adapter->vmdq_pools = (VMDQ[bd] == 1 ? 0 : VMDQ[bd]);
536			if (adapter->vfs_allocated_count && !adapter->vmdq_pools) {
537				DPRINTK(PROBE, INFO, "Enabling SR-IOV requires VMDq be set to at least 1\n");
538				adapter->vmdq_pools = 1;
539			}
540			igb_validate_option(&adapter->vmdq_pools, &opt, adapter);
541
542#ifdef module_param_array
543		} else {
544			if (!adapter->vfs_allocated_count)
545				adapter->vmdq_pools = (opt.def == 1 ? 0 : opt.def);
546			else
547				adapter->vmdq_pools = 1;
548		}
549#endif
550#ifdef CONFIG_IGB_VMDQ_NETDEV
551		if (hw->mac.type == e1000_82575 && adapter->vmdq_pools) {
552			DPRINTK(PROBE, INFO, "VMDq not supported on this part.\n");
553			adapter->vmdq_pools = 0;
554		}
555#endif
556
557	} else {
558		DPRINTK(PROBE, INFO, "VMDq option is not supported.\n");
559		adapter->vmdq_pools = opt.def;
560	}
561	}
562	{ /* RSS - Enable RSS multiqueue receives */
563		struct igb_option opt = {
564			.type = range_option,
565			.name = "RSS - RSS multiqueue receive count",
566			.err  = "using default of " __MODULE_STRING(DEFAULT_RSS),
567			.def  = DEFAULT_RSS,
568			.arg  = { .r = { .min = MIN_RSS,
569					 .max = MAX_RSS } }
570		};
571
572		switch (hw->mac.type) {
573		case e1000_82575:
574#ifndef CONFIG_IGB_VMDQ_NETDEV
575			if (!!adapter->vmdq_pools) {
576				if (adapter->vmdq_pools <= 2) {
577					if (adapter->vmdq_pools == 2)
578						opt.arg.r.max = 3;
579				} else {
580					opt.arg.r.max = 1;
581				}
582			} else {
583				opt.arg.r.max = 4;
584			}
585#else
586			opt.arg.r.max = !!adapter->vmdq_pools ? 1 : 4;
587#endif /* CONFIG_IGB_VMDQ_NETDEV */
588			break;
589		case e1000_i210:
590			opt.arg.r.max = 4;
591			break;
592		case e1000_i211:
593			opt.arg.r.max = 2;
594			break;
595		case e1000_82576:
596#ifndef CONFIG_IGB_VMDQ_NETDEV
597			if (!!adapter->vmdq_pools)
598				opt.arg.r.max = 2;
599			break;
600#endif /* CONFIG_IGB_VMDQ_NETDEV */
601		case e1000_82580:
602		case e1000_i350:
603		case e1000_i354:
604		default:
605			if (!!adapter->vmdq_pools)
606				opt.arg.r.max = 1;
607			break;
608		}
609
610		if (adapter->int_mode != IGB_INT_MODE_MSIX) {
611			DPRINTK(PROBE, INFO, "RSS is not supported when in MSI/Legacy Interrupt mode, %s\n",
612				opt.err);
613			opt.arg.r.max = 1;
614		}
615
616#ifdef module_param_array
617		if (num_RSS > bd) {
618#endif
619			adapter->rss_queues = RSS[bd];
620			switch (adapter->rss_queues) {
621			case 1:
622				break;
623			default:
624				igb_validate_option(&adapter->rss_queues, &opt, adapter);
625				if (adapter->rss_queues)
626					break;
627			case 0:
628				adapter->rss_queues = min_t(u32, opt.arg.r.max, num_online_cpus());
629				break;
630			}
631#ifdef module_param_array
632		} else {
633			adapter->rss_queues = opt.def;
634		}
635#endif
636	}
637	{ /* QueuePairs - Enable Tx/Rx queue pairs for interrupt handling */
638		struct igb_option opt = {
639			.type = enable_option,
640			.name = "QueuePairs - Tx/Rx queue pairs for interrupt handling",
641			.err  = "defaulting to Enabled",
642			.def  = OPTION_ENABLED
643		};
644#ifdef module_param_array
645		if (num_QueuePairs > bd) {
646#endif
647			unsigned int qp = QueuePairs[bd];
648			/*
649			 * We must enable queue pairs if the number of queues
650			 * exceeds the number of available interrupts. We are
651			 * limited to 10, or 3 per unallocated vf. On I210 and
652			 * I211 devices, we are limited to 5 interrupts.
653			 * However, since I211 only supports 2 queues, we do not
654			 * need to check and override the user option.
655			 */
656			if (qp == OPTION_DISABLED) {
657				if (adapter->rss_queues > 4)
658					qp = OPTION_ENABLED;
659
660				if (adapter->vmdq_pools > 4)
661					qp = OPTION_ENABLED;
662
663				if (adapter->rss_queues > 1 &&
664				    (adapter->vmdq_pools > 3 ||
665				     adapter->vfs_allocated_count > 6))
666					qp = OPTION_ENABLED;
667
668				if (hw->mac.type == e1000_i210 &&
669				    adapter->rss_queues > 2)
670					qp = OPTION_ENABLED;
671
672				if (qp == OPTION_ENABLED)
673					DPRINTK(PROBE, INFO, "Number of queues exceeds available interrupts, %s\n",
674						opt.err);
675			}
676			igb_validate_option(&qp, &opt, adapter);
677			adapter->flags |= qp ? IGB_FLAG_QUEUE_PAIRS : 0;
678#ifdef module_param_array
679		} else {
680			adapter->flags |= opt.def ? IGB_FLAG_QUEUE_PAIRS : 0;
681		}
682#endif
683	}
684	{ /* EEE -  Enable EEE for capable adapters */
685
686		if (hw->mac.type >= e1000_i350) {
687			struct igb_option opt = {
688				.type = enable_option,
689				.name = "EEE Support",
690				.err  = "defaulting to Enabled",
691				.def  = OPTION_ENABLED
692			};
693#ifdef module_param_array
694			if (num_EEE > bd) {
695#endif
696				unsigned int eee = EEE[bd];
697				igb_validate_option(&eee, &opt, adapter);
698				adapter->flags |= eee ? IGB_FLAG_EEE : 0;
699				if (eee)
700					hw->dev_spec._82575.eee_disable = false;
701				else
702					hw->dev_spec._82575.eee_disable = true;
703
704#ifdef module_param_array
705			} else {
706				adapter->flags |= opt.def ? IGB_FLAG_EEE : 0;
707				if (adapter->flags & IGB_FLAG_EEE)
708					hw->dev_spec._82575.eee_disable = false;
709				else
710					hw->dev_spec._82575.eee_disable = true;
711			}
712#endif
713		}
714	}
715	{ /* DMAC -  Enable DMA Coalescing for capable adapters */
716
717		if (hw->mac.type >= e1000_i350) {
718			struct igb_opt_list list [] = {
719				{ IGB_DMAC_DISABLE, "DMAC Disable"},
720				{ IGB_DMAC_MIN, "DMAC 250 usec"},
721				{ IGB_DMAC_500, "DMAC 500 usec"},
722				{ IGB_DMAC_EN_DEFAULT, "DMAC 1000 usec"},
723				{ IGB_DMAC_2000, "DMAC 2000 usec"},
724				{ IGB_DMAC_3000, "DMAC 3000 usec"},
725				{ IGB_DMAC_4000, "DMAC 4000 usec"},
726				{ IGB_DMAC_5000, "DMAC 5000 usec"},
727				{ IGB_DMAC_6000, "DMAC 6000 usec"},
728				{ IGB_DMAC_7000, "DMAC 7000 usec"},
729				{ IGB_DMAC_8000, "DMAC 8000 usec"},
730				{ IGB_DMAC_9000, "DMAC 9000 usec"},
731				{ IGB_DMAC_MAX, "DMAC 10000 usec"}
732			};
733			struct igb_option opt = {
734				.type = list_option,
735				.name = "DMA Coalescing",
736				.err  = "using default of "__MODULE_STRING(IGB_DMAC_DISABLE),
737				.def  = IGB_DMAC_DISABLE,
738				.arg = { .l = { .nr = 13,
739					 	.p = list
740					}
741				}
742			};
743#ifdef module_param_array
744			if (num_DMAC > bd) {
745#endif
746				unsigned int dmac = DMAC[bd];
747				if (adapter->rx_itr_setting == IGB_DMAC_DISABLE)
748					dmac = IGB_DMAC_DISABLE;
749				igb_validate_option(&dmac, &opt, adapter);
750				switch (dmac) {
751				case IGB_DMAC_DISABLE:
752					adapter->dmac = dmac;
753					break;
754				case IGB_DMAC_MIN:
755					adapter->dmac = dmac;
756					break;
757				case IGB_DMAC_500:
758					adapter->dmac = dmac;
759					break;
760				case IGB_DMAC_EN_DEFAULT:
761					adapter->dmac = dmac;
762					break;
763				case IGB_DMAC_2000:
764					adapter->dmac = dmac;
765					break;
766				case IGB_DMAC_3000:
767					adapter->dmac = dmac;
768					break;
769				case IGB_DMAC_4000:
770					adapter->dmac = dmac;
771					break;
772				case IGB_DMAC_5000:
773					adapter->dmac = dmac;
774					break;
775				case IGB_DMAC_6000:
776					adapter->dmac = dmac;
777					break;
778				case IGB_DMAC_7000:
779					adapter->dmac = dmac;
780					break;
781				case IGB_DMAC_8000:
782					adapter->dmac = dmac;
783					break;
784				case IGB_DMAC_9000:
785					adapter->dmac = dmac;
786					break;
787				case IGB_DMAC_MAX:
788					adapter->dmac = dmac;
789					break;
790				default:
791					adapter->dmac = opt.def;
792					DPRINTK(PROBE, INFO,
793					"Invalid DMAC setting, "
794					"resetting DMAC to %d\n", opt.def);
795				}
796#ifdef module_param_array
797			} else
798				adapter->dmac = opt.def;
799#endif
800		}
801	}
802#ifndef IGB_NO_LRO
803	{ /* LRO - Enable Large Receive Offload */
804		struct igb_option opt = {
805			.type = enable_option,
806			.name = "LRO - Large Receive Offload",
807			.err  = "defaulting to Disabled",
808			.def  = OPTION_DISABLED
809		};
810		struct net_device *netdev = adapter->netdev;
811#ifdef module_param_array
812		if (num_LRO > bd) {
813#endif
814			unsigned int lro = LRO[bd];
815			igb_validate_option(&lro, &opt, adapter);
816			netdev->features |= lro ? NETIF_F_LRO : 0;
817#ifdef module_param_array
818		} else if (opt.def == OPTION_ENABLED) {
819			netdev->features |= NETIF_F_LRO;
820		}
821#endif
822	}
823#endif /* IGB_NO_LRO */
824	{ /* MDD - Enable Malicious Driver Detection. Only available when
825	     SR-IOV is enabled. */
826		struct igb_option opt = {
827			.type = enable_option,
828			.name = "Malicious Driver Detection",
829			.err  = "defaulting to 1",
830			.def  = OPTION_ENABLED,
831			.arg  = { .r = { .min = OPTION_DISABLED,
832					 .max = OPTION_ENABLED } }
833		};
834
835#ifdef module_param_array
836		if (num_MDD > bd) {
837#endif
838			adapter->mdd = MDD[bd];
839			igb_validate_option((uint *)&adapter->mdd, &opt,
840					    adapter);
841#ifdef module_param_array
842		} else {
843			adapter->mdd = opt.def;
844		}
845#endif
846	}
847}
848