-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathixgbe_param.c
1256 lines (1146 loc) · 31.8 KB
/
ixgbe_param.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
Intel(R) 10GbE PCI Express Linux Network Driver
Copyright(c) 1999 - 2017 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
Linux NICS <linux.nics@intel.com>
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#include <linux/types.h>
#include <linux/module.h>
#include "ixgbe.h"
/* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage.
*/
#define IXGBE_MAX_NIC 32
#define OPTION_UNSET -1
#define OPTION_DISABLED 0
#define OPTION_ENABLED 1
#define STRINGIFY(foo) #foo /* magic for getting defines into strings */
#define XSTRINGIFY(bar) STRINGIFY(bar)
/* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs).
*/
#define IXGBE_PARAM_INIT { [0 ... IXGBE_MAX_NIC] = OPTION_UNSET }
#ifndef module_param_array
/* Module Parameters are always initialized to -1, so that the driver
* can tell the difference between no user specified value or the
* user asking for the default value.
* The true default values are loaded in when ixgbe_check_options is called.
*
* This is a GCC extension to ANSI C.
* See the item "Labelled Elements in Initializers" in the section
* "Extensions to the C Language Family" of the GCC documentation.
*/
#define IXGBE_PARAM(X, desc) \
static const int __devinitdata X[IXGBE_MAX_NIC+1] = IXGBE_PARAM_INIT; \
MODULE_PARM(X, "1-" __MODULE_STRING(IXGBE_MAX_NIC) "i"); \
MODULE_PARM_DESC(X, desc);
#else
#define IXGBE_PARAM(X, desc) \
static int __devinitdata X[IXGBE_MAX_NIC+1] = IXGBE_PARAM_INIT; \
static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
#endif
IXGBE_PARAM(EEE, "Energy Efficient Ethernet (EEE) ,0=disabled, 1=enabled )"
"default EEE disable");
/* IntMode (Interrupt Mode)
*
* Valid Range: 0-2
* - 0 - Legacy Interrupt
* - 1 - MSI Interrupt
* - 2 - MSI-X Interrupt(s)
*
* Default Value: 2
*/
IXGBE_PARAM(InterruptType, "Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), "
"default IntMode (deprecated)");
IXGBE_PARAM(IntMode, "Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), "
"default 2");
#define IXGBE_INT_LEGACY 0
#define IXGBE_INT_MSI 1
#define IXGBE_INT_MSIX 2
/* MQ - Multiple Queue enable/disable
*
* Valid Range: 0, 1
* - 0 - disables MQ
* - 1 - enables MQ
*
* Default Value: 1
*/
IXGBE_PARAM(MQ, "Disable or enable Multiple Queues, default 1");
#if IS_ENABLED(CONFIG_DCA)
/* DCA - Direct Cache Access (DCA) Control
*
* This option allows the device to hint to DCA enabled processors
* which CPU should have its cache warmed with the data being
* transferred over PCIe. This can increase performance by reducing
* cache misses. ixgbe hardware supports DCA for:
* tx descriptor writeback
* rx descriptor writeback
* rx data
* rx data header only (in packet split mode)
*
* enabling option 2 can cause cache thrash in some tests, particularly
* if the CPU is completely utilized
*
* Valid Range: 0 - 2
* - 0 - disables DCA
* - 1 - enables DCA
* - 2 - enables DCA with rx data included
*
* Default Value: 2
*/
#define IXGBE_MAX_DCA 2
IXGBE_PARAM(DCA, "Disable or enable Direct Cache Access, 0=disabled, "
"1=descriptor only, 2=descriptor and data");
#endif /* CONFIG_DCA */
/* RSS - Receive-Side Scaling (RSS) Descriptor Queues
*
* Valid Range: 0-16
* - 0 - enables RSS and sets the Desc. Q's to min(16, num_online_cpus()).
* - 1-16 - enables RSS and sets the Desc. Q's to the specified value.
*
* Default Value: 0
*/
IXGBE_PARAM(RSS, "Number of Receive-Side Scaling Descriptor Queues, "
"default 0=number of cpus");
/* VMDQ - Virtual Machine Device Queues (VMDQ)
*
* Valid Range: 1-16
* - 0/1 Disables VMDQ by allocating only a single queue.
* - 2-16 - enables VMDQ and sets the Desc. Q's to the specified value.
*
* Default Value: 8
*/
#define IXGBE_DEFAULT_NUM_VMDQ 8
IXGBE_PARAM(VMDQ, "Number of Virtual Machine Device Queues: 0/1 = disable (1 queue) "
"2-16 enable (default=" XSTRINGIFY(IXGBE_DEFAULT_NUM_VMDQ) ")");
#ifdef CONFIG_PCI_IOV
/* max_vfs - SR I/O Virtualization
*
* Valid Range: 0-63
* - 0 Disables SR-IOV
* - 1-63 - enables SR-IOV and sets the number of VFs enabled
*
* Default Value: 0
*/
#define MAX_SRIOV_VFS 63
IXGBE_PARAM(max_vfs, "Number of Virtual Functions: 0 = disable (default), "
"1-" XSTRINGIFY(MAX_SRIOV_VFS) " = enable "
"this many VFs");
/* VEPA - Set internal bridge to VEPA mode
*
* Valid Range: 0-1
* - 0 Set bridge to VEB mode
* - 1 Set bridge to VEPA mode
*
* Default Value: 0
*/
/*
*Note:
*=====
* This provides ability to ensure VEPA mode on the internal bridge even if
* the kernel does not support the netdev bridge setting operations.
*/
IXGBE_PARAM(VEPA, "VEPA Bridge Mode: 0 = VEB (default), 1 = VEPA");
#endif
/* Interrupt Throttle Rate (interrupts/sec)
*
* Valid Range: 956-488281 (0=off, 1=dynamic)
*
* Default Value: 1
*/
#define DEFAULT_ITR 1
IXGBE_PARAM(InterruptThrottleRate, "Maximum interrupts per second, per vector, "
"(0,1,956-488281), default 1");
#define MAX_ITR IXGBE_MAX_INT_RATE
#define MIN_ITR IXGBE_MIN_INT_RATE
#ifndef IXGBE_NO_LLI
/* LLIPort (Low Latency Interrupt TCP Port)
*
* Valid Range: 0 - 65535
*
* Default Value: 0 (disabled)
*/
IXGBE_PARAM(LLIPort, "Low Latency Interrupt TCP Port (0-65535)");
#define DEFAULT_LLIPORT 0
#define MAX_LLIPORT 0xFFFF
#define MIN_LLIPORT 0
/* LLIPush (Low Latency Interrupt on TCP Push flag)
*
* Valid Range: 0,1
*
* Default Value: 0 (disabled)
*/
IXGBE_PARAM(LLIPush, "Low Latency Interrupt on TCP Push flag (0,1)");
#define DEFAULT_LLIPUSH 0
#define MAX_LLIPUSH 1
#define MIN_LLIPUSH 0
/* LLISize (Low Latency Interrupt on Packet Size)
*
* Valid Range: 0 - 1500
*
* Default Value: 0 (disabled)
*/
IXGBE_PARAM(LLISize, "Low Latency Interrupt on Packet Size (0-1500)");
#define DEFAULT_LLISIZE 0
#define MAX_LLISIZE 1500
#define MIN_LLISIZE 0
/* LLIEType (Low Latency Interrupt Ethernet Type)
*
* Valid Range: 0 - 0x8fff
*
* Default Value: 0 (disabled)
*/
IXGBE_PARAM(LLIEType, "Low Latency Interrupt Ethernet Protocol Type");
#define DEFAULT_LLIETYPE 0
#define MAX_LLIETYPE 0x8fff
#define MIN_LLIETYPE 0
/* LLIVLANP (Low Latency Interrupt on VLAN priority threshold)
*
* Valid Range: 0 - 7
*
* Default Value: 0 (disabled)
*/
IXGBE_PARAM(LLIVLANP, "Low Latency Interrupt on VLAN priority threshold");
#define DEFAULT_LLIVLANP 0
#define MAX_LLIVLANP 7
#define MIN_LLIVLANP 0
#endif /* IXGBE_NO_LLI */
#ifdef HAVE_TX_MQ
/* Flow Director packet buffer allocation level
*
* Valid Range: 1-3
* 1 = 8k hash/2k perfect,
* 2 = 16k hash/4k perfect,
* 3 = 32k hash/8k perfect
*
* Default Value: 0
*/
IXGBE_PARAM(FdirPballoc, "Flow Director packet buffer allocation level:\n"
"\t\t\t1 = 8k hash filters or 2k perfect filters\n"
"\t\t\t2 = 16k hash filters or 4k perfect filters\n"
"\t\t\t3 = 32k hash filters or 8k perfect filters");
#define IXGBE_DEFAULT_FDIR_PBALLOC IXGBE_FDIR_PBALLOC_64K
/* Software ATR packet sample rate
*
* Valid Range: 0-255 0 = off, 1-255 = rate of Tx packet inspection
*
* Default Value: 20
*/
IXGBE_PARAM(AtrSampleRate, "Software ATR Tx packet sample rate");
#define IXGBE_MAX_ATR_SAMPLE_RATE 255
#define IXGBE_MIN_ATR_SAMPLE_RATE 1
#define IXGBE_ATR_SAMPLE_RATE_OFF 0
#define IXGBE_DEFAULT_ATR_SAMPLE_RATE 20
#endif /* HAVE_TX_MQ */
#if IS_ENABLED(CONFIG_FCOE)
/* FCoE - Fibre Channel over Ethernet Offload Enable/Disable
*
* Valid Range: 0, 1
* - 0 - disables FCoE Offload
* - 1 - enables FCoE Offload
*
* Default Value: 1
*/
IXGBE_PARAM(FCoE, "Disable or enable FCoE Offload, default 1");
#endif /* CONFIG_FCOE */
/* Enable/disable Malicious Driver Detection
*
* Valid Values: 0(off), 1(on)
*
* Default Value: 1
*/
IXGBE_PARAM(MDD, "Malicious Driver Detection: (0,1), default 1 = on");
/* Enable/disable Large Receive Offload
*
* Valid Values: 0(off), 1(on)
*
* Default Value: 1
*/
IXGBE_PARAM(LRO, "Large Receive Offload (0,1), default 0 = off");
/* Enable/disable support for untested SFP+ modules on 82599-based adapters
*
* Valid Values: 0(Disable), 1(Enable)
*
* Default Value: 0
*/
IXGBE_PARAM(allow_unsupported_sfp, "Allow unsupported and untested "
"SFP+ modules on 82599 based adapters, default 0 = Disable");
/* Enable/disable support for DMA coalescing
*
* Valid Values: 0(off), 41 - 10000(on)
*
* Default Value: 0
*/
IXGBE_PARAM(dmac_watchdog,
"DMA coalescing watchdog in microseconds (0,41-10000), default 0 = off");
/* Enable/disable support for VXLAN rx checksum offload
*
* Valid Values: 0(Disable), 1(Enable)
*
* Default Value: 1 on hardware that supports it
*/
IXGBE_PARAM(vxlan_rx,
"VXLAN receive checksum offload (0,1), default 1 = Enable");
struct ixgbe_option {
enum { enable_option, range_option, list_option } type;
const char *name;
const char *err;
const char *msg;
int def;
union {
struct { /* range_option info */
int min;
int max;
} r;
struct { /* list_option info */
int nr;
const struct ixgbe_opt_list {
int i;
char *str;
} *p;
} l;
} arg;
};
#ifndef IXGBE_NO_LLI
#ifdef module_param_array
/**
* helper function to determine LLI support
*
* LLI is only supported for 82599 and X540
* LLIPush is not supported on 82599
**/
static bool __devinit ixgbe_lli_supported(struct ixgbe_adapter *adapter,
struct ixgbe_option *opt)
{
struct ixgbe_hw *hw = &adapter->hw;
if (hw->mac.type == ixgbe_mac_82599EB) {
if (LLIPush[adapter->bd_number] > 0)
goto not_supp;
return true;
}
if (hw->mac.type == ixgbe_mac_X540)
return true;
not_supp:
DPRINTK(PROBE, INFO, "%s not supported on this HW\n", opt->name);
return false;
}
#endif /* module_param_array */
#endif /* IXGBE_NO_LLI */
static int __devinit ixgbe_validate_option(unsigned int *value,
struct ixgbe_option *opt)
{
if (*value == OPTION_UNSET) {
printk(KERN_INFO "ixgbe: Invalid %s specified (%d), %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return 0;
}
switch (opt->type) {
case enable_option:
switch (*value) {
case OPTION_ENABLED:
printk(KERN_INFO "ixgbe: %s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
printk(KERN_INFO "ixgbe: %s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if ((*value >= opt->arg.r.min && *value <= opt->arg.r.max) ||
*value == opt->def) {
if (opt->msg)
printk(KERN_INFO "ixgbe: %s set to %d, %s\n",
opt->name, *value, opt->msg);
else
printk(KERN_INFO "ixgbe: %s set to %d\n",
opt->name, *value);
return 0;
}
break;
case list_option: {
int i;
for (i = 0; i < opt->arg.l.nr; i++) {
const struct ixgbe_opt_list *ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
printk(KERN_INFO "%s\n", ent->str);
return 0;
}
}
}
break;
default:
BUG();
}
printk(KERN_INFO "ixgbe: Invalid %s specified (%d), %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
#define LIST_LEN(l) (sizeof(l) / sizeof(l[0]))
/**
* ixgbe_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
void __devinit ixgbe_check_options(struct ixgbe_adapter *adapter)
{
unsigned int mdd;
int bd = adapter->bd_number;
u32 *aflags = &adapter->flags;
struct ixgbe_ring_feature *feature = adapter->ring_feature;
unsigned int vmdq;
if (bd >= IXGBE_MAX_NIC) {
printk(KERN_NOTICE
"Warning: no configuration for board #%d\n", bd);
printk(KERN_NOTICE "Using defaults for all values\n");
#ifndef module_param_array
bd = IXGBE_MAX_NIC;
#endif
}
{ /* Interrupt Mode */
unsigned int int_mode;
static struct ixgbe_option opt = {
.type = range_option,
.name = "Interrupt Mode",
.err =
"using default of " __MODULE_STRING(IXGBE_INT_MSIX),
.def = IXGBE_INT_MSIX,
.arg = { .r = { .min = IXGBE_INT_LEGACY,
.max = IXGBE_INT_MSIX} }
};
#ifdef module_param_array
if (num_IntMode > bd || num_InterruptType > bd) {
#endif
int_mode = IntMode[bd];
if (int_mode == OPTION_UNSET)
int_mode = InterruptType[bd];
ixgbe_validate_option(&int_mode, &opt);
switch (int_mode) {
case IXGBE_INT_MSIX:
if (!(*aflags & IXGBE_FLAG_MSIX_CAPABLE))
printk(KERN_INFO
"Ignoring MSI-X setting; "
"support unavailable\n");
break;
case IXGBE_INT_MSI:
if (!(*aflags & IXGBE_FLAG_MSI_CAPABLE)) {
printk(KERN_INFO
"Ignoring MSI setting; "
"support unavailable\n");
} else {
*aflags &= ~IXGBE_FLAG_MSIX_CAPABLE;
}
break;
case IXGBE_INT_LEGACY:
default:
*aflags &= ~IXGBE_FLAG_MSIX_CAPABLE;
*aflags &= ~IXGBE_FLAG_MSI_CAPABLE;
break;
}
#ifdef module_param_array
} else {
/* default settings */
if (*aflags & IXGBE_FLAG_MSIX_CAPABLE) {
*aflags |= IXGBE_FLAG_MSI_CAPABLE;
} else {
*aflags &= ~IXGBE_FLAG_MSIX_CAPABLE;
*aflags &= ~IXGBE_FLAG_MSI_CAPABLE;
}
}
#endif
}
{ /* Multiple Queue Support */
static struct ixgbe_option opt = {
.type = enable_option,
.name = "Multiple Queue Support",
.err = "defaulting to Enabled",
.def = OPTION_ENABLED
};
#ifdef module_param_array
if (num_MQ > bd) {
#endif
unsigned int mq = MQ[bd];
ixgbe_validate_option(&mq, &opt);
if (mq)
*aflags |= IXGBE_FLAG_MQ_CAPABLE;
else
*aflags &= ~IXGBE_FLAG_MQ_CAPABLE;
#ifdef module_param_array
} else {
*aflags |= IXGBE_FLAG_MQ_CAPABLE;
}
#endif
/* Check Interoperability */
if ((*aflags & IXGBE_FLAG_MQ_CAPABLE) &&
!(*aflags & IXGBE_FLAG_MSIX_CAPABLE)) {
DPRINTK(PROBE, INFO,
"Multiple queues are not supported while MSI-X "
"is disabled. Disabling Multiple Queues.\n");
*aflags &= ~IXGBE_FLAG_MQ_CAPABLE;
}
}
#if IS_ENABLED(CONFIG_DCA)
{ /* Direct Cache Access (DCA) */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Direct Cache Access (DCA)",
.err = "defaulting to Enabled",
.def = IXGBE_MAX_DCA,
.arg = { .r = { .min = OPTION_DISABLED,
.max = IXGBE_MAX_DCA} }
};
unsigned int dca = opt.def;
#ifdef module_param_array
if (num_DCA > bd) {
#endif
dca = DCA[bd];
ixgbe_validate_option(&dca, &opt);
if (!dca)
*aflags &= ~IXGBE_FLAG_DCA_CAPABLE;
/* Check Interoperability */
if (!(*aflags & IXGBE_FLAG_DCA_CAPABLE)) {
DPRINTK(PROBE, INFO, "DCA is disabled\n");
*aflags &= ~IXGBE_FLAG_DCA_ENABLED;
}
if (dca == IXGBE_MAX_DCA) {
DPRINTK(PROBE, INFO,
"DCA enabled for rx data\n");
adapter->flags |= IXGBE_FLAG_DCA_ENABLED_DATA;
}
#ifdef module_param_array
} else {
/* make sure to clear the capability flag if the
* option is disabled by default above */
if (opt.def == OPTION_DISABLED)
*aflags &= ~IXGBE_FLAG_DCA_CAPABLE;
}
#endif
if (dca == IXGBE_MAX_DCA)
adapter->flags |= IXGBE_FLAG_DCA_ENABLED_DATA;
}
#endif /* CONFIG_DCA */
{ /* Receive-Side Scaling (RSS) */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Receive-Side Scaling (RSS)",
.err = "using default.",
.def = 0,
.arg = { .r = { .min = 0,
.max = 16} }
};
unsigned int rss = RSS[bd];
/* adjust Max allowed RSS queues based on MAC type */
opt.arg.r.max = ixgbe_max_rss_indices(adapter);
#ifdef module_param_array
if (num_RSS > bd) {
#endif
ixgbe_validate_option(&rss, &opt);
/* base it off num_online_cpus() with hardware limit */
if (!rss)
rss = min_t(int, opt.arg.r.max,
num_online_cpus());
else
feature[RING_F_FDIR].limit = rss;
feature[RING_F_RSS].limit = rss;
#ifdef module_param_array
} else if (opt.def == 0) {
rss = min_t(int, ixgbe_max_rss_indices(adapter),
num_online_cpus());
feature[RING_F_RSS].limit = rss;
}
#endif
/* Check Interoperability */
if (rss > 1) {
if (!(*aflags & IXGBE_FLAG_MQ_CAPABLE)) {
DPRINTK(PROBE, INFO,
"Multiqueue is disabled. "
"Limiting RSS.\n");
feature[RING_F_RSS].limit = 1;
}
}
}
{ /* Virtual Machine Device Queues (VMDQ) */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Virtual Machine Device Queues (VMDQ)",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED,
.arg = { .r = { .min = OPTION_DISABLED,
.max = IXGBE_MAX_VMDQ_INDICES
} }
};
switch (adapter->hw.mac.type) {
case ixgbe_mac_82598EB:
/* 82598 only supports up to 16 pools */
opt.arg.r.max = 16;
break;
default:
break;
}
#ifdef module_param_array
if (num_VMDQ > bd) {
#endif
vmdq = VMDQ[bd];
ixgbe_validate_option(&vmdq, &opt);
/* zero or one both mean disabled from our driver's
* perspective */
if (vmdq > 1) {
*aflags |= IXGBE_FLAG_VMDQ_ENABLED;
} else
*aflags &= ~IXGBE_FLAG_VMDQ_ENABLED;
feature[RING_F_VMDQ].limit = vmdq;
#ifdef module_param_array
} else {
if (opt.def == OPTION_DISABLED)
*aflags &= ~IXGBE_FLAG_VMDQ_ENABLED;
else
*aflags |= IXGBE_FLAG_VMDQ_ENABLED;
feature[RING_F_VMDQ].limit = opt.def;
}
#endif
/* Check Interoperability */
if (*aflags & IXGBE_FLAG_VMDQ_ENABLED) {
if (!(*aflags & IXGBE_FLAG_MQ_CAPABLE)) {
DPRINTK(PROBE, INFO,
"VMDQ is not supported while multiple "
"queues are disabled. "
"Disabling VMDQ.\n");
*aflags &= ~IXGBE_FLAG_VMDQ_ENABLED;
feature[RING_F_VMDQ].limit = 0;
}
}
}
#ifdef CONFIG_PCI_IOV
{ /* Single Root I/O Virtualization (SR-IOV) */
static struct ixgbe_option opt = {
.type = range_option,
.name = "I/O Virtualization (IOV)",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED,
.arg = { .r = { .min = OPTION_DISABLED,
.max = MAX_SRIOV_VFS} }
};
#ifdef module_param_array
if (num_max_vfs > bd) {
#endif
unsigned int vfs = max_vfs[bd];
if (ixgbe_validate_option(&vfs, &opt)) {
vfs = 0;
DPRINTK(PROBE, INFO,
"max_vfs out of range "
"Disabling SR-IOV.\n");
}
adapter->max_vfs = vfs;
if (vfs)
*aflags |= IXGBE_FLAG_SRIOV_ENABLED;
else
*aflags &= ~IXGBE_FLAG_SRIOV_ENABLED;
#ifdef module_param_array
} else {
if (opt.def == OPTION_DISABLED) {
adapter->max_vfs = 0;
*aflags &= ~IXGBE_FLAG_SRIOV_ENABLED;
} else {
adapter->max_vfs = opt.def;
*aflags |= IXGBE_FLAG_SRIOV_ENABLED;
}
}
#endif
/* Check Interoperability */
if (*aflags & IXGBE_FLAG_SRIOV_ENABLED) {
if (!(*aflags & IXGBE_FLAG_SRIOV_CAPABLE)) {
DPRINTK(PROBE, INFO,
"IOV is not supported on this "
"hardware. Disabling IOV.\n");
*aflags &= ~IXGBE_FLAG_SRIOV_ENABLED;
adapter->max_vfs = 0;
} else if (!(*aflags & IXGBE_FLAG_MQ_CAPABLE)) {
DPRINTK(PROBE, INFO,
"IOV is not supported while multiple "
"queues are disabled. "
"Disabling IOV.\n");
*aflags &= ~IXGBE_FLAG_SRIOV_ENABLED;
adapter->max_vfs = 0;
}
}
}
{ /* VEPA Bridge Mode enable for SR-IOV mode */
static struct ixgbe_option opt = {
.type = range_option,
.name = "VEPA Bridge Mode Enable",
.err = "defaulting to disabled",
.def = OPTION_DISABLED,
.arg = { .r = { .min = OPTION_DISABLED,
.max = OPTION_ENABLED} }
};
#ifdef module_param_array
if (num_VEPA > bd) {
#endif
unsigned int vepa = VEPA[bd];
ixgbe_validate_option(&vepa, &opt);
if (vepa)
adapter->flags |=
IXGBE_FLAG_SRIOV_VEPA_BRIDGE_MODE;
#ifdef module_param_array
} else {
if (opt.def == OPTION_ENABLED)
adapter->flags |=
IXGBE_FLAG_SRIOV_VEPA_BRIDGE_MODE;
}
#endif
}
#endif /* CONFIG_PCI_IOV */
{ /* Interrupt Throttling Rate */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of "__MODULE_STRING(DEFAULT_ITR),
.def = DEFAULT_ITR,
.arg = { .r = { .min = MIN_ITR,
.max = MAX_ITR } }
};
#ifdef module_param_array
if (num_InterruptThrottleRate > bd) {
#endif
u32 itr = InterruptThrottleRate[bd];
switch (itr) {
case 0:
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
adapter->rx_itr_setting = 0;
break;
case 1:
DPRINTK(PROBE, INFO, "dynamic interrupt "
"throttling enabled\n");
adapter->rx_itr_setting = 1;
break;
default:
ixgbe_validate_option(&itr, &opt);
/* the first bit is used as control */
adapter->rx_itr_setting = (1000000/itr) << 2;
break;
}
adapter->tx_itr_setting = adapter->rx_itr_setting;
#ifdef module_param_array
} else {
adapter->rx_itr_setting = opt.def;
adapter->tx_itr_setting = opt.def;
}
#endif
}
#ifndef IXGBE_NO_LLI
{ /* Low Latency Interrupt TCP Port*/
static struct ixgbe_option opt = {
.type = range_option,
.name = "Low Latency Interrupt TCP Port",
.err = "using default of "
__MODULE_STRING(DEFAULT_LLIPORT),
.def = DEFAULT_LLIPORT,
.arg = { .r = { .min = MIN_LLIPORT,
.max = MAX_LLIPORT } }
};
#ifdef module_param_array
if (num_LLIPort > bd && ixgbe_lli_supported(adapter, &opt)) {
#endif
adapter->lli_port = LLIPort[bd];
if (adapter->lli_port) {
ixgbe_validate_option(&adapter->lli_port, &opt);
} else {
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
}
#ifdef module_param_array
} else {
adapter->lli_port = opt.def;
}
#endif
}
{ /* Low Latency Interrupt on Packet Size */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Low Latency Interrupt on Packet Size",
.err = "using default of "
__MODULE_STRING(DEFAULT_LLISIZE),
.def = DEFAULT_LLISIZE,
.arg = { .r = { .min = MIN_LLISIZE,
.max = MAX_LLISIZE } }
};
#ifdef module_param_array
if (num_LLISize > bd && ixgbe_lli_supported(adapter, &opt)) {
#endif
adapter->lli_size = LLISize[bd];
if (adapter->lli_size) {
ixgbe_validate_option(&adapter->lli_size, &opt);
} else {
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
}
#ifdef module_param_array
} else {
adapter->lli_size = opt.def;
}
#endif
}
{ /*Low Latency Interrupt on TCP Push flag*/
static struct ixgbe_option opt = {
.type = enable_option,
.name = "Low Latency Interrupt on TCP Push flag",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED
};
#ifdef module_param_array
if (num_LLIPush > bd && ixgbe_lli_supported(adapter, &opt)) {
#endif
unsigned int lli_push = LLIPush[bd];
ixgbe_validate_option(&lli_push, &opt);
if (lli_push)
*aflags |= IXGBE_FLAG_LLI_PUSH;
else
*aflags &= ~IXGBE_FLAG_LLI_PUSH;
#ifdef module_param_array
} else {
*aflags &= ~IXGBE_FLAG_LLI_PUSH;
}
#endif
}
{ /* Low Latency Interrupt EtherType*/
static struct ixgbe_option opt = {
.type = range_option,
.name = "Low Latency Interrupt on Ethernet Protocol "
"Type",
.err = "using default of "
__MODULE_STRING(DEFAULT_LLIETYPE),
.def = DEFAULT_LLIETYPE,
.arg = { .r = { .min = MIN_LLIETYPE,
.max = MAX_LLIETYPE } }
};
#ifdef module_param_array
if (num_LLIEType > bd && ixgbe_lli_supported(adapter, &opt)) {
#endif
adapter->lli_etype = LLIEType[bd];
if (adapter->lli_etype) {
ixgbe_validate_option(&adapter->lli_etype,
&opt);
} else {
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
}
#ifdef module_param_array
} else {
adapter->lli_etype = opt.def;
}
#endif
}
{ /* LLI VLAN Priority */
static struct ixgbe_option opt = {
.type = range_option,
.name = "Low Latency Interrupt on VLAN priority "
"threshold",
.err = "using default of "
__MODULE_STRING(DEFAULT_LLIVLANP),
.def = DEFAULT_LLIVLANP,
.arg = { .r = { .min = MIN_LLIVLANP,
.max = MAX_LLIVLANP } }
};
#ifdef module_param_array
if (num_LLIVLANP > bd && ixgbe_lli_supported(adapter, &opt)) {
#endif
adapter->lli_vlan_pri = LLIVLANP[bd];
if (adapter->lli_vlan_pri) {
ixgbe_validate_option(&adapter->lli_vlan_pri,
&opt);
} else {
DPRINTK(PROBE, INFO, "%s turned off\n",
opt.name);
}
#ifdef module_param_array
} else {
adapter->lli_vlan_pri = opt.def;
}
#endif
}
#endif /* IXGBE_NO_LLI */
#ifdef HAVE_TX_MQ
{ /* Flow Director packet buffer allocation */
unsigned int fdir_pballoc_mode;
static struct ixgbe_option opt = {
.type = range_option,
.name = "Flow Director packet buffer allocation",
.err = "using default of "
__MODULE_STRING(IXGBE_DEFAULT_FDIR_PBALLOC),
.def = IXGBE_DEFAULT_FDIR_PBALLOC,
.arg = {.r = {.min = IXGBE_FDIR_PBALLOC_64K,
.max = IXGBE_FDIR_PBALLOC_256K} }
};
char pstring[10];
if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_NONE;
} else if (num_FdirPballoc > bd) {
fdir_pballoc_mode = FdirPballoc[bd];
ixgbe_validate_option(&fdir_pballoc_mode, &opt);
switch (fdir_pballoc_mode) {
case IXGBE_FDIR_PBALLOC_256K:
adapter->fdir_pballoc = IXGBE_FDIR_PBALLOC_256K;
sprintf(pstring, "256kB");
break;
case IXGBE_FDIR_PBALLOC_128K: