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