devices/e1000e/param-3.14-orig.c
author Florian Pose <fp@igh.de>
Fri, 08 Sep 2017 13:16:57 +0200
branchstable-1.5
changeset 2683 1079c149f22c
parent 2587 afd76ee3aa87
permissions -rw-r--r--
Forgot Makefile.orig.
2587
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*******************************************************************************
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
  Intel PRO/1000 Linux driver
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
  Copyright(c) 1999 - 2013 Intel Corporation.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
  This program is free software; you can redistribute it and/or modify it
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
  under the terms and conditions of the GNU General Public License,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
  version 2, as published by the Free Software Foundation.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
  This program is distributed in the hope it will be useful, but WITHOUT
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
  more details.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
  You should have received a copy of the GNU General Public License along with
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
  this program; if not, write to the Free Software Foundation, Inc.,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
  The full GNU General Public License is included in this distribution in
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
  the file called "COPYING".
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
  Contact Information:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
  Linux NICS <linux.nics@intel.com>
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
*******************************************************************************/
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
#include <linux/netdevice.h>
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
#include <linux/module.h>
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
#include <linux/pci.h>
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
#include "e1000.h"
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
/* This is the only thing that needs to be changed to adjust the
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
 * maximum number of ports that the driver can manage.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
#define E1000_MAX_NIC 32
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#define OPTION_UNSET   -1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#define OPTION_DISABLED 0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#define OPTION_ENABLED  1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#define COPYBREAK_DEFAULT 256
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
unsigned int copybreak = COPYBREAK_DEFAULT;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
module_param(copybreak, uint, 0644);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
MODULE_PARM_DESC(copybreak,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
		 "Maximum size of packet that is copied to a new buffer on receive");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
/* All parameters are treated the same, as an integer array of values.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
 * This macro just reduces the need to repeat the same declaration code
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
 * over and over (plus this helps to avoid typo bugs).
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
#define E1000_PARAM(X, desc)					\
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
	static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT;	\
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
	static unsigned int num_##X;				\
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
	module_param_array_named(X, X, int, &num_##X, 0);	\
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
	MODULE_PARM_DESC(X, desc);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
/* Transmit Interrupt Delay in units of 1.024 microseconds
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
 * Tx interrupt delay needs to typically be set to something non-zero
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
 * Valid Range: 0-65535
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
#define DEFAULT_TIDV 8
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
#define MAX_TXDELAY 0xFFFF
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
#define MIN_TXDELAY 0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
 * Valid Range: 0-65535
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
#define DEFAULT_TADV 32
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
#define MAX_TXABSDELAY 0xFFFF
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
#define MIN_TXABSDELAY 0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
/* Receive Interrupt Delay in units of 1.024 microseconds
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
 * hardware will likely hang if you set this to anything but zero.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
 * Valid Range: 0-65535
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
#define MAX_RXDELAY 0xFFFF
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
#define MIN_RXDELAY 0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
 * Valid Range: 0-65535
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
#define MAX_RXABSDELAY 0xFFFF
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
#define MIN_RXABSDELAY 0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
/* Interrupt Throttle Rate (interrupts/sec)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
 * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
#define DEFAULT_ITR 3
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
#define MAX_ITR 100000
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
#define MIN_ITR 100
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
/* IntMode (Interrupt Mode)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
 * Valid Range: varies depending on kernel configuration & hardware support
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
 * legacy=0, MSI=1, MSI-X=2
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
 * When MSI/MSI-X support is enabled in kernel-
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
 *   Default Value: 2 (MSI-X) when supported by hardware, 1 (MSI) otherwise
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
 * When MSI/MSI-X support is not enabled in kernel-
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
 *   Default Value: 0 (legacy)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
 * When a mode is specified that is not allowed/supported, it will be
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
 * demoted to the most advanced interrupt mode available.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
E1000_PARAM(IntMode, "Interrupt Mode");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
#define MAX_INTMODE	2
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
#define MIN_INTMODE	0
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
/* Enable Smart Power Down of the PHY
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
 * Valid Range: 0, 1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
 * Default Value: 0 (disabled)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
/* Enable Kumeran Lock Loss workaround
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
 * Valid Range: 0, 1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
 * Default Value: 1 (enabled)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
/* Write Protect NVM
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
 * Valid Range: 0, 1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
 * Default Value: 1 (enabled)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
E1000_PARAM(WriteProtectNVM,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
	    "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
/* Enable CRC Stripping
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
 * Valid Range: 0, 1
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
 * Default Value: 1 (enabled)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
E1000_PARAM(CrcStripping,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
	    "Enable CRC Stripping, disable if your BMC needs the CRC");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
struct e1000_option {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
	enum { enable_option, range_option, list_option } type;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
	const char *name;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
	const char *err;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
	int def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
	union {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
		/* range_option info */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
		struct {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
			int min;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
			int max;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
		} r;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
		/* list_option info */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
		struct {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
			int nr;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
			struct e1000_opt_list {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
				int i;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
				char *str;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
			} *p;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
		} l;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
	} arg;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
static int e1000_validate_option(unsigned int *value,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
				 const struct e1000_option *opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
				 struct e1000_adapter *adapter)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
	if (*value == OPTION_UNSET) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
		*value = opt->def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
		return 0;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
	switch (opt->type) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
	case enable_option:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
		switch (*value) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
		case OPTION_ENABLED:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
			dev_info(&adapter->pdev->dev, "%s Enabled\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
				 opt->name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
			return 0;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
		case OPTION_DISABLED:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
			dev_info(&adapter->pdev->dev, "%s Disabled\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
				 opt->name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
			return 0;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
		break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
	case range_option:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
		if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
			dev_info(&adapter->pdev->dev, "%s set to %i\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
				 opt->name, *value);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
			return 0;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
		break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
	case list_option: {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
		int i;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
		struct e1000_opt_list *ent;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
		for (i = 0; i < opt->arg.l.nr; i++) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
			ent = &opt->arg.l.p[i];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
			if (*value == ent->i) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
				if (ent->str[0] != '\0')
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
					dev_info(&adapter->pdev->dev, "%s\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
						 ent->str);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
				return 0;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
			}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
		break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
	default:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
		BUG();
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
	dev_info(&adapter->pdev->dev, "Invalid %s value specified (%i) %s\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
		 opt->name, *value, opt->err);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
	*value = opt->def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
	return -1;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
/**
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
 * e1000e_check_options - Range Checking for Command Line Parameters
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
 * @adapter: board private structure
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
 * This routine checks all command line parameters for valid user
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
 * input.  If an invalid value is given, or if no user specified
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   240
 * value exists, a default value is used.  The final value is stored
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
 * in a variable in the adapter structure.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
 **/
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
void e1000e_check_options(struct e1000_adapter *adapter)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
	struct e1000_hw *hw = &adapter->hw;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
	int bd = adapter->bd_number;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
	if (bd >= E1000_MAX_NIC) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
		dev_notice(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
			   "Warning: no configuration for board #%i\n", bd);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
		dev_notice(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
			   "Using defaults for all values\n");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
	/* Transmit Interrupt Delay */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
			.name = "Transmit Interrupt Delay",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
			.err  = "using default of "
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
				__MODULE_STRING(DEFAULT_TIDV),
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
			.def  = DEFAULT_TIDV,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
			.arg  = { .r = { .min = MIN_TXDELAY,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
					 .max = MAX_TXDELAY } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
		if (num_TxIntDelay > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
			adapter->tx_int_delay = TxIntDelay[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
			e1000_validate_option(&adapter->tx_int_delay, &opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
					      adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
			adapter->tx_int_delay = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
	/* Transmit Absolute Interrupt Delay */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
			.name = "Transmit Absolute Interrupt Delay",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
			.err  = "using default of "
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
				__MODULE_STRING(DEFAULT_TADV),
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
			.def  = DEFAULT_TADV,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
			.arg  = { .r = { .min = MIN_TXABSDELAY,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
					 .max = MAX_TXABSDELAY } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
		if (num_TxAbsIntDelay > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
			adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
			e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
					      adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
			adapter->tx_abs_int_delay = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   295
	/* Receive Interrupt Delay */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
		static struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
			.name = "Receive Interrupt Delay",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
			.err  = "using default of "
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
				__MODULE_STRING(DEFAULT_RDTR),
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
			.def  = DEFAULT_RDTR,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
			.arg  = { .r = { .min = MIN_RXDELAY,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
					 .max = MAX_RXDELAY } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
		if (num_RxIntDelay > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
			adapter->rx_int_delay = RxIntDelay[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
			e1000_validate_option(&adapter->rx_int_delay, &opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   310
					      adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   311
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   312
			adapter->rx_int_delay = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   313
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   314
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   315
	/* Receive Absolute Interrupt Delay */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   319
			.name = "Receive Absolute Interrupt Delay",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   320
			.err  = "using default of "
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
				__MODULE_STRING(DEFAULT_RADV),
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
			.def  = DEFAULT_RADV,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
			.arg  = { .r = { .min = MIN_RXABSDELAY,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
					 .max = MAX_RXABSDELAY } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   326
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
		if (num_RxAbsIntDelay > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
			adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
			e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
					      adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
			adapter->rx_abs_int_delay = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
	/* Interrupt Throttling Rate */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   339
			.name = "Interrupt Throttling Rate (ints/sec)",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
			.err  = "using default of "
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   341
				__MODULE_STRING(DEFAULT_ITR),
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   342
			.def  = DEFAULT_ITR,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   343
			.arg  = { .r = { .min = MIN_ITR,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   344
					 .max = MAX_ITR } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   345
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   346
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   347
		if (num_InterruptThrottleRate > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   348
			adapter->itr = InterruptThrottleRate[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   349
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   350
			/* Make sure a message is printed for non-special
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   351
			 * values. And in case of an invalid option, display
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   352
			 * warning, use default and go through itr/itr_setting
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   353
			 * adjustment logic below
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   354
			 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   355
			if ((adapter->itr > 4) &&
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   356
			    e1000_validate_option(&adapter->itr, &opt, adapter))
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   357
				adapter->itr = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   358
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   359
			/* If no option specified, use default value and go
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
			 * through the logic below to adjust itr/itr_setting
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   361
			 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   362
			adapter->itr = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   363
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
			/* Make sure a message is printed for non-special
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
			 * default values
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
			 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
			if (adapter->itr > 4)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
				dev_info(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
					 "%s set to default %d\n", opt.name,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
					 adapter->itr);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
		adapter->itr_setting = adapter->itr;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
		switch (adapter->itr) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
		case 0:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
			dev_info(&adapter->pdev->dev, "%s turned off\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
				 opt.name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
			break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
		case 1:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
			dev_info(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
				 "%s set to dynamic mode\n", opt.name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
			adapter->itr = 20000;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
			break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
		case 3:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
			dev_info(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
				 "%s set to dynamic conservative mode\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
				 opt.name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
			adapter->itr = 20000;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
			break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
		case 4:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
			dev_info(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
				 "%s set to simplified (2000-8000 ints) mode\n",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
				 opt.name);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
			break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
		default:
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
			/* Save the setting, because the dynamic bits
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
			 * change itr.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
			 *
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
			 * Clear the lower two bits because
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
			 * they are used as control.
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
			 */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
			adapter->itr_setting &= ~3;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
			break;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   404
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
	/* Interrupt Mode */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   407
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   408
		static struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   409
			.type = range_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   410
			.name = "Interrupt Mode",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   411
#ifndef CONFIG_PCI_MSI
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   412
			.err  = "defaulting to 0 (legacy)",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
			.def  = E1000E_INT_MODE_LEGACY,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   414
			.arg  = { .r = { .min = 0,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   415
					 .max = 0 } }
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
#endif
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
#ifdef CONFIG_PCI_MSI
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
		if (adapter->flags & FLAG_HAS_MSIX) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
			opt.err = kstrdup("defaulting to 2 (MSI-X)",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
					  GFP_KERNEL);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   423
			opt.def = E1000E_INT_MODE_MSIX;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
			opt.arg.r.max = E1000E_INT_MODE_MSIX;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   425
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   426
			opt.err = kstrdup("defaulting to 1 (MSI)", GFP_KERNEL);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   427
			opt.def = E1000E_INT_MODE_MSI;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   428
			opt.arg.r.max = E1000E_INT_MODE_MSI;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   429
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   430
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   431
		if (!opt.err) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   432
			dev_err(&adapter->pdev->dev,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   433
				"Failed to allocate memory\n");
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   434
			return;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   435
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   436
#endif
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   437
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   438
		if (num_IntMode > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   439
			unsigned int int_mode = IntMode[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   440
			e1000_validate_option(&int_mode, &opt, adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   441
			adapter->int_mode = int_mode;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   442
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   443
			adapter->int_mode = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   444
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   445
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   446
#ifdef CONFIG_PCI_MSI
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   447
		kfree(opt.err);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   448
#endif
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   449
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   450
	/* Smart Power Down */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   451
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   452
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   453
			.type = enable_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   454
			.name = "PHY Smart Power Down",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   455
			.err  = "defaulting to Disabled",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   456
			.def  = OPTION_DISABLED
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   457
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   458
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   459
		if (num_SmartPowerDownEnable > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   460
			unsigned int spd = SmartPowerDownEnable[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   461
			e1000_validate_option(&spd, &opt, adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   462
			if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && spd)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   463
				adapter->flags |= FLAG_SMART_POWER_DOWN;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   464
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   465
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   466
	/* CRC Stripping */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   467
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   468
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   469
			.type = enable_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   470
			.name = "CRC Stripping",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   471
			.err  = "defaulting to Enabled",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   472
			.def  = OPTION_ENABLED
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   473
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   474
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   475
		if (num_CrcStripping > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   476
			unsigned int crc_stripping = CrcStripping[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   477
			e1000_validate_option(&crc_stripping, &opt, adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   478
			if (crc_stripping == OPTION_ENABLED) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   479
				adapter->flags2 |= FLAG2_CRC_STRIPPING;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   480
				adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   481
			}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   482
		} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   483
			adapter->flags2 |= FLAG2_CRC_STRIPPING;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   484
			adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   485
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   486
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   487
	/* Kumeran Lock Loss Workaround */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   488
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   489
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   490
			.type = enable_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   491
			.name = "Kumeran Lock Loss Workaround",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   492
			.err  = "defaulting to Enabled",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   493
			.def  = OPTION_ENABLED
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   494
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   495
		bool enabled = opt.def;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   496
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   497
		if (num_KumeranLockLoss > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   498
			unsigned int kmrn_lock_loss = KumeranLockLoss[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   499
			e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   500
			enabled = kmrn_lock_loss;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   501
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   502
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   503
		if (hw->mac.type == e1000_ich8lan)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   504
			e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   505
								     enabled);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   506
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   507
	/* Write-protect NVM */
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   508
	{
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   509
		static const struct e1000_option opt = {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   510
			.type = enable_option,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   511
			.name = "Write-protect NVM",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   512
			.err  = "defaulting to Enabled",
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   513
			.def  = OPTION_ENABLED
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   514
		};
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   515
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   516
		if (adapter->flags & FLAG_IS_ICH) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   517
			if (num_WriteProtectNVM > bd) {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   518
				unsigned int write_protect_nvm =
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   519
				    WriteProtectNVM[bd];
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   520
				e1000_validate_option(&write_protect_nvm, &opt,
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   521
						      adapter);
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   522
				if (write_protect_nvm)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   523
					adapter->flags |= FLAG_READ_ONLY_NVM;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   524
			} else {
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   525
				if (opt.def)
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   526
					adapter->flags |= FLAG_READ_ONLY_NVM;
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   527
			}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   528
		}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   529
	}
afd76ee3aa87 Added all drivers for kernel 3.14.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   530
}