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