1100 lines · 40.1 KB · C
RawDownload
/* * 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) * Portions Copyright (C) Sun Microsystems 2008 */ #ifndef _UAPI_LINUX_ETHTOOL_H#define _UAPI_LINUX_ETHTOOL_H #include <linux/types.h>#include <linux/if_ether.h> /* This should work for both 32 and 64 bit userland. */struct ethtool_cmd {	__u32	cmd;	__u32	supported;	/* Features this interface supports */	__u32	advertising;	/* Features this interface advertises */	__u16	speed;	        /* The forced speed (lower bits) in				 * Mbps. Please use				 * ethtool_cmd_speed()/_set() to				 * access it */	__u8	duplex;		/* Duplex, half or full */	__u8	port;		/* Which connector port */	__u8	phy_address;	/* MDIO PHY address (PRTAD for clause 45).				 * May be read-only or read-write				 * depending on the driver.				 */	__u8	transceiver;	/* Which transceiver to use */	__u8	autoneg;	/* Enable or disable autonegotiation */	__u8	mdio_support;	/* MDIO protocols supported.  Read-only.				 * Not set by all drivers.				 */	__u32	maxtxpkt;	/* Tx pkts before generating tx int */	__u32	maxrxpkt;	/* Rx pkts before generating rx int */	__u16	speed_hi;       /* The forced speed (upper				 * bits) in Mbps. Please use				 * ethtool_cmd_speed()/_set() to				 * access it */	__u8	eth_tp_mdix;	/* twisted pair MDI-X status */	__u8    eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,				   * link should be renegotiated if necessary				   */	__u32	lp_advertising;	/* Features the link partner advertises */	__u32	reserved[2];}; static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,					 __u32 speed){ 	ep->speed = (__u16)speed;	ep->speed_hi = (__u16)(speed >> 16);} static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep){	return (ep->speed_hi << 16) | ep->speed;} /* Device supports clause 22 register access to PHY or peripherals * using the interface defined in <linux/mii.h>.  This should not be * set if there are known to be no such peripherals present or if * the driver only emulates clause 22 registers for compatibility. */#define ETH_MDIO_SUPPORTS_C22	1 /* Device supports clause 45 register access to PHY or peripherals * using the interface defined in <linux/mii.h> and <linux/mdio.h>. * This should not be set if there are known to be no such peripherals * present. */#define ETH_MDIO_SUPPORTS_C45	2 #define ETHTOOL_FWVERS_LEN	32#define ETHTOOL_BUSINFO_LEN	32/* these strings are set to whatever the driver author decides... */struct ethtool_drvinfo {	__u32	cmd;	char	driver[32];	/* driver short name, "tulip", "eepro100" */	char	version[32];	/* driver version string */	char	fw_version[ETHTOOL_FWVERS_LEN];	/* firmware version string */	char	bus_info[ETHTOOL_BUSINFO_LEN];	/* Bus info for this IF. */				/* For PCI devices, use pci_name(pci_dev). */	char	reserved1[32];	char	reserved2[12];				/*				 * Some struct members below are filled in				 * using ops->get_sset_count().  Obtaining				 * this info from ethtool_drvinfo is now				 * deprecated; Use ETHTOOL_GSSET_INFO				 * instead.				 */	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */	__u32	testinfo_len;	__u32	eedump_len;	/* Size of data from ETHTOOL_GEEPROM (bytes) */	__u32	regdump_len;	/* Size of data from ETHTOOL_GREGS (bytes) */}; #define SOPASS_MAX	6/* wake-on-lan settings */struct ethtool_wolinfo {	__u32	cmd;	__u32	supported;	__u32	wolopts;	__u8	sopass[SOPASS_MAX]; /* SecureOn(tm) password */}; /* for passing single values */struct ethtool_value {	__u32	cmd;	__u32	data;}; /* for passing big chunks of data */struct ethtool_regs {	__u32	cmd;	__u32	version; /* driver-specific, indicates different chips/revs */	__u32	len; /* bytes */	__u8	data[0];}; /* for passing EEPROM chunks */struct ethtool_eeprom {	__u32	cmd;	__u32	magic;	__u32	offset; /* in bytes */	__u32	len; /* in bytes */	__u8	data[0];}; /** * struct ethtool_eee - Energy Efficient Ethernet information * @cmd: ETHTOOL_{G,S}EEE * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations *	for which there is EEE support. * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations *	advertised as eee capable. * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex *	combinations advertised by the link partner as eee capable. * @eee_active: Result of the eee auto negotiation. * @eee_enabled: EEE configured mode (enabled/disabled). * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given *	that eee was negotiated. * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting *	its tx lpi (after reaching 'idle' state). Effective only when eee *	was negotiated and tx_lpi_enabled was set. */struct ethtool_eee {	__u32	cmd;	__u32	supported;	__u32	advertised;	__u32	lp_advertised;	__u32	eee_active;	__u32	eee_enabled;	__u32	tx_lpi_enabled;	__u32	tx_lpi_timer;	__u32	reserved[2];}; /** * struct ethtool_modinfo - plugin module eeprom information * @cmd: %ETHTOOL_GMODULEINFO * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx * @eeprom_len: Length of the eeprom * * This structure is used to return the information to * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM. * The type code indicates the eeprom data format */struct ethtool_modinfo {	__u32   cmd;	__u32   type;	__u32   eeprom_len;	__u32   reserved[8];}; /** * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates * @cmd: ETHTOOL_{G,S}COALESCE * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after *	a packet arrives. * @rx_max_coalesced_frames: Maximum number of packets to receive *	before an RX interrupt. * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that *	this value applies while an IRQ is being serviced by the host. * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames, *	except that this value applies while an IRQ is being serviced *	by the host. * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after *	a packet is sent. * @tx_max_coalesced_frames: Maximum number of packets to be sent *	before a TX interrupt. * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that *	this value applies while an IRQ is being serviced by the host. * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames, *	except that this value applies while an IRQ is being serviced *	by the host. * @stats_block_coalesce_usecs: How many usecs to delay in-memory *	statistics block updates.  Some drivers do not have an *	in-memory statistic block, and in such cases this value is *	ignored.  This value must not be zero. * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing. * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing. * @pkt_rate_low: Threshold for low packet rate (packets per second). * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after *	a packet arrives, when the packet rate is below @pkt_rate_low. * @rx_max_coalesced_frames_low: Maximum number of packets to be received *	before an RX interrupt, when the packet rate is below @pkt_rate_low. * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after *	a packet is sent, when the packet rate is below @pkt_rate_low. * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before *	a TX interrupt, when the packet rate is below @pkt_rate_low. * @pkt_rate_high: Threshold for high packet rate (packets per second). * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after *	a packet arrives, when the packet rate is above @pkt_rate_high. * @rx_max_coalesced_frames_high: Maximum number of packets to be received *	before an RX interrupt, when the packet rate is above @pkt_rate_high. * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after *	a packet is sent, when the packet rate is above @pkt_rate_high. * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before *	a TX interrupt, when the packet rate is above @pkt_rate_high. * @rate_sample_interval: How often to do adaptive coalescing packet rate *	sampling, measured in seconds.  Must not be zero. * * Each pair of (usecs, max_frames) fields specifies this exit * condition for interrupt coalescing: *	(usecs > 0 && time_since_first_completion >= usecs) || *	(max_frames > 0 && completed_frames >= max_frames) * It is illegal to set both usecs and max_frames to zero as this * would cause interrupts to never be generated.  To disable * coalescing, set usecs = 0 and max_frames = 1. * * Some implementations ignore the value of max_frames and use the * condition: *	time_since_first_completion >= usecs * This is deprecated.  Drivers for hardware that does not support * counting completions should validate that max_frames == !rx_usecs. * * Adaptive RX/TX coalescing is an algorithm implemented by some * drivers to improve latency under low packet rates and improve * throughput under high packet rates.  Some drivers only implement * one of RX or TX adaptive coalescing.  Anything not implemented by * the driver causes these values to be silently ignored. * * When the packet rate is below @pkt_rate_high but above * @pkt_rate_low (both measured in packets per second) the * normal {rx,tx}_* coalescing parameters are used. */struct ethtool_coalesce {	__u32	cmd;	__u32	rx_coalesce_usecs;	__u32	rx_max_coalesced_frames;	__u32	rx_coalesce_usecs_irq;	__u32	rx_max_coalesced_frames_irq;	__u32	tx_coalesce_usecs;	__u32	tx_max_coalesced_frames;	__u32	tx_coalesce_usecs_irq;	__u32	tx_max_coalesced_frames_irq;	__u32	stats_block_coalesce_usecs;	__u32	use_adaptive_rx_coalesce;	__u32	use_adaptive_tx_coalesce;	__u32	pkt_rate_low;	__u32	rx_coalesce_usecs_low;	__u32	rx_max_coalesced_frames_low;	__u32	tx_coalesce_usecs_low;	__u32	tx_max_coalesced_frames_low;	__u32	pkt_rate_high;	__u32	rx_coalesce_usecs_high;	__u32	rx_max_coalesced_frames_high;	__u32	tx_coalesce_usecs_high;	__u32	tx_max_coalesced_frames_high;	__u32	rate_sample_interval;}; /* for configuring RX/TX ring parameters */struct ethtool_ringparam {	__u32	cmd;	/* ETHTOOL_{G,S}RINGPARAM */ 	/* Read only attributes.  These indicate the maximum number	 * of pending RX/TX ring entries the driver will allow the	 * user to set.	 */	__u32	rx_max_pending;	__u32	rx_mini_max_pending;	__u32	rx_jumbo_max_pending;	__u32	tx_max_pending; 	/* Values changeable by the user.  The valid values are	 * in the range 1 to the "*_max_pending" counterpart above.	 */	__u32	rx_pending;	__u32	rx_mini_pending;	__u32	rx_jumbo_pending;	__u32	tx_pending;}; /** * struct ethtool_channels - configuring number of network channel * @cmd: ETHTOOL_{G,S}CHANNELS * @max_rx: Read only. Maximum number of receive channel the driver support. * @max_tx: Read only. Maximum number of transmit channel the driver support. * @max_other: Read only. Maximum number of other channel the driver support. * @max_combined: Read only. Maximum number of combined channel the driver *	support. Set of queues RX, TX or other. * @rx_count: Valid values are in the range 1 to the max_rx. * @tx_count: Valid values are in the range 1 to the max_tx. * @other_count: Valid values are in the range 1 to the max_other. * @combined_count: Valid values are in the range 1 to the max_combined. * * This can be used to configure RX, TX and other channels. */ struct ethtool_channels {	__u32	cmd;	__u32	max_rx;	__u32	max_tx;	__u32	max_other;	__u32	max_combined;	__u32	rx_count;	__u32	tx_count;	__u32	other_count;	__u32	combined_count;}; /* for configuring link flow control parameters */struct ethtool_pauseparam {	__u32	cmd;	/* ETHTOOL_{G,S}PAUSEPARAM */ 	/* If the link is being auto-negotiated (via ethtool_cmd.autoneg	 * being true) the user may set 'autoneg' here non-zero to have the	 * pause parameters be auto-negotiated too.  In such a case, the	 * {rx,tx}_pause values below determine what capabilities are	 * advertised.	 *	 * If 'autoneg' is zero or the link is not being auto-negotiated,	 * then {rx,tx}_pause force the driver to use/not-use pause	 * flow control.	 */	__u32	autoneg;	__u32	rx_pause;	__u32	tx_pause;}; #define ETH_GSTRING_LEN		32enum ethtool_stringset {	ETH_SS_TEST		= 0,	ETH_SS_STATS,	ETH_SS_PRIV_FLAGS,	ETH_SS_NTUPLE_FILTERS,	/* Do not use, GRXNTUPLE is now deprecated */	ETH_SS_FEATURES,}; /* for passing string sets for data tagging */struct ethtool_gstrings {	__u32	cmd;		/* ETHTOOL_GSTRINGS */	__u32	string_set;	/* string set id e.c. ETH_SS_TEST, etc*/	__u32	len;		/* number of strings in the string set */	__u8	data[0];}; struct ethtool_sset_info {	__u32	cmd;		/* ETHTOOL_GSSET_INFO */	__u32	reserved;	__u64	sset_mask;	/* input: each bit selects an sset to query */				/* output: each bit a returned sset */	__u32	data[0];	/* ETH_SS_xxx count, in order, based on bits				   in sset_mask.  One bit implies one				   __u32, two bits implies two				   __u32's, etc. */}; /** * enum ethtool_test_flags - flags definition of ethtool_test * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise *	only online tests. * @ETH_TEST_FL_FAILED: Driver set this flag if test fails. * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback *	test. * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test */ enum ethtool_test_flags {	ETH_TEST_FL_OFFLINE	= (1 << 0),	ETH_TEST_FL_FAILED	= (1 << 1),	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),	ETH_TEST_FL_EXTERNAL_LB_DONE	= (1 << 3),}; /* for requesting NIC test and getting results*/struct ethtool_test {	__u32	cmd;		/* ETHTOOL_TEST */	__u32	flags;		/* ETH_TEST_FL_xxx */	__u32	reserved;	__u32	len;		/* result length, in number of u64 elements */	__u64	data[0];}; /* for dumping NIC-specific statistics */struct ethtool_stats {	__u32	cmd;		/* ETHTOOL_GSTATS */	__u32	n_stats;	/* number of u64's being returned */	__u64	data[0];}; struct ethtool_perm_addr {	__u32	cmd;		/* ETHTOOL_GPERMADDR */	__u32	size;	__u8	data[0];}; /* boolean flags controlling per-interface behavior characteristics. * When reading, the flag indicates whether or not a certain behavior * is enabled/present.  When writing, the flag indicates whether * or not the driver should turn on (set) or off (clear) a behavior. * * Some behaviors may read-only (unconditionally absent or present). * If such is the case, return EINVAL in the set-flags operation if the * flag differs from the read-only value. */enum ethtool_flags {	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */	ETH_FLAG_RXHASH		= (1 << 28),}; /* The following structures are for supporting RX network flow * classification and RX n-tuple configuration. Note, all multibyte * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to * be in network byte order. */ /** * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc. * @ip4src: Source host * @ip4dst: Destination host * @psrc: Source port * @pdst: Destination port * @tos: Type-of-service * * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow. */struct ethtool_tcpip4_spec {	__be32	ip4src;	__be32	ip4dst;	__be16	psrc;	__be16	pdst;	__u8    tos;}; /** * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4 * @ip4src: Source host * @ip4dst: Destination host * @spi: Security parameters index * @tos: Type-of-service * * This can be used to specify an IPsec transport or tunnel over IPv4. */struct ethtool_ah_espip4_spec {	__be32	ip4src;	__be32	ip4dst;	__be32	spi;	__u8    tos;}; #define	ETH_RX_NFC_IP4	1 /** * struct ethtool_usrip4_spec - general flow specification for IPv4 * @ip4src: Source host * @ip4dst: Destination host * @l4_4_bytes: First 4 bytes of transport (layer 4) header * @tos: Type-of-service * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0 * @proto: Transport protocol number; mask must be 0 */struct ethtool_usrip4_spec {	__be32	ip4src;	__be32	ip4dst;	__be32	l4_4_bytes;	__u8    tos;	__u8    ip_ver;	__u8    proto;}; union ethtool_flow_union {	struct ethtool_tcpip4_spec		tcp_ip4_spec;	struct ethtool_tcpip4_spec		udp_ip4_spec;	struct ethtool_tcpip4_spec		sctp_ip4_spec;	struct ethtool_ah_espip4_spec		ah_ip4_spec;	struct ethtool_ah_espip4_spec		esp_ip4_spec;

Lines 1–500 of 1100.