ethtool.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  1. /*
  2. * ethtool.h: Defines for Linux ethtool.
  3. *
  4. * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  5. * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
  6. * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
  7. * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
  8. * christopher.leech@intel.com,
  9. * scott.feldman@intel.com)
  10. * Portions Copyright (C) Sun Microsystems 2008
  11. */
  12. #ifndef _UAPI_LINUX_ETHTOOL_H
  13. #define _UAPI_LINUX_ETHTOOL_H
  14. #include <linux/types.h>
  15. #include <linux/if_ether.h>
  16. /* All structures exposed to userland should be defined such that they
  17. * have the same layout for 32-bit and 64-bit userland.
  18. */
  19. /**
  20. * struct ethtool_cmd - link control and status
  21. * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
  22. * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
  23. * physical connectors and other link features for which the
  24. * interface supports autonegotiation or auto-detection.
  25. * Read-only.
  26. * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
  27. * physical connectors and other link features that are
  28. * advertised through autonegotiation or enabled for
  29. * auto-detection.
  30. * @speed: Low bits of the speed
  31. * @duplex: Duplex mode; one of %DUPLEX_*
  32. * @port: Physical connector type; one of %PORT_*
  33. * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
  34. * applicable. For clause 45 PHYs this is the PRTAD.
  35. * @transceiver: Historically used to distinguish different possible
  36. * PHY types, but not in a consistent way. Deprecated.
  37. * @autoneg: Enable/disable autonegotiation and auto-detection;
  38. * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
  39. * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
  40. * protocols supported by the interface; 0 if unknown.
  41. * Read-only.
  42. * @maxtxpkt: Historically used to report TX IRQ coalescing; now
  43. * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
  44. * @maxrxpkt: Historically used to report RX IRQ coalescing; now
  45. * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
  46. * @speed_hi: High bits of the speed
  47. * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
  48. * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
  49. * value will be %ETH_TP_MDI_INVALID. Read-only.
  50. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
  51. * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
  52. * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
  53. * When written successfully, the link should be renegotiated if
  54. * necessary.
  55. * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
  56. * and other link features that the link partner advertised
  57. * through autonegotiation; 0 if unknown or not applicable.
  58. * Read-only.
  59. *
  60. * The link speed in Mbps is split between @speed and @speed_hi. Use
  61. * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
  62. * access it.
  63. *
  64. * If autonegotiation is disabled, the speed and @duplex represent the
  65. * fixed link mode and are writable if the driver supports multiple
  66. * link modes. If it is enabled then they are read-only; if the link
  67. * is up they represent the negotiated link mode; if the link is down,
  68. * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
  69. * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
  70. *
  71. * Some hardware interfaces may have multiple PHYs and/or physical
  72. * connectors fitted or do not allow the driver to detect which are
  73. * fitted. For these interfaces @port and/or @phy_address may be
  74. * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
  75. * Otherwise, attempts to write different values may be ignored or
  76. * rejected.
  77. *
  78. * Users should assume that all fields not marked read-only are
  79. * writable and subject to validation by the driver. They should use
  80. * %ETHTOOL_GSET to get the current values before making specific
  81. * changes and then applying them with %ETHTOOL_SSET.
  82. *
  83. * Drivers that implement set_settings() should validate all fields
  84. * other than @cmd that are not described as read-only or deprecated,
  85. * and must ignore all fields described as read-only.
  86. *
  87. * Deprecated fields should be ignored by both users and drivers.
  88. */
  89. struct ethtool_cmd {
  90. __u32 cmd;
  91. __u32 supported;
  92. __u32 advertising;
  93. __u16 speed;
  94. __u8 duplex;
  95. __u8 port;
  96. __u8 phy_address;
  97. __u8 transceiver;
  98. __u8 autoneg;
  99. __u8 mdio_support;
  100. __u32 maxtxpkt;
  101. __u32 maxrxpkt;
  102. __u16 speed_hi;
  103. __u8 eth_tp_mdix;
  104. __u8 eth_tp_mdix_ctrl;
  105. __u32 lp_advertising;
  106. __u32 reserved[2];
  107. };
  108. static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
  109. __u32 speed)
  110. {
  111. ep->speed = (__u16)speed;
  112. ep->speed_hi = (__u16)(speed >> 16);
  113. }
  114. static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
  115. {
  116. return (ep->speed_hi << 16) | ep->speed;
  117. }
  118. /* Device supports clause 22 register access to PHY or peripherals
  119. * using the interface defined in <linux/mii.h>. This should not be
  120. * set if there are known to be no such peripherals present or if
  121. * the driver only emulates clause 22 registers for compatibility.
  122. */
  123. #define ETH_MDIO_SUPPORTS_C22 1
  124. /* Device supports clause 45 register access to PHY or peripherals
  125. * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
  126. * This should not be set if there are known to be no such peripherals
  127. * present.
  128. */
  129. #define ETH_MDIO_SUPPORTS_C45 2
  130. #define ETHTOOL_FWVERS_LEN 32
  131. #define ETHTOOL_BUSINFO_LEN 32
  132. /**
  133. * struct ethtool_drvinfo - general driver and device information
  134. * @cmd: Command number = %ETHTOOL_GDRVINFO
  135. * @driver: Driver short name. This should normally match the name
  136. * in its bus driver structure (e.g. pci_driver::name). Must
  137. * not be an empty string.
  138. * @version: Driver version string; may be an empty string
  139. * @fw_version: Firmware version string; may be an empty string
  140. * @bus_info: Device bus address. This should match the dev_name()
  141. * string for the underlying bus device, if there is one. May be
  142. * an empty string.
  143. * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
  144. * %ETHTOOL_SPFLAGS commands; also the number of strings in the
  145. * %ETH_SS_PRIV_FLAGS set
  146. * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
  147. * command; also the number of strings in the %ETH_SS_STATS set
  148. * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
  149. * command; also the number of strings in the %ETH_SS_TEST set
  150. * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
  151. * and %ETHTOOL_SEEPROM commands, in bytes
  152. * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
  153. * command, in bytes
  154. *
  155. * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
  156. * strings in any string set (from Linux 2.6.34).
  157. *
  158. * Drivers should set at most @driver, @version, @fw_version and
  159. * @bus_info in their get_drvinfo() implementation. The ethtool
  160. * core fills in the other fields using other driver operations.
  161. */
  162. struct ethtool_drvinfo {
  163. __u32 cmd;
  164. char driver[32];
  165. char version[32];
  166. char fw_version[ETHTOOL_FWVERS_LEN];
  167. char bus_info[ETHTOOL_BUSINFO_LEN];
  168. char reserved1[32];
  169. char reserved2[12];
  170. __u32 n_priv_flags;
  171. __u32 n_stats;
  172. __u32 testinfo_len;
  173. __u32 eedump_len;
  174. __u32 regdump_len;
  175. };
  176. #define SOPASS_MAX 6
  177. /**
  178. * struct ethtool_wolinfo - Wake-On-Lan configuration
  179. * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
  180. * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
  181. * Read-only.
  182. * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
  183. * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
  184. * is set in @wolopts.
  185. */
  186. struct ethtool_wolinfo {
  187. __u32 cmd;
  188. __u32 supported;
  189. __u32 wolopts;
  190. __u8 sopass[SOPASS_MAX];
  191. };
  192. /* for passing single values */
  193. struct ethtool_value {
  194. __u32 cmd;
  195. __u32 data;
  196. };
  197. enum tunable_id {
  198. ETHTOOL_ID_UNSPEC,
  199. ETHTOOL_RX_COPYBREAK,
  200. ETHTOOL_TX_COPYBREAK,
  201. };
  202. enum tunable_type_id {
  203. ETHTOOL_TUNABLE_UNSPEC,
  204. ETHTOOL_TUNABLE_U8,
  205. ETHTOOL_TUNABLE_U16,
  206. ETHTOOL_TUNABLE_U32,
  207. ETHTOOL_TUNABLE_U64,
  208. ETHTOOL_TUNABLE_STRING,
  209. ETHTOOL_TUNABLE_S8,
  210. ETHTOOL_TUNABLE_S16,
  211. ETHTOOL_TUNABLE_S32,
  212. ETHTOOL_TUNABLE_S64,
  213. };
  214. struct ethtool_tunable {
  215. __u32 cmd;
  216. __u32 id;
  217. __u32 type_id;
  218. __u32 len;
  219. void *data[0];
  220. };
  221. /**
  222. * struct ethtool_regs - hardware register dump
  223. * @cmd: Command number = %ETHTOOL_GREGS
  224. * @version: Dump format version. This is driver-specific and may
  225. * distinguish different chips/revisions. Drivers must use new
  226. * version numbers whenever the dump format changes in an
  227. * incompatible way.
  228. * @len: On entry, the real length of @data. On return, the number of
  229. * bytes used.
  230. * @data: Buffer for the register dump
  231. *
  232. * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
  233. * a register dump for the interface. They must allocate the buffer
  234. * immediately following this structure.
  235. */
  236. struct ethtool_regs {
  237. __u32 cmd;
  238. __u32 version;
  239. __u32 len;
  240. __u8 data[0];
  241. };
  242. /**
  243. * struct ethtool_eeprom - EEPROM dump
  244. * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
  245. * %ETHTOOL_SEEPROM
  246. * @magic: A 'magic cookie' value to guard against accidental changes.
  247. * The value passed in to %ETHTOOL_SEEPROM must match the value
  248. * returned by %ETHTOOL_GEEPROM for the same device. This is
  249. * unused when @cmd is %ETHTOOL_GMODULEEEPROM.
  250. * @offset: Offset within the EEPROM to begin reading/writing, in bytes
  251. * @len: On entry, number of bytes to read/write. On successful
  252. * return, number of bytes actually read/written. In case of
  253. * error, this may indicate at what point the error occurred.
  254. * @data: Buffer to read/write from
  255. *
  256. * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
  257. * the length of an on-board or module EEPROM, respectively. They
  258. * must allocate the buffer immediately following this structure.
  259. */
  260. struct ethtool_eeprom {
  261. __u32 cmd;
  262. __u32 magic;
  263. __u32 offset;
  264. __u32 len;
  265. __u8 data[0];
  266. };
  267. /**
  268. * struct ethtool_eee - Energy Efficient Ethernet information
  269. * @cmd: ETHTOOL_{G,S}EEE
  270. * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
  271. * for which there is EEE support.
  272. * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
  273. * advertised as eee capable.
  274. * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
  275. * combinations advertised by the link partner as eee capable.
  276. * @eee_active: Result of the eee auto negotiation.
  277. * @eee_enabled: EEE configured mode (enabled/disabled).
  278. * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
  279. * that eee was negotiated.
  280. * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
  281. * its tx lpi (after reaching 'idle' state). Effective only when eee
  282. * was negotiated and tx_lpi_enabled was set.
  283. */
  284. struct ethtool_eee {
  285. __u32 cmd;
  286. __u32 supported;
  287. __u32 advertised;
  288. __u32 lp_advertised;
  289. __u32 eee_active;
  290. __u32 eee_enabled;
  291. __u32 tx_lpi_enabled;
  292. __u32 tx_lpi_timer;
  293. __u32 reserved[2];
  294. };
  295. /**
  296. * struct ethtool_modinfo - plugin module eeprom information
  297. * @cmd: %ETHTOOL_GMODULEINFO
  298. * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
  299. * @eeprom_len: Length of the eeprom
  300. *
  301. * This structure is used to return the information to
  302. * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
  303. * The type code indicates the eeprom data format
  304. */
  305. struct ethtool_modinfo {
  306. __u32 cmd;
  307. __u32 type;
  308. __u32 eeprom_len;
  309. __u32 reserved[8];
  310. };
  311. /**
  312. * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
  313. * @cmd: ETHTOOL_{G,S}COALESCE
  314. * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
  315. * a packet arrives.
  316. * @rx_max_coalesced_frames: Maximum number of packets to receive
  317. * before an RX interrupt.
  318. * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
  319. * this value applies while an IRQ is being serviced by the host.
  320. * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
  321. * except that this value applies while an IRQ is being serviced
  322. * by the host.
  323. * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
  324. * a packet is sent.
  325. * @tx_max_coalesced_frames: Maximum number of packets to be sent
  326. * before a TX interrupt.
  327. * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
  328. * this value applies while an IRQ is being serviced by the host.
  329. * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
  330. * except that this value applies while an IRQ is being serviced
  331. * by the host.
  332. * @stats_block_coalesce_usecs: How many usecs to delay in-memory
  333. * statistics block updates. Some drivers do not have an
  334. * in-memory statistic block, and in such cases this value is
  335. * ignored. This value must not be zero.
  336. * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
  337. * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
  338. * @pkt_rate_low: Threshold for low packet rate (packets per second).
  339. * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
  340. * a packet arrives, when the packet rate is below @pkt_rate_low.
  341. * @rx_max_coalesced_frames_low: Maximum number of packets to be received
  342. * before an RX interrupt, when the packet rate is below @pkt_rate_low.
  343. * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
  344. * a packet is sent, when the packet rate is below @pkt_rate_low.
  345. * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
  346. * a TX interrupt, when the packet rate is below @pkt_rate_low.
  347. * @pkt_rate_high: Threshold for high packet rate (packets per second).
  348. * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
  349. * a packet arrives, when the packet rate is above @pkt_rate_high.
  350. * @rx_max_coalesced_frames_high: Maximum number of packets to be received
  351. * before an RX interrupt, when the packet rate is above @pkt_rate_high.
  352. * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
  353. * a packet is sent, when the packet rate is above @pkt_rate_high.
  354. * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
  355. * a TX interrupt, when the packet rate is above @pkt_rate_high.
  356. * @rate_sample_interval: How often to do adaptive coalescing packet rate
  357. * sampling, measured in seconds. Must not be zero.
  358. *
  359. * Each pair of (usecs, max_frames) fields specifies that interrupts
  360. * should be coalesced until
  361. * (usecs > 0 && time_since_first_completion >= usecs) ||
  362. * (max_frames > 0 && completed_frames >= max_frames)
  363. *
  364. * It is illegal to set both usecs and max_frames to zero as this
  365. * would cause interrupts to never be generated. To disable
  366. * coalescing, set usecs = 0 and max_frames = 1.
  367. *
  368. * Some implementations ignore the value of max_frames and use the
  369. * condition time_since_first_completion >= usecs
  370. *
  371. * This is deprecated. Drivers for hardware that does not support
  372. * counting completions should validate that max_frames == !rx_usecs.
  373. *
  374. * Adaptive RX/TX coalescing is an algorithm implemented by some
  375. * drivers to improve latency under low packet rates and improve
  376. * throughput under high packet rates. Some drivers only implement
  377. * one of RX or TX adaptive coalescing. Anything not implemented by
  378. * the driver causes these values to be silently ignored.
  379. *
  380. * When the packet rate is below @pkt_rate_high but above
  381. * @pkt_rate_low (both measured in packets per second) the
  382. * normal {rx,tx}_* coalescing parameters are used.
  383. */
  384. struct ethtool_coalesce {
  385. __u32 cmd;
  386. __u32 rx_coalesce_usecs;
  387. __u32 rx_max_coalesced_frames;
  388. __u32 rx_coalesce_usecs_irq;
  389. __u32 rx_max_coalesced_frames_irq;
  390. __u32 tx_coalesce_usecs;
  391. __u32 tx_max_coalesced_frames;
  392. __u32 tx_coalesce_usecs_irq;
  393. __u32 tx_max_coalesced_frames_irq;
  394. __u32 stats_block_coalesce_usecs;
  395. __u32 use_adaptive_rx_coalesce;
  396. __u32 use_adaptive_tx_coalesce;
  397. __u32 pkt_rate_low;
  398. __u32 rx_coalesce_usecs_low;
  399. __u32 rx_max_coalesced_frames_low;
  400. __u32 tx_coalesce_usecs_low;
  401. __u32 tx_max_coalesced_frames_low;
  402. __u32 pkt_rate_high;
  403. __u32 rx_coalesce_usecs_high;
  404. __u32 rx_max_coalesced_frames_high;
  405. __u32 tx_coalesce_usecs_high;
  406. __u32 tx_max_coalesced_frames_high;
  407. __u32 rate_sample_interval;
  408. };
  409. /**
  410. * struct ethtool_ringparam - RX/TX ring parameters
  411. * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
  412. * @rx_max_pending: Maximum supported number of pending entries per
  413. * RX ring. Read-only.
  414. * @rx_mini_max_pending: Maximum supported number of pending entries
  415. * per RX mini ring. Read-only.
  416. * @rx_jumbo_max_pending: Maximum supported number of pending entries
  417. * per RX jumbo ring. Read-only.
  418. * @tx_max_pending: Maximum supported number of pending entries per
  419. * TX ring. Read-only.
  420. * @rx_pending: Current maximum number of pending entries per RX ring
  421. * @rx_mini_pending: Current maximum number of pending entries per RX
  422. * mini ring
  423. * @rx_jumbo_pending: Current maximum number of pending entries per RX
  424. * jumbo ring
  425. * @tx_pending: Current maximum supported number of pending entries
  426. * per TX ring
  427. *
  428. * If the interface does not have separate RX mini and/or jumbo rings,
  429. * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
  430. *
  431. * There may also be driver-dependent minimum values for the number
  432. * of entries per ring.
  433. */
  434. struct ethtool_ringparam {
  435. __u32 cmd;
  436. __u32 rx_max_pending;
  437. __u32 rx_mini_max_pending;
  438. __u32 rx_jumbo_max_pending;
  439. __u32 tx_max_pending;
  440. __u32 rx_pending;
  441. __u32 rx_mini_pending;
  442. __u32 rx_jumbo_pending;
  443. __u32 tx_pending;
  444. };
  445. /**
  446. * struct ethtool_channels - configuring number of network channel
  447. * @cmd: ETHTOOL_{G,S}CHANNELS
  448. * @max_rx: Read only. Maximum number of receive channel the driver support.
  449. * @max_tx: Read only. Maximum number of transmit channel the driver support.
  450. * @max_other: Read only. Maximum number of other channel the driver support.
  451. * @max_combined: Read only. Maximum number of combined channel the driver
  452. * support. Set of queues RX, TX or other.
  453. * @rx_count: Valid values are in the range 1 to the max_rx.
  454. * @tx_count: Valid values are in the range 1 to the max_tx.
  455. * @other_count: Valid values are in the range 1 to the max_other.
  456. * @combined_count: Valid values are in the range 1 to the max_combined.
  457. *
  458. * This can be used to configure RX, TX and other channels.
  459. */
  460. struct ethtool_channels {
  461. __u32 cmd;
  462. __u32 max_rx;
  463. __u32 max_tx;
  464. __u32 max_other;
  465. __u32 max_combined;
  466. __u32 rx_count;
  467. __u32 tx_count;
  468. __u32 other_count;
  469. __u32 combined_count;
  470. };
  471. /**
  472. * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
  473. * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
  474. * @autoneg: Flag to enable autonegotiation of pause frame use
  475. * @rx_pause: Flag to enable reception of pause frames
  476. * @tx_pause: Flag to enable transmission of pause frames
  477. *
  478. * Drivers should reject a non-zero setting of @autoneg when
  479. * autoneogotiation is disabled (or not supported) for the link.
  480. *
  481. * If the link is autonegotiated, drivers should use
  482. * mii_advertise_flowctrl() or similar code to set the advertised
  483. * pause frame capabilities based on the @rx_pause and @tx_pause flags,
  484. * even if @autoneg is zero. They should also allow the advertised
  485. * pause frame capabilities to be controlled directly through the
  486. * advertising field of &struct ethtool_cmd.
  487. *
  488. * If @autoneg is non-zero, the MAC is configured to send and/or
  489. * receive pause frames according to the result of autonegotiation.
  490. * Otherwise, it is configured directly based on the @rx_pause and
  491. * @tx_pause flags.
  492. */
  493. struct ethtool_pauseparam {
  494. __u32 cmd;
  495. __u32 autoneg;
  496. __u32 rx_pause;
  497. __u32 tx_pause;
  498. };
  499. #define ETH_GSTRING_LEN 32
  500. /**
  501. * enum ethtool_stringset - string set ID
  502. * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
  503. * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
  504. * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
  505. * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
  506. * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
  507. * now deprecated
  508. * @ETH_SS_FEATURES: Device feature names
  509. */
  510. enum ethtool_stringset {
  511. ETH_SS_TEST = 0,
  512. ETH_SS_STATS,
  513. ETH_SS_PRIV_FLAGS,
  514. ETH_SS_NTUPLE_FILTERS,
  515. ETH_SS_FEATURES,
  516. };
  517. /**
  518. * struct ethtool_gstrings - string set for data tagging
  519. * @cmd: Command number = %ETHTOOL_GSTRINGS
  520. * @string_set: String set ID; one of &enum ethtool_stringset
  521. * @len: On return, the number of strings in the string set
  522. * @data: Buffer for strings. Each string is null-padded to a size of
  523. * %ETH_GSTRING_LEN.
  524. *
  525. * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
  526. * the string set. They must allocate a buffer of the appropriate
  527. * size immediately following this structure.
  528. */
  529. struct ethtool_gstrings {
  530. __u32 cmd;
  531. __u32 string_set;
  532. __u32 len;
  533. __u8 data[0];
  534. };
  535. /**
  536. * struct ethtool_sset_info - string set information
  537. * @cmd: Command number = %ETHTOOL_GSSET_INFO
  538. * @sset_mask: On entry, a bitmask of string sets to query, with bits
  539. * numbered according to &enum ethtool_stringset. On return, a
  540. * bitmask of those string sets queried that are supported.
  541. * @data: Buffer for string set sizes. On return, this contains the
  542. * size of each string set that was queried and supported, in
  543. * order of ID.
  544. *
  545. * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
  546. * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the
  547. * size of set 1 and @data[1] contains the size of set 2.
  548. *
  549. * Users must allocate a buffer of the appropriate size (4 * number of
  550. * sets queried) immediately following this structure.
  551. */
  552. struct ethtool_sset_info {
  553. __u32 cmd;
  554. __u32 reserved;
  555. __u64 sset_mask;
  556. __u32 data[0];
  557. };
  558. /**
  559. * enum ethtool_test_flags - flags definition of ethtool_test
  560. * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
  561. * only online tests.
  562. * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
  563. * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
  564. * test.
  565. * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
  566. */
  567. enum ethtool_test_flags {
  568. ETH_TEST_FL_OFFLINE = (1 << 0),
  569. ETH_TEST_FL_FAILED = (1 << 1),
  570. ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
  571. ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
  572. };
  573. /**
  574. * struct ethtool_test - device self-test invocation
  575. * @cmd: Command number = %ETHTOOL_TEST
  576. * @flags: A bitmask of flags from &enum ethtool_test_flags. Some
  577. * flags may be set by the user on entry; others may be set by
  578. * the driver on return.
  579. * @len: On return, the number of test results
  580. * @data: Array of test results
  581. *
  582. * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
  583. * number of test results that will be returned. They must allocate a
  584. * buffer of the appropriate size (8 * number of results) immediately
  585. * following this structure.
  586. */
  587. struct ethtool_test {
  588. __u32 cmd;
  589. __u32 flags;
  590. __u32 reserved;
  591. __u32 len;
  592. __u64 data[0];
  593. };
  594. /**
  595. * struct ethtool_stats - device-specific statistics
  596. * @cmd: Command number = %ETHTOOL_GSTATS
  597. * @n_stats: On return, the number of statistics
  598. * @data: Array of statistics
  599. *
  600. * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
  601. * number of statistics that will be returned. They must allocate a
  602. * buffer of the appropriate size (8 * number of statistics)
  603. * immediately following this structure.
  604. */
  605. struct ethtool_stats {
  606. __u32 cmd;
  607. __u32 n_stats;
  608. __u64 data[0];
  609. };
  610. /**
  611. * struct ethtool_perm_addr - permanent hardware address
  612. * @cmd: Command number = %ETHTOOL_GPERMADDR
  613. * @size: On entry, the size of the buffer. On return, the size of the
  614. * address. The command fails if the buffer is too small.
  615. * @data: Buffer for the address
  616. *
  617. * Users must allocate the buffer immediately following this structure.
  618. * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
  619. * type.
  620. */
  621. struct ethtool_perm_addr {
  622. __u32 cmd;
  623. __u32 size;
  624. __u8 data[0];
  625. };
  626. /* boolean flags controlling per-interface behavior characteristics.
  627. * When reading, the flag indicates whether or not a certain behavior
  628. * is enabled/present. When writing, the flag indicates whether
  629. * or not the driver should turn on (set) or off (clear) a behavior.
  630. *
  631. * Some behaviors may read-only (unconditionally absent or present).
  632. * If such is the case, return EINVAL in the set-flags operation if the
  633. * flag differs from the read-only value.
  634. */
  635. enum ethtool_flags {
  636. ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
  637. ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
  638. ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
  639. ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
  640. ETH_FLAG_RXHASH = (1 << 28),
  641. };
  642. /* The following structures are for supporting RX network flow
  643. * classification and RX n-tuple configuration. Note, all multibyte
  644. * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
  645. * be in network byte order.
  646. */
  647. /**
  648. * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
  649. * @ip4src: Source host
  650. * @ip4dst: Destination host
  651. * @psrc: Source port
  652. * @pdst: Destination port
  653. * @tos: Type-of-service
  654. *
  655. * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
  656. */
  657. struct ethtool_tcpip4_spec {
  658. __be32 ip4src;
  659. __be32 ip4dst;
  660. __be16 psrc;
  661. __be16 pdst;
  662. __u8 tos;
  663. };
  664. /**
  665. * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
  666. * @ip4src: Source host
  667. * @ip4dst: Destination host
  668. * @spi: Security parameters index
  669. * @tos: Type-of-service
  670. *
  671. * This can be used to specify an IPsec transport or tunnel over IPv4.
  672. */
  673. struct ethtool_ah_espip4_spec {
  674. __be32 ip4src;
  675. __be32 ip4dst;
  676. __be32 spi;
  677. __u8 tos;
  678. };
  679. #define ETH_RX_NFC_IP4 1
  680. /**
  681. * struct ethtool_usrip4_spec - general flow specification for IPv4
  682. * @ip4src: Source host
  683. * @ip4dst: Destination host
  684. * @l4_4_bytes: First 4 bytes of transport (layer 4) header
  685. * @tos: Type-of-service
  686. * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
  687. * @proto: Transport protocol number; mask must be 0
  688. */
  689. struct ethtool_usrip4_spec {
  690. __be32 ip4src;
  691. __be32 ip4dst;
  692. __be32 l4_4_bytes;
  693. __u8 tos;
  694. __u8 ip_ver;
  695. __u8 proto;
  696. };
  697. union ethtool_flow_union {
  698. struct ethtool_tcpip4_spec tcp_ip4_spec;
  699. struct ethtool_tcpip4_spec udp_ip4_spec;
  700. struct ethtool_tcpip4_spec sctp_ip4_spec;
  701. struct ethtool_ah_espip4_spec ah_ip4_spec;
  702. struct ethtool_ah_espip4_spec esp_ip4_spec;
  703. struct ethtool_usrip4_spec usr_ip4_spec;
  704. struct ethhdr ether_spec;
  705. __u8 hdata[52];
  706. };
  707. /**
  708. * struct ethtool_flow_ext - additional RX flow fields
  709. * @h_dest: destination MAC address
  710. * @vlan_etype: VLAN EtherType
  711. * @vlan_tci: VLAN tag control information
  712. * @data: user defined data
  713. *
  714. * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
  715. * is set in &struct ethtool_rx_flow_spec @flow_type.
  716. * @h_dest is valid if %FLOW_MAC_EXT is set.
  717. */
  718. struct ethtool_flow_ext {
  719. __u8 padding[2];
  720. unsigned char h_dest[ETH_ALEN];
  721. __be16 vlan_etype;
  722. __be16 vlan_tci;
  723. __be32 data[2];
  724. };
  725. /**
  726. * struct ethtool_rx_flow_spec - classification rule for RX flows
  727. * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
  728. * @h_u: Flow fields to match (dependent on @flow_type)
  729. * @h_ext: Additional fields to match
  730. * @m_u: Masks for flow field bits to be matched
  731. * @m_ext: Masks for additional field bits to be matched
  732. * Note, all additional fields must be ignored unless @flow_type
  733. * includes the %FLOW_EXT or %FLOW_MAC_EXT flag
  734. * (see &struct ethtool_flow_ext description).
  735. * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
  736. * if packets should be discarded
  737. * @location: Location of rule in the table. Locations must be
  738. * numbered such that a flow matching multiple rules will be
  739. * classified according to the first (lowest numbered) rule.
  740. */
  741. struct ethtool_rx_flow_spec {
  742. __u32 flow_type;
  743. union ethtool_flow_union h_u;
  744. struct ethtool_flow_ext h_ext;
  745. union ethtool_flow_union m_u;
  746. struct ethtool_flow_ext m_ext;
  747. __u64 ring_cookie;
  748. __u32 location;
  749. };
  750. /**
  751. * struct ethtool_rxnfc - command to get or set RX flow classification rules
  752. * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
  753. * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
  754. * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
  755. * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
  756. * @data: Command-dependent value
  757. * @fs: Flow classification rule
  758. * @rule_cnt: Number of rules to be affected
  759. * @rule_locs: Array of used rule locations
  760. *
  761. * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
  762. * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
  763. * structure fields must not be used.
  764. *
  765. * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
  766. * on return.
  767. *
  768. * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
  769. * rules on return. If @data is non-zero on return then it is the
  770. * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
  771. * driver supports any special location values. If that flag is not
  772. * set in @data then special location values should not be used.
  773. *
  774. * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
  775. * existing rule on entry and @fs contains the rule on return.
  776. *
  777. * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
  778. * user buffer for @rule_locs on entry. On return, @data is the size
  779. * of the rule table, @rule_cnt is the number of defined rules, and
  780. * @rule_locs contains the locations of the defined rules. Drivers
  781. * must use the second parameter to get_rxnfc() instead of @rule_locs.
  782. *
  783. * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
  784. * @fs.@location either specifies the location to use or is a special
  785. * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
  786. * @fs.@location is the actual rule location.
  787. *
  788. * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
  789. * existing rule on entry.
  790. *
  791. * A driver supporting the special location values for
  792. * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
  793. * location, and may remove a rule at a later location (lower
  794. * priority) that matches exactly the same set of flows. The special
  795. * values are %RX_CLS_LOC_ANY, selecting any location;
  796. * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
  797. * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
  798. * location (minimum priority). Additional special values may be
  799. * defined in future and drivers must return -%EINVAL for any
  800. * unrecognised value.
  801. */
  802. struct ethtool_rxnfc {
  803. __u32 cmd;
  804. __u32 flow_type;
  805. __u64 data;
  806. struct ethtool_rx_flow_spec fs;
  807. __u32 rule_cnt;
  808. __u32 rule_locs[0];
  809. };
  810. /**
  811. * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
  812. * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
  813. * @size: On entry, the array size of the user buffer, which may be zero.
  814. * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
  815. * indirection table.
  816. * @ring_index: RX ring/queue index for each hash value
  817. *
  818. * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
  819. * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
  820. * the table should be reset to default values. This last feature
  821. * is not supported by the original implementations.
  822. */
  823. struct ethtool_rxfh_indir {
  824. __u32 cmd;
  825. __u32 size;
  826. __u32 ring_index[0];
  827. };
  828. /**
  829. * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
  830. * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
  831. * @rss_context: RSS context identifier.
  832. * @indir_size: On entry, the array size of the user buffer for the
  833. * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
  834. * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
  835. * the array size of the hardware indirection table.
  836. * @key_size: On entry, the array size of the user buffer for the hash key,
  837. * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
  838. * hardware hash key.
  839. * @rsvd: Reserved for future extensions.
  840. * @rss_config: RX ring/queue index for each hash value i.e., indirection table
  841. * of @indir_size __u32 elements, followed by hash key of @key_size
  842. * bytes.
  843. *
  844. * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
  845. * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
  846. * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
  847. * and a @indir_size of zero means the indir table should be reset to default
  848. * values.
  849. */
  850. struct ethtool_rxfh {
  851. __u32 cmd;
  852. __u32 rss_context;
  853. __u32 indir_size;
  854. __u32 key_size;
  855. __u32 rsvd[2];
  856. __u32 rss_config[0];
  857. };
  858. #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
  859. /**
  860. * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
  861. * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
  862. * @h_u: Flow field values to match (dependent on @flow_type)
  863. * @m_u: Masks for flow field value bits to be ignored
  864. * @vlan_tag: VLAN tag to match
  865. * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
  866. * @data: Driver-dependent data to match
  867. * @data_mask: Mask for driver-dependent data bits to be ignored
  868. * @action: RX ring/queue index to deliver to (non-negative) or other action
  869. * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
  870. *
  871. * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
  872. * a field value and mask are both zero this is treated as if all mask
  873. * bits are set i.e. the field is ignored.
  874. */
  875. struct ethtool_rx_ntuple_flow_spec {
  876. __u32 flow_type;
  877. union {
  878. struct ethtool_tcpip4_spec tcp_ip4_spec;
  879. struct ethtool_tcpip4_spec udp_ip4_spec;
  880. struct ethtool_tcpip4_spec sctp_ip4_spec;
  881. struct ethtool_ah_espip4_spec ah_ip4_spec;
  882. struct ethtool_ah_espip4_spec esp_ip4_spec;
  883. struct ethtool_usrip4_spec usr_ip4_spec;
  884. struct ethhdr ether_spec;
  885. __u8 hdata[72];
  886. } h_u, m_u;
  887. __u16 vlan_tag;
  888. __u16 vlan_tag_mask;
  889. __u64 data;
  890. __u64 data_mask;
  891. __s32 action;
  892. #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
  893. #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
  894. };
  895. /**
  896. * struct ethtool_rx_ntuple - command to set or clear RX flow filter
  897. * @cmd: Command number - %ETHTOOL_SRXNTUPLE
  898. * @fs: Flow filter specification
  899. */
  900. struct ethtool_rx_ntuple {
  901. __u32 cmd;
  902. struct ethtool_rx_ntuple_flow_spec fs;
  903. };
  904. #define ETHTOOL_FLASH_MAX_FILENAME 128
  905. enum ethtool_flash_op_type {
  906. ETHTOOL_FLASH_ALL_REGIONS = 0,
  907. };
  908. /* for passing firmware flashing related parameters */
  909. struct ethtool_flash {
  910. __u32 cmd;
  911. __u32 region;
  912. char data[ETHTOOL_FLASH_MAX_FILENAME];
  913. };
  914. /**
  915. * struct ethtool_dump - used for retrieving, setting device dump
  916. * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
  917. * %ETHTOOL_SET_DUMP
  918. * @version: FW version of the dump, filled in by driver
  919. * @flag: driver dependent flag for dump setting, filled in by driver during
  920. * get and filled in by ethtool for set operation.
  921. * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
  922. * firmware dump is disabled.
  923. * @len: length of dump data, used as the length of the user buffer on entry to
  924. * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
  925. * for %ETHTOOL_GET_DUMP_FLAG command
  926. * @data: data collected for get dump data operation
  927. */
  928. struct ethtool_dump {
  929. __u32 cmd;
  930. __u32 version;
  931. __u32 flag;
  932. __u32 len;
  933. __u8 data[0];
  934. };
  935. #define ETH_FW_DUMP_DISABLE 0
  936. /* for returning and changing feature sets */
  937. /**
  938. * struct ethtool_get_features_block - block with state of 32 features
  939. * @available: mask of changeable features
  940. * @requested: mask of features requested to be enabled if possible
  941. * @active: mask of currently enabled features
  942. * @never_changed: mask of features not changeable for any device
  943. */
  944. struct ethtool_get_features_block {
  945. __u32 available;
  946. __u32 requested;
  947. __u32 active;
  948. __u32 never_changed;
  949. };
  950. /**
  951. * struct ethtool_gfeatures - command to get state of device's features
  952. * @cmd: command number = %ETHTOOL_GFEATURES
  953. * @size: On entry, the number of elements in the features[] array;
  954. * on return, the number of elements in features[] needed to hold
  955. * all features
  956. * @features: state of features
  957. */
  958. struct ethtool_gfeatures {
  959. __u32 cmd;
  960. __u32 size;
  961. struct ethtool_get_features_block features[0];
  962. };
  963. /**
  964. * struct ethtool_set_features_block - block with request for 32 features
  965. * @valid: mask of features to be changed
  966. * @requested: values of features to be changed
  967. */
  968. struct ethtool_set_features_block {
  969. __u32 valid;
  970. __u32 requested;
  971. };
  972. /**
  973. * struct ethtool_sfeatures - command to request change in device's features
  974. * @cmd: command number = %ETHTOOL_SFEATURES
  975. * @size: array size of the features[] array
  976. * @features: feature change masks
  977. */
  978. struct ethtool_sfeatures {
  979. __u32 cmd;
  980. __u32 size;
  981. struct ethtool_set_features_block features[0];
  982. };
  983. /**
  984. * struct ethtool_ts_info - holds a device's timestamping and PHC association
  985. * @cmd: command number = %ETHTOOL_GET_TS_INFO
  986. * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
  987. * @phc_index: device index of the associated PHC, or -1 if there is none
  988. * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
  989. * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
  990. *
  991. * The bits in the 'tx_types' and 'rx_filters' fields correspond to
  992. * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
  993. * respectively. For example, if the device supports HWTSTAMP_TX_ON,
  994. * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
  995. */
  996. struct ethtool_ts_info {
  997. __u32 cmd;
  998. __u32 so_timestamping;
  999. __s32 phc_index;
  1000. __u32 tx_types;
  1001. __u32 tx_reserved[3];
  1002. __u32 rx_filters;
  1003. __u32 rx_reserved[3];
  1004. };
  1005. /*
  1006. * %ETHTOOL_SFEATURES changes features present in features[].valid to the
  1007. * values of corresponding bits in features[].requested. Bits in .requested
  1008. * not set in .valid or not changeable are ignored.
  1009. *
  1010. * Returns %EINVAL when .valid contains undefined or never-changeable bits
  1011. * or size is not equal to required number of features words (32-bit blocks).
  1012. * Returns >= 0 if request was completed; bits set in the value mean:
  1013. * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
  1014. * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
  1015. * those bits were ignored.
  1016. * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
  1017. * resulting state of bits masked by .valid is not equal to .requested.
  1018. * Probably there are other device-specific constraints on some features
  1019. * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
  1020. * here as though ignored bits were cleared.
  1021. * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
  1022. * compatibility functions. Requested offload state cannot be properly
  1023. * managed by kernel.
  1024. *
  1025. * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
  1026. * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
  1027. * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
  1028. * significant bit in features[0] fields. Empty strings mark undefined features.
  1029. */
  1030. enum ethtool_sfeatures_retval_bits {
  1031. ETHTOOL_F_UNSUPPORTED__BIT,
  1032. ETHTOOL_F_WISH__BIT,
  1033. ETHTOOL_F_COMPAT__BIT,
  1034. };
  1035. #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
  1036. #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
  1037. #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
  1038. /* CMDs currently supported */
  1039. #define ETHTOOL_GSET 0x00000001 /* Get settings. */
  1040. #define ETHTOOL_SSET 0x00000002 /* Set settings. */
  1041. #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
  1042. #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
  1043. #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
  1044. #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
  1045. #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
  1046. #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
  1047. #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
  1048. /* Get link status for host, i.e. whether the interface *and* the
  1049. * physical port (if there is one) are up (ethtool_value). */
  1050. #define ETHTOOL_GLINK 0x0000000a
  1051. #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
  1052. #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
  1053. #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
  1054. #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
  1055. #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
  1056. #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
  1057. #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
  1058. #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
  1059. #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
  1060. #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
  1061. #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
  1062. #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
  1063. #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
  1064. * (ethtool_value) */
  1065. #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
  1066. * (ethtool_value). */
  1067. #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
  1068. #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
  1069. #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
  1070. #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
  1071. #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
  1072. #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
  1073. #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
  1074. #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
  1075. #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
  1076. #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
  1077. #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
  1078. #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
  1079. #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
  1080. #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
  1081. #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
  1082. #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
  1083. #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
  1084. #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
  1085. #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
  1086. #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
  1087. #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
  1088. #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
  1089. #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
  1090. #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
  1091. #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
  1092. #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
  1093. #define ETHTOOL_RESET 0x00000034 /* Reset hardware */
  1094. #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
  1095. #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
  1096. #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
  1097. #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
  1098. #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
  1099. #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
  1100. #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
  1101. #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
  1102. #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
  1103. #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
  1104. #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
  1105. #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
  1106. #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
  1107. #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
  1108. #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
  1109. #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
  1110. #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
  1111. #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
  1112. #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
  1113. #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
  1114. #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
  1115. /* compatibility with older code */
  1116. #define SPARC_ETH_GSET ETHTOOL_GSET
  1117. #define SPARC_ETH_SSET ETHTOOL_SSET
  1118. #define SUPPORTED_10baseT_Half (1 << 0)
  1119. #define SUPPORTED_10baseT_Full (1 << 1)
  1120. #define SUPPORTED_100baseT_Half (1 << 2)
  1121. #define SUPPORTED_100baseT_Full (1 << 3)
  1122. #define SUPPORTED_1000baseT_Half (1 << 4)
  1123. #define SUPPORTED_1000baseT_Full (1 << 5)
  1124. #define SUPPORTED_Autoneg (1 << 6)
  1125. #define SUPPORTED_TP (1 << 7)
  1126. #define SUPPORTED_AUI (1 << 8)
  1127. #define SUPPORTED_MII (1 << 9)
  1128. #define SUPPORTED_FIBRE (1 << 10)
  1129. #define SUPPORTED_BNC (1 << 11)
  1130. #define SUPPORTED_10000baseT_Full (1 << 12)
  1131. #define SUPPORTED_Pause (1 << 13)
  1132. #define SUPPORTED_Asym_Pause (1 << 14)
  1133. #define SUPPORTED_2500baseX_Full (1 << 15)
  1134. #define SUPPORTED_Backplane (1 << 16)
  1135. #define SUPPORTED_1000baseKX_Full (1 << 17)
  1136. #define SUPPORTED_10000baseKX4_Full (1 << 18)
  1137. #define SUPPORTED_10000baseKR_Full (1 << 19)
  1138. #define SUPPORTED_10000baseR_FEC (1 << 20)
  1139. #define SUPPORTED_20000baseMLD2_Full (1 << 21)
  1140. #define SUPPORTED_20000baseKR2_Full (1 << 22)
  1141. #define SUPPORTED_40000baseKR4_Full (1 << 23)
  1142. #define SUPPORTED_40000baseCR4_Full (1 << 24)
  1143. #define SUPPORTED_40000baseSR4_Full (1 << 25)
  1144. #define SUPPORTED_40000baseLR4_Full (1 << 26)
  1145. #define ADVERTISED_10baseT_Half (1 << 0)
  1146. #define ADVERTISED_10baseT_Full (1 << 1)
  1147. #define ADVERTISED_100baseT_Half (1 << 2)
  1148. #define ADVERTISED_100baseT_Full (1 << 3)
  1149. #define ADVERTISED_1000baseT_Half (1 << 4)
  1150. #define ADVERTISED_1000baseT_Full (1 << 5)
  1151. #define ADVERTISED_Autoneg (1 << 6)
  1152. #define ADVERTISED_TP (1 << 7)
  1153. #define ADVERTISED_AUI (1 << 8)
  1154. #define ADVERTISED_MII (1 << 9)
  1155. #define ADVERTISED_FIBRE (1 << 10)
  1156. #define ADVERTISED_BNC (1 << 11)
  1157. #define ADVERTISED_10000baseT_Full (1 << 12)
  1158. #define ADVERTISED_Pause (1 << 13)
  1159. #define ADVERTISED_Asym_Pause (1 << 14)
  1160. #define ADVERTISED_2500baseX_Full (1 << 15)
  1161. #define ADVERTISED_Backplane (1 << 16)
  1162. #define ADVERTISED_1000baseKX_Full (1 << 17)
  1163. #define ADVERTISED_10000baseKX4_Full (1 << 18)
  1164. #define ADVERTISED_10000baseKR_Full (1 << 19)
  1165. #define ADVERTISED_10000baseR_FEC (1 << 20)
  1166. #define ADVERTISED_20000baseMLD2_Full (1 << 21)
  1167. #define ADVERTISED_20000baseKR2_Full (1 << 22)
  1168. #define ADVERTISED_40000baseKR4_Full (1 << 23)
  1169. #define ADVERTISED_40000baseCR4_Full (1 << 24)
  1170. #define ADVERTISED_40000baseSR4_Full (1 << 25)
  1171. #define ADVERTISED_40000baseLR4_Full (1 << 26)
  1172. /* The following are all involved in forcing a particular link
  1173. * mode for the device for setting things. When getting the
  1174. * devices settings, these indicate the current mode and whether
  1175. * it was forced up into this mode or autonegotiated.
  1176. */
  1177. /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
  1178. #define SPEED_10 10
  1179. #define SPEED_100 100
  1180. #define SPEED_1000 1000
  1181. #define SPEED_2500 2500
  1182. #define SPEED_10000 10000
  1183. #define SPEED_UNKNOWN -1
  1184. /* Duplex, half or full. */
  1185. #define DUPLEX_HALF 0x00
  1186. #define DUPLEX_FULL 0x01
  1187. #define DUPLEX_UNKNOWN 0xff
  1188. /* Which connector port. */
  1189. #define PORT_TP 0x00
  1190. #define PORT_AUI 0x01
  1191. #define PORT_MII 0x02
  1192. #define PORT_FIBRE 0x03
  1193. #define PORT_BNC 0x04
  1194. #define PORT_DA 0x05
  1195. #define PORT_NONE 0xef
  1196. #define PORT_OTHER 0xff
  1197. /* Which transceiver to use. */
  1198. #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
  1199. #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
  1200. #define XCVR_DUMMY1 0x02
  1201. #define XCVR_DUMMY2 0x03
  1202. #define XCVR_DUMMY3 0x04
  1203. /* Enable or disable autonegotiation. */
  1204. #define AUTONEG_DISABLE 0x00
  1205. #define AUTONEG_ENABLE 0x01
  1206. /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
  1207. * the driver is required to renegotiate link
  1208. */
  1209. #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
  1210. #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
  1211. #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
  1212. #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
  1213. /* Wake-On-Lan options. */
  1214. #define WAKE_PHY (1 << 0)
  1215. #define WAKE_UCAST (1 << 1)
  1216. #define WAKE_MCAST (1 << 2)
  1217. #define WAKE_BCAST (1 << 3)
  1218. #define WAKE_ARP (1 << 4)
  1219. #define WAKE_MAGIC (1 << 5)
  1220. #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
  1221. /* L2-L4 network traffic flow types */
  1222. #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
  1223. #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
  1224. #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
  1225. #define AH_ESP_V4_FLOW 0x04 /* hash only */
  1226. #define TCP_V6_FLOW 0x05 /* hash only */
  1227. #define UDP_V6_FLOW 0x06 /* hash only */
  1228. #define SCTP_V6_FLOW 0x07 /* hash only */
  1229. #define AH_ESP_V6_FLOW 0x08 /* hash only */
  1230. #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
  1231. #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
  1232. #define AH_V6_FLOW 0x0b /* hash only */
  1233. #define ESP_V6_FLOW 0x0c /* hash only */
  1234. #define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
  1235. #define IPV4_FLOW 0x10 /* hash only */
  1236. #define IPV6_FLOW 0x11 /* hash only */
  1237. #define ETHER_FLOW 0x12 /* spec only (ether_spec) */
  1238. /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
  1239. #define FLOW_EXT 0x80000000
  1240. #define FLOW_MAC_EXT 0x40000000
  1241. /* L3-L4 network traffic flow hash options */
  1242. #define RXH_L2DA (1 << 1)
  1243. #define RXH_VLAN (1 << 2)
  1244. #define RXH_L3_PROTO (1 << 3)
  1245. #define RXH_IP_SRC (1 << 4)
  1246. #define RXH_IP_DST (1 << 5)
  1247. #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
  1248. #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
  1249. #define RXH_DISCARD (1 << 31)
  1250. #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
  1251. /* Special RX classification rule insert location values */
  1252. #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
  1253. #define RX_CLS_LOC_ANY 0xffffffff
  1254. #define RX_CLS_LOC_FIRST 0xfffffffe
  1255. #define RX_CLS_LOC_LAST 0xfffffffd
  1256. /* EEPROM Standards for plug in modules */
  1257. #define ETH_MODULE_SFF_8079 0x1
  1258. #define ETH_MODULE_SFF_8079_LEN 256
  1259. #define ETH_MODULE_SFF_8472 0x2
  1260. #define ETH_MODULE_SFF_8472_LEN 512
  1261. /* Reset flags */
  1262. /* The reset() operation must clear the flags for the components which
  1263. * were actually reset. On successful return, the flags indicate the
  1264. * components which were not reset, either because they do not exist
  1265. * in the hardware or because they cannot be reset independently. The
  1266. * driver must never reset any components that were not requested.
  1267. */
  1268. enum ethtool_reset_flags {
  1269. /* These flags represent components dedicated to the interface
  1270. * the command is addressed to. Shift any flag left by
  1271. * ETH_RESET_SHARED_SHIFT to reset a shared component of the
  1272. * same type.
  1273. */
  1274. ETH_RESET_MGMT = 1 << 0, /* Management processor */
  1275. ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
  1276. ETH_RESET_DMA = 1 << 2, /* DMA engine */
  1277. ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
  1278. ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
  1279. ETH_RESET_MAC = 1 << 5, /* Media access controller */
  1280. ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
  1281. ETH_RESET_RAM = 1 << 7, /* RAM shared between
  1282. * multiple components */
  1283. ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
  1284. * this interface */
  1285. ETH_RESET_ALL = 0xffffffff, /* All components used by this
  1286. * interface, even if shared */
  1287. };
  1288. #define ETH_RESET_SHARED_SHIFT 16
  1289. #endif /* _UAPI_LINUX_ETHTOOL_H */