2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* ethtool.h: Defines for Linux ethtool.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 David S. Miller (davem@redhat.com)
|
|
|
|
* Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
|
|
|
|
* Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
|
|
|
|
* Portions Copyright 2002 Intel (eli.kupermann@intel.com,
|
|
|
|
* christopher.leech@intel.com,
|
|
|
|
* scott.feldman@intel.com)
|
2009-02-20 15:58:13 +07:00
|
|
|
* Portions Copyright (C) Sun Microsystems 2008
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
#ifndef _LINUX_ETHTOOL_H
|
|
|
|
#define _LINUX_ETHTOOL_H
|
|
|
|
|
2011-03-17 14:34:32 +07:00
|
|
|
#include <linux/compat.h>
|
2012-10-13 16:46:48 +07:00
|
|
|
#include <uapi/linux/ethtool.h>
|
2007-08-16 06:00:51 +07:00
|
|
|
|
2011-03-17 14:34:32 +07:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
|
|
|
|
struct compat_ethtool_rx_flow_spec {
|
|
|
|
u32 flow_type;
|
2011-04-09 01:01:59 +07:00
|
|
|
union ethtool_flow_union h_u;
|
|
|
|
struct ethtool_flow_ext h_ext;
|
|
|
|
union ethtool_flow_union m_u;
|
|
|
|
struct ethtool_flow_ext m_ext;
|
2011-03-17 14:34:32 +07:00
|
|
|
compat_u64 ring_cookie;
|
|
|
|
u32 location;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct compat_ethtool_rxnfc {
|
|
|
|
u32 cmd;
|
|
|
|
u32 flow_type;
|
|
|
|
compat_u64 data;
|
|
|
|
struct compat_ethtool_rx_flow_spec fs;
|
|
|
|
u32 rule_cnt;
|
|
|
|
u32 rule_locs[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CONFIG_COMPAT */
|
2006-04-29 07:53:47 +07:00
|
|
|
|
2010-02-15 13:38:54 +07:00
|
|
|
#include <linux/rculist.h>
|
|
|
|
|
2011-09-03 10:34:30 +07:00
|
|
|
extern int __ethtool_get_settings(struct net_device *dev,
|
|
|
|
struct ethtool_cmd *cmd);
|
|
|
|
|
2011-04-02 06:35:15 +07:00
|
|
|
/**
|
|
|
|
* enum ethtool_phys_id_state - indicator state for physical identification
|
|
|
|
* @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
|
|
|
|
* @ETHTOOL_ID_ACTIVE: Physical ID indicator should be activated
|
|
|
|
* @ETHTOOL_ID_ON: LED should be turned on (used iff %ETHTOOL_ID_ACTIVE
|
|
|
|
* is not supported)
|
|
|
|
* @ETHTOOL_ID_OFF: LED should be turned off (used iff %ETHTOOL_ID_ACTIVE
|
|
|
|
* is not supported)
|
|
|
|
*/
|
|
|
|
enum ethtool_phys_id_state {
|
|
|
|
ETHTOOL_ID_INACTIVE,
|
|
|
|
ETHTOOL_ID_ACTIVE,
|
|
|
|
ETHTOOL_ID_ON,
|
|
|
|
ETHTOOL_ID_OFF
|
|
|
|
};
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct net_device;
|
|
|
|
|
|
|
|
/* Some generic methods drivers may use in their ethtool_ops */
|
|
|
|
u32 ethtool_op_get_link(struct net_device *dev);
|
2012-04-04 05:59:22 +07:00
|
|
|
int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-12-15 20:56:49 +07:00
|
|
|
/**
|
|
|
|
* ethtool_rxfh_indir_default - get default value for RX flow hash indirection
|
|
|
|
* @index: Index in RX flow hash indirection table
|
|
|
|
* @n_rx_rings: Number of RX rings to use
|
|
|
|
*
|
|
|
|
* This function provides the default policy for RX flow hash indirection.
|
|
|
|
*/
|
|
|
|
static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
|
|
|
|
{
|
|
|
|
return index % n_rx_rings;
|
|
|
|
}
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/**
|
2011-04-02 05:57:41 +07:00
|
|
|
* struct ethtool_ops - optional netdev operations
|
|
|
|
* @get_settings: Get various device settings including Ethernet link
|
2011-04-28 01:32:38 +07:00
|
|
|
* settings. The @cmd parameter is expected to have been cleared
|
|
|
|
* before get_settings is called. Returns a negative error code or
|
|
|
|
* zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_settings: Set various device settings including Ethernet link
|
|
|
|
* settings. Returns a negative error code or zero.
|
|
|
|
* @get_drvinfo: Report driver/device information. Should only set the
|
|
|
|
* @driver, @version, @fw_version and @bus_info fields. If not
|
|
|
|
* implemented, the @driver and @bus_info fields will be filled in
|
|
|
|
* according to the netdev's parent device.
|
|
|
|
* @get_regs_len: Get buffer length required for @get_regs
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_regs: Get device registers
|
|
|
|
* @get_wol: Report whether Wake-on-Lan is enabled
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_wol: Turn Wake-on-Lan on or off. Returns a negative error code
|
|
|
|
* or zero.
|
|
|
|
* @get_msglevel: Report driver message level. This should be the value
|
|
|
|
* of the @msg_enable field used by netif logging functions.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @set_msglevel: Set driver message level
|
2011-04-02 05:57:41 +07:00
|
|
|
* @nway_reset: Restart autonegotiation. Returns a negative error code
|
|
|
|
* or zero.
|
|
|
|
* @get_link: Report whether physical link is up. Will only be called if
|
|
|
|
* the netdev is up. Should usually be set to ethtool_op_get_link(),
|
|
|
|
* which uses netif_carrier_ok().
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_eeprom: Read data from the device EEPROM.
|
2005-04-17 05:20:36 +07:00
|
|
|
* Should fill in the magic field. Don't need to check len for zero
|
|
|
|
* or wraparound. Fill in the data argument with the eeprom values
|
|
|
|
* from offset to offset + len. Update len to the amount read.
|
|
|
|
* Returns an error or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @set_eeprom: Write data to the device EEPROM.
|
2005-04-17 05:20:36 +07:00
|
|
|
* Should validate the magic field. Don't need to check len for zero
|
|
|
|
* or wraparound. Update len to the amount written. Returns an error
|
|
|
|
* or zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @get_coalesce: Get interrupt coalescing parameters. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @set_coalesce: Set interrupt coalescing parameters. Returns a negative
|
|
|
|
* error code or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_ringparam: Report ring sizes
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_ringparam: Set ring sizes. Returns a negative error code or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @get_pauseparam: Report pause parameters
|
2011-04-02 05:57:41 +07:00
|
|
|
* @set_pauseparam: Set pause parameters. Returns a negative error code
|
|
|
|
* or zero.
|
2011-04-02 04:52:34 +07:00
|
|
|
* @self_test: Run specified self-tests
|
|
|
|
* @get_strings: Return a set of strings that describe the requested objects
|
2011-04-02 06:35:15 +07:00
|
|
|
* @set_phys_id: Identify the physical devices, e.g. by flashing an LED
|
|
|
|
* attached to it. The implementation may update the indicator
|
|
|
|
* asynchronously or synchronously, but in either case it must return
|
|
|
|
* quickly. It is initially called with the argument %ETHTOOL_ID_ACTIVE,
|
2011-04-13 20:09:10 +07:00
|
|
|
* and must either activate asynchronous updates and return zero, return
|
|
|
|
* a negative error or return a positive frequency for synchronous
|
|
|
|
* indication (e.g. 1 for one on/off cycle per second). If it returns
|
|
|
|
* a frequency then it will be called again at intervals with the
|
2011-04-02 06:35:15 +07:00
|
|
|
* argument %ETHTOOL_ID_ON or %ETHTOOL_ID_OFF and should set the state of
|
|
|
|
* the indicator accordingly. Finally, it is called with the argument
|
|
|
|
* %ETHTOOL_ID_INACTIVE and must deactivate the indicator. Returns a
|
|
|
|
* negative error code or zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @get_ethtool_stats: Return extended statistics about the device.
|
|
|
|
* This is only useful if the device maintains statistics not
|
|
|
|
* included in &struct rtnl_link_stats64.
|
|
|
|
* @begin: Function to be called before any other operation. Returns a
|
|
|
|
* negative error code or zero.
|
|
|
|
* @complete: Function to be called after any other operation except
|
|
|
|
* @begin. Will be called even if the other operation failed.
|
|
|
|
* @get_priv_flags: Report driver-specific feature flags.
|
|
|
|
* @set_priv_flags: Set driver-specific feature flags. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @get_sset_count: Get number of strings that @get_strings will write.
|
|
|
|
* @get_rxnfc: Get RX flow classification rules. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @set_rxnfc: Set RX flow classification rules. Returns a negative
|
|
|
|
* error code or zero.
|
|
|
|
* @flash_device: Write a firmware image to device's flash memory.
|
|
|
|
* Returns a negative error code or zero.
|
|
|
|
* @reset: Reset (part of) the device, as specified by a bitmask of
|
|
|
|
* flags from &enum ethtool_reset_flags. Returns a negative
|
|
|
|
* error code or zero.
|
2011-12-15 20:55:01 +07:00
|
|
|
* @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
|
|
|
|
* Returns zero if not supported for this specific device.
|
2011-04-02 05:57:41 +07:00
|
|
|
* @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
|
2011-12-15 20:55:01 +07:00
|
|
|
* Will not be called if @get_rxfh_indir_size returns zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* Returns a negative error code or zero.
|
|
|
|
* @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
|
2011-12-15 20:55:01 +07:00
|
|
|
* Will not be called if @get_rxfh_indir_size returns zero.
|
2011-04-02 05:57:41 +07:00
|
|
|
* Returns a negative error code or zero.
|
2011-04-07 08:58:42 +07:00
|
|
|
* @get_channels: Get number of channels.
|
|
|
|
* @set_channels: Set number of channels. Returns a negative error code or
|
|
|
|
* zero.
|
2011-05-12 19:48:32 +07:00
|
|
|
* @get_dump_flag: Get dump flag indicating current dump length, version,
|
|
|
|
* and flag of the device.
|
|
|
|
* @get_dump_data: Get dump data.
|
|
|
|
* @set_dump: Set dump specific flags to the device.
|
2012-04-04 05:59:17 +07:00
|
|
|
* @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
|
|
|
|
* Drivers supporting transmit time stamps in software should set this to
|
|
|
|
* ethtool_op_get_ts_info().
|
2012-04-19 15:44:42 +07:00
|
|
|
* @get_module_info: Get the size and type of the eeprom contained within
|
|
|
|
* a plug-in module.
|
|
|
|
* @get_module_eeprom: Get the eeprom information from the plug-in module
|
2012-06-07 00:13:06 +07:00
|
|
|
* @get_eee: Get Energy-Efficient (EEE) supported and status.
|
|
|
|
* @set_eee: Set EEE status (enable/disable) as well as LPI timers.
|
2011-04-02 05:57:41 +07:00
|
|
|
*
|
|
|
|
* All operations are optional (i.e. the function pointer may be set
|
|
|
|
* to %NULL) and callers must take this into account. Callers must
|
2012-04-05 21:38:49 +07:00
|
|
|
* hold the RTNL lock.
|
2011-04-02 05:57:41 +07:00
|
|
|
*
|
|
|
|
* See the structures used by these operations for further documentation.
|
|
|
|
*
|
|
|
|
* See &struct net_device and &struct net_device_ops for documentation
|
|
|
|
* of the generic netdev features interface.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
struct ethtool_ops {
|
|
|
|
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
|
|
|
|
int (*set_settings)(struct net_device *, struct ethtool_cmd *);
|
|
|
|
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
|
|
|
|
int (*get_regs_len)(struct net_device *);
|
|
|
|
void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
|
|
|
|
void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
|
|
|
|
int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
|
|
|
|
u32 (*get_msglevel)(struct net_device *);
|
|
|
|
void (*set_msglevel)(struct net_device *, u32);
|
|
|
|
int (*nway_reset)(struct net_device *);
|
|
|
|
u32 (*get_link)(struct net_device *);
|
|
|
|
int (*get_eeprom_len)(struct net_device *);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*get_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
|
|
|
int (*set_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
|
|
|
int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
2010-04-08 11:54:42 +07:00
|
|
|
void (*get_ringparam)(struct net_device *,
|
|
|
|
struct ethtool_ringparam *);
|
|
|
|
int (*set_ringparam)(struct net_device *,
|
|
|
|
struct ethtool_ringparam *);
|
|
|
|
void (*get_pauseparam)(struct net_device *,
|
|
|
|
struct ethtool_pauseparam*);
|
|
|
|
int (*set_pauseparam)(struct net_device *,
|
|
|
|
struct ethtool_pauseparam*);
|
2005-04-17 05:20:36 +07:00
|
|
|
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
|
|
|
|
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
|
2011-04-02 06:35:15 +07:00
|
|
|
int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
|
2010-04-08 11:54:42 +07:00
|
|
|
void (*get_ethtool_stats)(struct net_device *,
|
|
|
|
struct ethtool_stats *, u64 *);
|
2005-04-17 05:20:36 +07:00
|
|
|
int (*begin)(struct net_device *);
|
|
|
|
void (*complete)(struct net_device *);
|
2010-04-08 11:54:42 +07:00
|
|
|
u32 (*get_priv_flags)(struct net_device *);
|
|
|
|
int (*set_priv_flags)(struct net_device *, u32);
|
2007-08-16 06:01:08 +07:00
|
|
|
int (*get_sset_count)(struct net_device *, int);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*get_rxnfc)(struct net_device *,
|
2011-09-06 20:49:12 +07:00
|
|
|
struct ethtool_rxnfc *, u32 *rule_locs);
|
2009-02-20 15:58:13 +07:00
|
|
|
int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
|
2010-04-08 11:54:42 +07:00
|
|
|
int (*flash_device)(struct net_device *, struct ethtool_flash *);
|
2009-10-05 17:59:58 +07:00
|
|
|
int (*reset)(struct net_device *, u32 *);
|
2011-12-15 20:55:01 +07:00
|
|
|
u32 (*get_rxfh_indir_size)(struct net_device *);
|
|
|
|
int (*get_rxfh_indir)(struct net_device *, u32 *);
|
|
|
|
int (*set_rxfh_indir)(struct net_device *, const u32 *);
|
2011-04-07 08:58:42 +07:00
|
|
|
void (*get_channels)(struct net_device *, struct ethtool_channels *);
|
|
|
|
int (*set_channels)(struct net_device *, struct ethtool_channels *);
|
2011-05-12 19:48:32 +07:00
|
|
|
int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
|
|
|
|
int (*get_dump_data)(struct net_device *,
|
|
|
|
struct ethtool_dump *, void *);
|
|
|
|
int (*set_dump)(struct net_device *, struct ethtool_dump *);
|
2012-04-04 05:59:17 +07:00
|
|
|
int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
|
2012-04-19 15:44:42 +07:00
|
|
|
int (*get_module_info)(struct net_device *,
|
|
|
|
struct ethtool_modinfo *);
|
|
|
|
int (*get_module_eeprom)(struct net_device *,
|
|
|
|
struct ethtool_eeprom *, u8 *);
|
2012-06-07 00:13:06 +07:00
|
|
|
int (*get_eee)(struct net_device *, struct ethtool_eee *);
|
|
|
|
int (*set_eee)(struct net_device *, struct ethtool_eee *);
|
2012-04-19 15:44:42 +07:00
|
|
|
|
2011-04-07 08:58:42 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
#endif /* _LINUX_ETHTOOL_H */
|