// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 1999 - 2010 Intel Corporation. * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. * * This code was derived from the Intel e1000e Linux driver. */ #include "pch_gbe.h" #include <linux/module.h> /* for __MODULE_STRING */ #define OPTION_UNSET … #define OPTION_DISABLED … #define OPTION_ENABLED … /* * TxDescriptors - Transmit Descriptor Count * @Valid Range: PCH_GBE_MIN_TXD - PCH_GBE_MAX_TXD * @Default Value: PCH_GBE_DEFAULT_TXD */ static int TxDescriptors = …; module_param(TxDescriptors, int, 0); MODULE_PARM_DESC(…) …; /* * RxDescriptors -Receive Descriptor Count * @Valid Range: PCH_GBE_MIN_RXD - PCH_GBE_MAX_RXD * @Default Value: PCH_GBE_DEFAULT_RXD */ static int RxDescriptors = …; module_param(RxDescriptors, int, 0); MODULE_PARM_DESC(…) …; /* * Speed - User Specified Speed Override * @Valid Range: 0, 10, 100, 1000 * - 0: auto-negotiate at all supported speeds * - 10: only link at 10 Mbps * - 100: only link at 100 Mbps * - 1000: only link at 1000 Mbps * @Default Value: 0 */ static int Speed = …; module_param(Speed, int, 0); MODULE_PARM_DESC(…) …; /* * Duplex - User Specified Duplex Override * @Valid Range: 0-2 * - 0: auto-negotiate for duplex * - 1: only link at half duplex * - 2: only link at full duplex * @Default Value: 0 */ static int Duplex = …; module_param(Duplex, int, 0); MODULE_PARM_DESC(…) …; #define HALF_DUPLEX … #define FULL_DUPLEX … /* * AutoNeg - Auto-negotiation Advertisement Override * @Valid Range: 0x01-0x0F, 0x20-0x2F * * The AutoNeg value is a bit mask describing which speed and duplex * combinations should be advertised during auto-negotiation. * The supported speed and duplex modes are listed below * * Bit 7 6 5 4 3 2 1 0 * Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10 * Duplex Full Full Half Full Half * * @Default Value: 0x2F (copper) */ static int AutoNeg = …; module_param(AutoNeg, int, 0); MODULE_PARM_DESC(…) …; #define PHY_ADVERTISE_10_HALF … #define PHY_ADVERTISE_10_FULL … #define PHY_ADVERTISE_100_HALF … #define PHY_ADVERTISE_100_FULL … #define PHY_ADVERTISE_1000_HALF … #define PHY_ADVERTISE_1000_FULL … #define PCH_AUTONEG_ADVERTISE_DEFAULT … /* * FlowControl - User Specified Flow Control Override * @Valid Range: 0-3 * - 0: No Flow Control * - 1: Rx only, respond to PAUSE frames but do not generate them * - 2: Tx only, generate PAUSE frames but ignore them on receive * - 3: Full Flow Control Support * @Default Value: Read flow control settings from the EEPROM */ static int FlowControl = …; module_param(FlowControl, int, 0); MODULE_PARM_DESC(…) …; /* * XsumRX - Receive Checksum Offload Enable/Disable * @Valid Range: 0, 1 * - 0: disables all checksum offload * - 1: enables receive IP/TCP/UDP checksum offload * @Default Value: PCH_GBE_DEFAULT_RX_CSUM */ static int XsumRX = …; module_param(XsumRX, int, 0); MODULE_PARM_DESC(…) …; #define PCH_GBE_DEFAULT_RX_CSUM … /* * XsumTX - Transmit Checksum Offload Enable/Disable * @Valid Range: 0, 1 * - 0: disables all checksum offload * - 1: enables transmit IP/TCP/UDP checksum offload * @Default Value: PCH_GBE_DEFAULT_TX_CSUM */ static int XsumTX = …; module_param(XsumTX, int, 0); MODULE_PARM_DESC(…) …; #define PCH_GBE_DEFAULT_TX_CSUM … /* * pch_gbe_option - Force the MAC's flow control settings * @hw: Pointer to the HW structure * Returns: * 0: Successful. * Negative value: Failed. */ struct pch_gbe_option { … }; static const struct pch_gbe_opt_list speed_list[] = …; static const struct pch_gbe_opt_list dplx_list[] = …; static const struct pch_gbe_opt_list an_list[] = …; static const struct pch_gbe_opt_list fc_list[] = …; /** * pch_gbe_validate_option - Validate option * @value: value * @opt: option * @adapter: Board private structure * Returns: * 0: Successful. * Negative value: Failed. */ static int pch_gbe_validate_option(int *value, const struct pch_gbe_option *opt, struct pch_gbe_adapter *adapter) { … } /** * pch_gbe_check_copper_options - Range Checking for Link Options, Copper Version * @adapter: Board private structure */ static void pch_gbe_check_copper_options(struct pch_gbe_adapter *adapter) { … } /** * pch_gbe_check_options - Range Checking for Command Line Parameters * @adapter: Board private structure */ void pch_gbe_check_options(struct pch_gbe_adapter *adapter) { … }