// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 1999 - 2018 Intel Corporation. */ #include <linux/netdevice.h> #include <linux/module.h> #include <linux/pci.h> #include "e1000.h" /* This is the only thing that needs to be changed to adjust the * maximum number of ports that the driver can manage. */ #define E1000_MAX_NIC … #define OPTION_UNSET … #define OPTION_DISABLED … #define OPTION_ENABLED … #define COPYBREAK_DEFAULT … unsigned int copybreak = …; module_param(copybreak, uint, 0644); MODULE_PARM_DESC(…) …; /* All parameters are treated the same, as an integer array of values. * This macro just reduces the need to repeat the same declaration code * over and over (plus this helps to avoid typo bugs). */ #define E1000_PARAM_INIT … #define E1000_PARAM(X, desc) … /* Transmit Interrupt Delay in units of 1.024 microseconds * Tx interrupt delay needs to typically be set to something non-zero * * Valid Range: 0-65535 */ E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); #define DEFAULT_TIDV … #define MAX_TXDELAY … #define MIN_TXDELAY … /* Transmit Absolute Interrupt Delay in units of 1.024 microseconds * * Valid Range: 0-65535 */ E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); #define DEFAULT_TADV … #define MAX_TXABSDELAY … #define MIN_TXABSDELAY … /* Receive Interrupt Delay in units of 1.024 microseconds * hardware will likely hang if you set this to anything but zero. * * Burst variant is used as default if device has FLAG2_DMA_BURST. * * Valid Range: 0-65535 */ E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); #define DEFAULT_RDTR … #define BURST_RDTR … #define MAX_RXDELAY … #define MIN_RXDELAY … /* Receive Absolute Interrupt Delay in units of 1.024 microseconds * * Burst variant is used as default if device has FLAG2_DMA_BURST. * * Valid Range: 0-65535 */ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); #define DEFAULT_RADV … #define BURST_RADV … #define MAX_RXABSDELAY … #define MIN_RXABSDELAY … /* Interrupt Throttle Rate (interrupts/sec) * * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative */ E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); #define DEFAULT_ITR … #define MAX_ITR … #define MIN_ITR … /* IntMode (Interrupt Mode) * * Valid Range: varies depending on kernel configuration & hardware support * * legacy=0, MSI=1, MSI-X=2 * * When MSI/MSI-X support is enabled in kernel- * Default Value: 2 (MSI-X) when supported by hardware, 1 (MSI) otherwise * When MSI/MSI-X support is not enabled in kernel- * Default Value: 0 (legacy) * * When a mode is specified that is not allowed/supported, it will be * demoted to the most advanced interrupt mode available. */ E1000_PARAM(IntMode, "Interrupt Mode"); /* Enable Smart Power Down of the PHY * * Valid Range: 0, 1 * * Default Value: 0 (disabled) */ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); /* Enable Kumeran Lock Loss workaround * * Valid Range: 0, 1 * * Default Value: 1 (enabled) */ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); /* Write Protect NVM * * Valid Range: 0, 1 * * Default Value: 1 (enabled) */ E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); /* Enable CRC Stripping * * Valid Range: 0, 1 * * Default Value: 1 (enabled) */ E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs the CRC"); struct e1000_option { … }; static int e1000_validate_option(unsigned int *value, const struct e1000_option *opt, struct e1000_adapter *adapter) { … } /** * e1000e_check_options - Range Checking for Command Line Parameters * @adapter: board private structure * * This routine checks all command line parameters for valid user * input. If an invalid value is given, or if no user specified * value exists, a default value is used. The final value is stored * in a variable in the adapter structure. **/ void e1000e_check_options(struct e1000_adapter *adapter) { … }