ethtool.h 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * ethtool.h: Defines for Linux ethtool.
  4. *
  5. * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  6. * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
  7. * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
  8. * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
  9. * christopher.leech@intel.com,
  10. * scott.feldman@intel.com)
  11. * Portions Copyright (C) Sun Microsystems 2008
  12. */
  13. #ifndef _UAPI_LINUX_ETHTOOL_H
  14. #define _UAPI_LINUX_ETHTOOL_H
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/if_ether.h>
  18. #ifndef __KERNEL__
  19. #include <limits.h> /* for INT_MAX */
  20. #endif
  21. /* All structures exposed to userland should be defined such that they
  22. * have the same layout for 32-bit and 64-bit userland.
  23. */
  24. /**
  25. * struct ethtool_cmd - DEPRECATED, link control and status
  26. * This structure is DEPRECATED, please use struct ethtool_link_settings.
  27. * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
  28. * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
  29. * physical connectors and other link features for which the
  30. * interface supports autonegotiation or auto-detection.
  31. * Read-only.
  32. * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
  33. * physical connectors and other link features that are
  34. * advertised through autonegotiation or enabled for
  35. * auto-detection.
  36. * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
  37. * @duplex: Duplex mode; one of %DUPLEX_*
  38. * @port: Physical connector type; one of %PORT_*
  39. * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
  40. * applicable. For clause 45 PHYs this is the PRTAD.
  41. * @transceiver: Historically used to distinguish different possible
  42. * PHY types, but not in a consistent way. Deprecated.
  43. * @autoneg: Enable/disable autonegotiation and auto-detection;
  44. * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
  45. * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
  46. * protocols supported by the interface; 0 if unknown.
  47. * Read-only.
  48. * @maxtxpkt: Historically used to report TX IRQ coalescing; now
  49. * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
  50. * @maxrxpkt: Historically used to report RX IRQ coalescing; now
  51. * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
  52. * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
  53. * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
  54. * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
  55. * value will be %ETH_TP_MDI_INVALID. Read-only.
  56. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
  57. * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
  58. * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
  59. * When written successfully, the link should be renegotiated if
  60. * necessary.
  61. * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
  62. * and other link features that the link partner advertised
  63. * through autonegotiation; 0 if unknown or not applicable.
  64. * Read-only.
  65. *
  66. * The link speed in Mbps is split between @speed and @speed_hi. Use
  67. * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
  68. * access it.
  69. *
  70. * If autonegotiation is disabled, the speed and @duplex represent the
  71. * fixed link mode and are writable if the driver supports multiple
  72. * link modes. If it is enabled then they are read-only; if the link
  73. * is up they represent the negotiated link mode; if the link is down,
  74. * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
  75. * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
  76. *
  77. * Some hardware interfaces may have multiple PHYs and/or physical
  78. * connectors fitted or do not allow the driver to detect which are
  79. * fitted. For these interfaces @port and/or @phy_address may be
  80. * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
  81. * Otherwise, attempts to write different values may be ignored or
  82. * rejected.
  83. *
  84. * Users should assume that all fields not marked read-only are
  85. * writable and subject to validation by the driver. They should use
  86. * %ETHTOOL_GSET to get the current values before making specific
  87. * changes and then applying them with %ETHTOOL_SSET.
  88. *
  89. * Drivers that implement set_settings() should validate all fields
  90. * other than @cmd that are not described as read-only or deprecated,
  91. * and must ignore all fields described as read-only.
  92. *
  93. * Deprecated fields should be ignored by both users and drivers.
  94. */
  95. struct ethtool_cmd {
  96. __u32 cmd;
  97. __u32 supported;
  98. __u32 advertising;
  99. __u16 speed;
  100. __u8 duplex;
  101. __u8 port;
  102. __u8 phy_address;
  103. __u8 transceiver;
  104. __u8 autoneg;
  105. __u8 mdio_support;
  106. __u32 maxtxpkt;
  107. __u32 maxrxpkt;
  108. __u16 speed_hi;
  109. __u8 eth_tp_mdix;
  110. __u8 eth_tp_mdix_ctrl;
  111. __u32 lp_advertising;
  112. __u32 reserved[2];
  113. };
  114. static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
  115. __u32 speed)
  116. {
  117. ep->speed = (__u16)(speed & 0xFFFF);
  118. ep->speed_hi = (__u16)(speed >> 16);
  119. }
  120. static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
  121. {
  122. return (ep->speed_hi << 16) | ep->speed;
  123. }
  124. /* Device supports clause 22 register access to PHY or peripherals
  125. * using the interface defined in <linux/mii.h>. This should not be
  126. * set if there are known to be no such peripherals present or if
  127. * the driver only emulates clause 22 registers for compatibility.
  128. */
  129. #define ETH_MDIO_SUPPORTS_C22 1
  130. /* Device supports clause 45 register access to PHY or peripherals
  131. * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
  132. * This should not be set if there are known to be no such peripherals
  133. * present.
  134. */
  135. #define ETH_MDIO_SUPPORTS_C45 2
  136. #define ETHTOOL_FWVERS_LEN 32
  137. #define ETHTOOL_BUSINFO_LEN 32
  138. #define ETHTOOL_EROMVERS_LEN 32
  139. /**
  140. * struct ethtool_drvinfo - general driver and device information
  141. * @cmd: Command number = %ETHTOOL_GDRVINFO
  142. * @driver: Driver short name. This should normally match the name
  143. * in its bus driver structure (e.g. pci_driver::name). Must
  144. * not be an empty string.
  145. * @version: Driver version string; may be an empty string
  146. * @fw_version: Firmware version string; may be an empty string
  147. * @erom_version: Expansion ROM version string; may be an empty string
  148. * @bus_info: Device bus address. This should match the dev_name()
  149. * string for the underlying bus device, if there is one. May be
  150. * an empty string.
  151. * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
  152. * %ETHTOOL_SPFLAGS commands; also the number of strings in the
  153. * %ETH_SS_PRIV_FLAGS set
  154. * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
  155. * command; also the number of strings in the %ETH_SS_STATS set
  156. * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
  157. * command; also the number of strings in the %ETH_SS_TEST set
  158. * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
  159. * and %ETHTOOL_SEEPROM commands, in bytes
  160. * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
  161. * command, in bytes
  162. *
  163. * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
  164. * strings in any string set (from Linux 2.6.34).
  165. *
  166. * Drivers should set at most @driver, @version, @fw_version and
  167. * @bus_info in their get_drvinfo() implementation. The ethtool
  168. * core fills in the other fields using other driver operations.
  169. */
  170. struct ethtool_drvinfo {
  171. __u32 cmd;
  172. char driver[32];
  173. char version[32];
  174. char fw_version[ETHTOOL_FWVERS_LEN];
  175. char bus_info[ETHTOOL_BUSINFO_LEN];
  176. char erom_version[ETHTOOL_EROMVERS_LEN];
  177. char reserved2[12];
  178. __u32 n_priv_flags;
  179. __u32 n_stats;
  180. __u32 testinfo_len;
  181. __u32 eedump_len;
  182. __u32 regdump_len;
  183. };
  184. #define SOPASS_MAX 6
  185. /**
  186. * struct ethtool_wolinfo - Wake-On-Lan configuration
  187. * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
  188. * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
  189. * Read-only.
  190. * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
  191. * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
  192. * is set in @wolopts.
  193. */
  194. struct ethtool_wolinfo {
  195. __u32 cmd;
  196. __u32 supported;
  197. __u32 wolopts;
  198. __u8 sopass[SOPASS_MAX];
  199. };
  200. /* for passing single values */
  201. struct ethtool_value {
  202. __u32 cmd;
  203. __u32 data;
  204. };
  205. #define PFC_STORM_PREVENTION_AUTO 0xffff
  206. #define PFC_STORM_PREVENTION_DISABLE 0
  207. enum tunable_id {
  208. ETHTOOL_ID_UNSPEC,
  209. ETHTOOL_RX_COPYBREAK,
  210. ETHTOOL_TX_COPYBREAK,
  211. ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
  212. /*
  213. * Add your fresh new tunable attribute above and remember to update
  214. * tunable_strings[] in net/core/ethtool.c
  215. */
  216. __ETHTOOL_TUNABLE_COUNT,
  217. };
  218. enum tunable_type_id {
  219. ETHTOOL_TUNABLE_UNSPEC,
  220. ETHTOOL_TUNABLE_U8,
  221. ETHTOOL_TUNABLE_U16,
  222. ETHTOOL_TUNABLE_U32,
  223. ETHTOOL_TUNABLE_U64,
  224. ETHTOOL_TUNABLE_STRING,
  225. ETHTOOL_TUNABLE_S8,
  226. ETHTOOL_TUNABLE_S16,
  227. ETHTOOL_TUNABLE_S32,
  228. ETHTOOL_TUNABLE_S64,
  229. };
  230. struct ethtool_tunable {
  231. __u32 cmd;
  232. __u32 id;
  233. __u32 type_id;
  234. __u32 len;
  235. void *data[0];
  236. };
  237. #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff
  238. #define DOWNSHIFT_DEV_DISABLE 0
  239. enum phy_tunable_id {
  240. ETHTOOL_PHY_ID_UNSPEC,
  241. ETHTOOL_PHY_DOWNSHIFT,
  242. /*
  243. * Add your fresh new phy tunable attribute above and remember to update
  244. * phy_tunable_strings[] in net/core/ethtool.c
  245. */
  246. __ETHTOOL_PHY_TUNABLE_COUNT,
  247. };
  248. /**
  249. * struct ethtool_regs - hardware register dump
  250. * @cmd: Command number = %ETHTOOL_GREGS
  251. * @version: Dump format version. This is driver-specific and may
  252. * distinguish different chips/revisions. Drivers must use new
  253. * version numbers whenever the dump format changes in an
  254. * incompatible way.
  255. * @len: On entry, the real length of @data. On return, the number of
  256. * bytes used.
  257. * @data: Buffer for the register dump
  258. *
  259. * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
  260. * a register dump for the interface. They must allocate the buffer
  261. * immediately following this structure.
  262. */
  263. struct ethtool_regs {
  264. __u32 cmd;
  265. __u32 version;
  266. __u32 len;
  267. __u8 data[0];
  268. };
  269. /**
  270. * struct ethtool_eeprom - EEPROM dump
  271. * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
  272. * %ETHTOOL_SEEPROM
  273. * @magic: A 'magic cookie' value to guard against accidental changes.
  274. * The value passed in to %ETHTOOL_SEEPROM must match the value
  275. * returned by %ETHTOOL_GEEPROM for the same device. This is
  276. * unused when @cmd is %ETHTOOL_GMODULEEEPROM.
  277. * @offset: Offset within the EEPROM to begin reading/writing, in bytes
  278. * @len: On entry, number of bytes to read/write. On successful
  279. * return, number of bytes actually read/written. In case of
  280. * error, this may indicate at what point the error occurred.
  281. * @data: Buffer to read/write from
  282. *
  283. * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
  284. * the length of an on-board or module EEPROM, respectively. They
  285. * must allocate the buffer immediately following this structure.
  286. */
  287. struct ethtool_eeprom {
  288. __u32 cmd;
  289. __u32 magic;
  290. __u32 offset;
  291. __u32 len;
  292. __u8 data[0];
  293. };
  294. /**
  295. * struct ethtool_eee - Energy Efficient Ethernet information
  296. * @cmd: ETHTOOL_{G,S}EEE
  297. * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
  298. * for which there is EEE support.
  299. * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
  300. * advertised as eee capable.
  301. * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
  302. * combinations advertised by the link partner as eee capable.
  303. * @eee_active: Result of the eee auto negotiation.
  304. * @eee_enabled: EEE configured mode (enabled/disabled).
  305. * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
  306. * that eee was negotiated.
  307. * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
  308. * its tx lpi (after reaching 'idle' state). Effective only when eee
  309. * was negotiated and tx_lpi_enabled was set.
  310. */
  311. struct ethtool_eee {
  312. __u32 cmd;
  313. __u32 supported;
  314. __u32 advertised;
  315. __u32 lp_advertised;
  316. __u32 eee_active;
  317. __u32 eee_enabled;
  318. __u32 tx_lpi_enabled;
  319. __u32 tx_lpi_timer;
  320. __u32 reserved[2];
  321. };
  322. /**
  323. * struct ethtool_modinfo - plugin module eeprom information
  324. * @cmd: %ETHTOOL_GMODULEINFO
  325. * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
  326. * @eeprom_len: Length of the eeprom
  327. *
  328. * This structure is used to return the information to
  329. * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
  330. * The type code indicates the eeprom data format
  331. */
  332. struct ethtool_modinfo {
  333. __u32 cmd;
  334. __u32 type;
  335. __u32 eeprom_len;
  336. __u32 reserved[8];
  337. };
  338. /**
  339. * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
  340. * @cmd: ETHTOOL_{G,S}COALESCE
  341. * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
  342. * a packet arrives.
  343. * @rx_max_coalesced_frames: Maximum number of packets to receive
  344. * before an RX interrupt.
  345. * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
  346. * this value applies while an IRQ is being serviced by the host.
  347. * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
  348. * except that this value applies while an IRQ is being serviced
  349. * by the host.
  350. * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
  351. * a packet is sent.
  352. * @tx_max_coalesced_frames: Maximum number of packets to be sent
  353. * before a TX interrupt.
  354. * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
  355. * this value applies while an IRQ is being serviced by the host.
  356. * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
  357. * except that this value applies while an IRQ is being serviced
  358. * by the host.
  359. * @stats_block_coalesce_usecs: How many usecs to delay in-memory
  360. * statistics block updates. Some drivers do not have an
  361. * in-memory statistic block, and in such cases this value is
  362. * ignored. This value must not be zero.
  363. * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
  364. * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
  365. * @pkt_rate_low: Threshold for low packet rate (packets per second).
  366. * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
  367. * a packet arrives, when the packet rate is below @pkt_rate_low.
  368. * @rx_max_coalesced_frames_low: Maximum number of packets to be received
  369. * before an RX interrupt, when the packet rate is below @pkt_rate_low.
  370. * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
  371. * a packet is sent, when the packet rate is below @pkt_rate_low.
  372. * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
  373. * a TX interrupt, when the packet rate is below @pkt_rate_low.
  374. * @pkt_rate_high: Threshold for high packet rate (packets per second).
  375. * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
  376. * a packet arrives, when the packet rate is above @pkt_rate_high.
  377. * @rx_max_coalesced_frames_high: Maximum number of packets to be received
  378. * before an RX interrupt, when the packet rate is above @pkt_rate_high.
  379. * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
  380. * a packet is sent, when the packet rate is above @pkt_rate_high.
  381. * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
  382. * a TX interrupt, when the packet rate is above @pkt_rate_high.
  383. * @rate_sample_interval: How often to do adaptive coalescing packet rate
  384. * sampling, measured in seconds. Must not be zero.
  385. *
  386. * Each pair of (usecs, max_frames) fields specifies that interrupts
  387. * should be coalesced until
  388. * (usecs > 0 && time_since_first_completion >= usecs) ||
  389. * (max_frames > 0 && completed_frames >= max_frames)
  390. *
  391. * It is illegal to set both usecs and max_frames to zero as this
  392. * would cause interrupts to never be generated. To disable
  393. * coalescing, set usecs = 0 and max_frames = 1.
  394. *
  395. * Some implementations ignore the value of max_frames and use the
  396. * condition time_since_first_completion >= usecs
  397. *
  398. * This is deprecated. Drivers for hardware that does not support
  399. * counting completions should validate that max_frames == !rx_usecs.
  400. *
  401. * Adaptive RX/TX coalescing is an algorithm implemented by some
  402. * drivers to improve latency under low packet rates and improve
  403. * throughput under high packet rates. Some drivers only implement
  404. * one of RX or TX adaptive coalescing. Anything not implemented by
  405. * the driver causes these values to be silently ignored.
  406. *
  407. * When the packet rate is below @pkt_rate_high but above
  408. * @pkt_rate_low (both measured in packets per second) the
  409. * normal {rx,tx}_* coalescing parameters are used.
  410. */
  411. struct ethtool_coalesce {
  412. __u32 cmd;
  413. __u32 rx_coalesce_usecs;
  414. __u32 rx_max_coalesced_frames;
  415. __u32 rx_coalesce_usecs_irq;
  416. __u32 rx_max_coalesced_frames_irq;
  417. __u32 tx_coalesce_usecs;
  418. __u32 tx_max_coalesced_frames;
  419. __u32 tx_coalesce_usecs_irq;
  420. __u32 tx_max_coalesced_frames_irq;
  421. __u32 stats_block_coalesce_usecs;
  422. __u32 use_adaptive_rx_coalesce;
  423. __u32 use_adaptive_tx_coalesce;
  424. __u32 pkt_rate_low;
  425. __u32 rx_coalesce_usecs_low;
  426. __u32 rx_max_coalesced_frames_low;
  427. __u32 tx_coalesce_usecs_low;
  428. __u32 tx_max_coalesced_frames_low;
  429. __u32 pkt_rate_high;
  430. __u32 rx_coalesce_usecs_high;
  431. __u32 rx_max_coalesced_frames_high;
  432. __u32 tx_coalesce_usecs_high;
  433. __u32 tx_max_coalesced_frames_high;
  434. __u32 rate_sample_interval;
  435. };
  436. /**
  437. * struct ethtool_ringparam - RX/TX ring parameters
  438. * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
  439. * @rx_max_pending: Maximum supported number of pending entries per
  440. * RX ring. Read-only.
  441. * @rx_mini_max_pending: Maximum supported number of pending entries
  442. * per RX mini ring. Read-only.
  443. * @rx_jumbo_max_pending: Maximum supported number of pending entries
  444. * per RX jumbo ring. Read-only.
  445. * @tx_max_pending: Maximum supported number of pending entries per
  446. * TX ring. Read-only.
  447. * @rx_pending: Current maximum number of pending entries per RX ring
  448. * @rx_mini_pending: Current maximum number of pending entries per RX
  449. * mini ring
  450. * @rx_jumbo_pending: Current maximum number of pending entries per RX
  451. * jumbo ring
  452. * @tx_pending: Current maximum supported number of pending entries
  453. * per TX ring
  454. *
  455. * If the interface does not have separate RX mini and/or jumbo rings,
  456. * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
  457. *
  458. * There may also be driver-dependent minimum values for the number
  459. * of entries per ring.
  460. */
  461. struct ethtool_ringparam {
  462. __u32 cmd;
  463. __u32 rx_max_pending;
  464. __u32 rx_mini_max_pending;
  465. __u32 rx_jumbo_max_pending;
  466. __u32 tx_max_pending;
  467. __u32 rx_pending;
  468. __u32 rx_mini_pending;
  469. __u32 rx_jumbo_pending;
  470. __u32 tx_pending;
  471. };
  472. /**
  473. * struct ethtool_channels - configuring number of network channel
  474. * @cmd: ETHTOOL_{G,S}CHANNELS
  475. * @max_rx: Read only. Maximum number of receive channel the driver support.
  476. * @max_tx: Read only. Maximum number of transmit channel the driver support.
  477. * @max_other: Read only. Maximum number of other channel the driver support.
  478. * @max_combined: Read only. Maximum number of combined channel the driver
  479. * support. Set of queues RX, TX or other.
  480. * @rx_count: Valid values are in the range 1 to the max_rx.
  481. * @tx_count: Valid values are in the range 1 to the max_tx.
  482. * @other_count: Valid values are in the range 1 to the max_other.
  483. * @combined_count: Valid values are in the range 1 to the max_combined.
  484. *
  485. * This can be used to configure RX, TX and other channels.
  486. */
  487. struct ethtool_channels {
  488. __u32 cmd;
  489. __u32 max_rx;
  490. __u32 max_tx;
  491. __u32 max_other;
  492. __u32 max_combined;
  493. __u32 rx_count;
  494. __u32 tx_count;
  495. __u32 other_count;
  496. __u32 combined_count;
  497. };
  498. /**
  499. * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
  500. * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
  501. * @autoneg: Flag to enable autonegotiation of pause frame use
  502. * @rx_pause: Flag to enable reception of pause frames
  503. * @tx_pause: Flag to enable transmission of pause frames
  504. *
  505. * Drivers should reject a non-zero setting of @autoneg when
  506. * autoneogotiation is disabled (or not supported) for the link.
  507. *
  508. * If the link is autonegotiated, drivers should use
  509. * mii_advertise_flowctrl() or similar code to set the advertised
  510. * pause frame capabilities based on the @rx_pause and @tx_pause flags,
  511. * even if @autoneg is zero. They should also allow the advertised
  512. * pause frame capabilities to be controlled directly through the
  513. * advertising field of &struct ethtool_cmd.
  514. *
  515. * If @autoneg is non-zero, the MAC is configured to send and/or
  516. * receive pause frames according to the result of autonegotiation.
  517. * Otherwise, it is configured directly based on the @rx_pause and
  518. * @tx_pause flags.
  519. */
  520. struct ethtool_pauseparam {
  521. __u32 cmd;
  522. __u32 autoneg;
  523. __u32 rx_pause;
  524. __u32 tx_pause;
  525. };
  526. #define ETH_GSTRING_LEN 32
  527. /**
  528. * enum ethtool_stringset - string set ID
  529. * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
  530. * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
  531. * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
  532. * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
  533. * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
  534. * now deprecated
  535. * @ETH_SS_FEATURES: Device feature names
  536. * @ETH_SS_RSS_HASH_FUNCS: RSS hush function names
  537. * @ETH_SS_PHY_STATS: Statistic names, for use with %ETHTOOL_GPHYSTATS
  538. * @ETH_SS_PHY_TUNABLES: PHY tunable names
  539. */
  540. enum ethtool_stringset {
  541. ETH_SS_TEST = 0,
  542. ETH_SS_STATS,
  543. ETH_SS_PRIV_FLAGS,
  544. ETH_SS_NTUPLE_FILTERS,
  545. ETH_SS_FEATURES,
  546. ETH_SS_RSS_HASH_FUNCS,
  547. ETH_SS_TUNABLES,
  548. ETH_SS_PHY_STATS,
  549. ETH_SS_PHY_TUNABLES,
  550. };
  551. /**
  552. * struct ethtool_gstrings - string set for data tagging
  553. * @cmd: Command number = %ETHTOOL_GSTRINGS
  554. * @string_set: String set ID; one of &enum ethtool_stringset
  555. * @len: On return, the number of strings in the string set
  556. * @data: Buffer for strings. Each string is null-padded to a size of
  557. * %ETH_GSTRING_LEN.
  558. *
  559. * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
  560. * the string set. They must allocate a buffer of the appropriate
  561. * size immediately following this structure.
  562. */
  563. struct ethtool_gstrings {
  564. __u32 cmd;
  565. __u32 string_set;
  566. __u32 len;
  567. __u8 data[0];
  568. };
  569. /**
  570. * struct ethtool_sset_info - string set information
  571. * @cmd: Command number = %ETHTOOL_GSSET_INFO
  572. * @sset_mask: On entry, a bitmask of string sets to query, with bits
  573. * numbered according to &enum ethtool_stringset. On return, a
  574. * bitmask of those string sets queried that are supported.
  575. * @data: Buffer for string set sizes. On return, this contains the
  576. * size of each string set that was queried and supported, in
  577. * order of ID.
  578. *
  579. * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
  580. * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the
  581. * size of set 1 and @data[1] contains the size of set 2.
  582. *
  583. * Users must allocate a buffer of the appropriate size (4 * number of
  584. * sets queried) immediately following this structure.
  585. */
  586. struct ethtool_sset_info {
  587. __u32 cmd;
  588. __u32 reserved;
  589. __u64 sset_mask;
  590. __u32 data[0];
  591. };
  592. /**
  593. * enum ethtool_test_flags - flags definition of ethtool_test
  594. * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
  595. * only online tests.
  596. * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
  597. * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
  598. * test.
  599. * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
  600. */
  601. enum ethtool_test_flags {
  602. ETH_TEST_FL_OFFLINE = (1 << 0),
  603. ETH_TEST_FL_FAILED = (1 << 1),
  604. ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
  605. ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
  606. };
  607. /**
  608. * struct ethtool_test - device self-test invocation
  609. * @cmd: Command number = %ETHTOOL_TEST
  610. * @flags: A bitmask of flags from &enum ethtool_test_flags. Some
  611. * flags may be set by the user on entry; others may be set by
  612. * the driver on return.
  613. * @len: On return, the number of test results
  614. * @data: Array of test results
  615. *
  616. * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
  617. * number of test results that will be returned. They must allocate a
  618. * buffer of the appropriate size (8 * number of results) immediately
  619. * following this structure.
  620. */
  621. struct ethtool_test {
  622. __u32 cmd;
  623. __u32 flags;
  624. __u32 reserved;
  625. __u32 len;
  626. __u64 data[0];
  627. };
  628. /**
  629. * struct ethtool_stats - device-specific statistics
  630. * @cmd: Command number = %ETHTOOL_GSTATS
  631. * @n_stats: On return, the number of statistics
  632. * @data: Array of statistics
  633. *
  634. * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
  635. * number of statistics that will be returned. They must allocate a
  636. * buffer of the appropriate size (8 * number of statistics)
  637. * immediately following this structure.
  638. */
  639. struct ethtool_stats {
  640. __u32 cmd;
  641. __u32 n_stats;
  642. __u64 data[0];
  643. };
  644. /**
  645. * struct ethtool_perm_addr - permanent hardware address
  646. * @cmd: Command number = %ETHTOOL_GPERMADDR
  647. * @size: On entry, the size of the buffer. On return, the size of the
  648. * address. The command fails if the buffer is too small.
  649. * @data: Buffer for the address
  650. *
  651. * Users must allocate the buffer immediately following this structure.
  652. * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
  653. * type.
  654. */
  655. struct ethtool_perm_addr {
  656. __u32 cmd;
  657. __u32 size;
  658. __u8 data[0];
  659. };
  660. /* boolean flags controlling per-interface behavior characteristics.
  661. * When reading, the flag indicates whether or not a certain behavior
  662. * is enabled/present. When writing, the flag indicates whether
  663. * or not the driver should turn on (set) or off (clear) a behavior.
  664. *
  665. * Some behaviors may read-only (unconditionally absent or present).
  666. * If such is the case, return EINVAL in the set-flags operation if the
  667. * flag differs from the read-only value.
  668. */
  669. enum ethtool_flags {
  670. ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
  671. ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
  672. ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
  673. ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
  674. ETH_FLAG_RXHASH = (1 << 28),
  675. };
  676. /* The following structures are for supporting RX network flow
  677. * classification and RX n-tuple configuration. Note, all multibyte
  678. * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
  679. * be in network byte order.
  680. */
  681. /**
  682. * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
  683. * @ip4src: Source host
  684. * @ip4dst: Destination host
  685. * @psrc: Source port
  686. * @pdst: Destination port
  687. * @tos: Type-of-service
  688. *
  689. * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
  690. */
  691. struct ethtool_tcpip4_spec {
  692. __be32 ip4src;
  693. __be32 ip4dst;
  694. __be16 psrc;
  695. __be16 pdst;
  696. __u8 tos;
  697. };
  698. /**
  699. * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
  700. * @ip4src: Source host
  701. * @ip4dst: Destination host
  702. * @spi: Security parameters index
  703. * @tos: Type-of-service
  704. *
  705. * This can be used to specify an IPsec transport or tunnel over IPv4.
  706. */
  707. struct ethtool_ah_espip4_spec {
  708. __be32 ip4src;
  709. __be32 ip4dst;
  710. __be32 spi;
  711. __u8 tos;
  712. };
  713. #define ETH_RX_NFC_IP4 1
  714. /**
  715. * struct ethtool_usrip4_spec - general flow specification for IPv4
  716. * @ip4src: Source host
  717. * @ip4dst: Destination host
  718. * @l4_4_bytes: First 4 bytes of transport (layer 4) header
  719. * @tos: Type-of-service
  720. * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
  721. * @proto: Transport protocol number; mask must be 0
  722. */
  723. struct ethtool_usrip4_spec {
  724. __be32 ip4src;
  725. __be32 ip4dst;
  726. __be32 l4_4_bytes;
  727. __u8 tos;
  728. __u8 ip_ver;
  729. __u8 proto;
  730. };
  731. /**
  732. * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
  733. * @ip6src: Source host
  734. * @ip6dst: Destination host
  735. * @psrc: Source port
  736. * @pdst: Destination port
  737. * @tclass: Traffic Class
  738. *
  739. * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
  740. */
  741. struct ethtool_tcpip6_spec {
  742. __be32 ip6src[4];
  743. __be32 ip6dst[4];
  744. __be16 psrc;
  745. __be16 pdst;
  746. __u8 tclass;
  747. };
  748. /**
  749. * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
  750. * @ip6src: Source host
  751. * @ip6dst: Destination host
  752. * @spi: Security parameters index
  753. * @tclass: Traffic Class
  754. *
  755. * This can be used to specify an IPsec transport or tunnel over IPv6.
  756. */
  757. struct ethtool_ah_espip6_spec {
  758. __be32 ip6src[4];
  759. __be32 ip6dst[4];
  760. __be32 spi;
  761. __u8 tclass;
  762. };
  763. /**
  764. * struct ethtool_usrip6_spec - general flow specification for IPv6
  765. * @ip6src: Source host
  766. * @ip6dst: Destination host
  767. * @l4_4_bytes: First 4 bytes of transport (layer 4) header
  768. * @tclass: Traffic Class
  769. * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
  770. */
  771. struct ethtool_usrip6_spec {
  772. __be32 ip6src[4];
  773. __be32 ip6dst[4];
  774. __be32 l4_4_bytes;
  775. __u8 tclass;
  776. __u8 l4_proto;
  777. };
  778. union ethtool_flow_union {
  779. struct ethtool_tcpip4_spec tcp_ip4_spec;
  780. struct ethtool_tcpip4_spec udp_ip4_spec;
  781. struct ethtool_tcpip4_spec sctp_ip4_spec;
  782. struct ethtool_ah_espip4_spec ah_ip4_spec;
  783. struct ethtool_ah_espip4_spec esp_ip4_spec;
  784. struct ethtool_usrip4_spec usr_ip4_spec;
  785. struct ethtool_tcpip6_spec tcp_ip6_spec;
  786. struct ethtool_tcpip6_spec udp_ip6_spec;
  787. struct ethtool_tcpip6_spec sctp_ip6_spec;
  788. struct ethtool_ah_espip6_spec ah_ip6_spec;
  789. struct ethtool_ah_espip6_spec esp_ip6_spec;
  790. struct ethtool_usrip6_spec usr_ip6_spec;
  791. struct ethhdr ether_spec;
  792. __u8 hdata[52];
  793. };
  794. /**
  795. * struct ethtool_flow_ext - additional RX flow fields
  796. * @h_dest: destination MAC address
  797. * @vlan_etype: VLAN EtherType
  798. * @vlan_tci: VLAN tag control information
  799. * @data: user defined data
  800. *
  801. * Note, @vlan_etype, @vlan_tci, and @data are only valid if %FLOW_EXT
  802. * is set in &struct ethtool_rx_flow_spec @flow_type.
  803. * @h_dest is valid if %FLOW_MAC_EXT is set.
  804. */
  805. struct ethtool_flow_ext {
  806. __u8 padding[2];
  807. unsigned char h_dest[ETH_ALEN];
  808. __be16 vlan_etype;
  809. __be16 vlan_tci;
  810. __be32 data[2];
  811. };
  812. /**
  813. * struct ethtool_rx_flow_spec - classification rule for RX flows
  814. * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
  815. * @h_u: Flow fields to match (dependent on @flow_type)
  816. * @h_ext: Additional fields to match
  817. * @m_u: Masks for flow field bits to be matched
  818. * @m_ext: Masks for additional field bits to be matched
  819. * Note, all additional fields must be ignored unless @flow_type
  820. * includes the %FLOW_EXT or %FLOW_MAC_EXT flag
  821. * (see &struct ethtool_flow_ext description).
  822. * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
  823. * if packets should be discarded, or %RX_CLS_FLOW_WAKE if the
  824. * packets should be used for Wake-on-LAN with %WAKE_FILTER
  825. * @location: Location of rule in the table. Locations must be
  826. * numbered such that a flow matching multiple rules will be
  827. * classified according to the first (lowest numbered) rule.
  828. */
  829. struct ethtool_rx_flow_spec {
  830. __u32 flow_type;
  831. union ethtool_flow_union h_u;
  832. struct ethtool_flow_ext h_ext;
  833. union ethtool_flow_union m_u;
  834. struct ethtool_flow_ext m_ext;
  835. __u64 ring_cookie;
  836. __u32 location;
  837. };
  838. /* How rings are layed out when accessing virtual functions or
  839. * offloaded queues is device specific. To allow users to do flow
  840. * steering and specify these queues the ring cookie is partitioned
  841. * into a 32bit queue index with an 8 bit virtual function id.
  842. * This also leaves the 3bytes for further specifiers. It is possible
  843. * future devices may support more than 256 virtual functions if
  844. * devices start supporting PCIe w/ARI. However at the moment I
  845. * do not know of any devices that support this so I do not reserve
  846. * space for this at this time. If a future patch consumes the next
  847. * byte it should be aware of this possiblity.
  848. */
  849. #define ETHTOOL_RX_FLOW_SPEC_RING 0x00000000FFFFFFFFLL
  850. #define ETHTOOL_RX_FLOW_SPEC_RING_VF 0x000000FF00000000LL
  851. #define ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF 32
  852. static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
  853. {
  854. return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
  855. }
  856. static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
  857. {
  858. return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
  859. ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
  860. }
  861. /**
  862. * struct ethtool_rxnfc - command to get or set RX flow classification rules
  863. * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
  864. * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
  865. * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
  866. * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
  867. * @data: Command-dependent value
  868. * @fs: Flow classification rule
  869. * @rss_context: RSS context to be affected
  870. * @rule_cnt: Number of rules to be affected
  871. * @rule_locs: Array of used rule locations
  872. *
  873. * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
  874. * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
  875. * structure fields must not be used, except that if @flow_type includes
  876. * the %FLOW_RSS flag, then @rss_context determines which RSS context to
  877. * act on.
  878. *
  879. * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
  880. * on return.
  881. *
  882. * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
  883. * rules on return. If @data is non-zero on return then it is the
  884. * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
  885. * driver supports any special location values. If that flag is not
  886. * set in @data then special location values should not be used.
  887. *
  888. * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
  889. * existing rule on entry and @fs contains the rule on return; if
  890. * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is
  891. * filled with the RSS context ID associated with the rule.
  892. *
  893. * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
  894. * user buffer for @rule_locs on entry. On return, @data is the size
  895. * of the rule table, @rule_cnt is the number of defined rules, and
  896. * @rule_locs contains the locations of the defined rules. Drivers
  897. * must use the second parameter to get_rxnfc() instead of @rule_locs.
  898. *
  899. * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
  900. * @fs.@location either specifies the location to use or is a special
  901. * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
  902. * @fs.@location is the actual rule location. If @fs.@flow_type
  903. * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to
  904. * use for flow spreading traffic which matches this rule. The value
  905. * from the rxfh indirection table will be added to @fs.@ring_cookie
  906. * to choose which ring to deliver to.
  907. *
  908. * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
  909. * existing rule on entry.
  910. *
  911. * A driver supporting the special location values for
  912. * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
  913. * location, and may remove a rule at a later location (lower
  914. * priority) that matches exactly the same set of flows. The special
  915. * values are %RX_CLS_LOC_ANY, selecting any location;
  916. * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
  917. * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
  918. * location (minimum priority). Additional special values may be
  919. * defined in future and drivers must return -%EINVAL for any
  920. * unrecognised value.
  921. */
  922. struct ethtool_rxnfc {
  923. __u32 cmd;
  924. __u32 flow_type;
  925. __u64 data;
  926. struct ethtool_rx_flow_spec fs;
  927. union {
  928. __u32 rule_cnt;
  929. __u32 rss_context;
  930. };
  931. __u32 rule_locs[0];
  932. };
  933. /**
  934. * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
  935. * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
  936. * @size: On entry, the array size of the user buffer, which may be zero.
  937. * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
  938. * indirection table.
  939. * @ring_index: RX ring/queue index for each hash value
  940. *
  941. * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
  942. * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
  943. * the table should be reset to default values. This last feature
  944. * is not supported by the original implementations.
  945. */
  946. struct ethtool_rxfh_indir {
  947. __u32 cmd;
  948. __u32 size;
  949. __u32 ring_index[0];
  950. };
  951. /**
  952. * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
  953. * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
  954. * @rss_context: RSS context identifier. Context 0 is the default for normal
  955. * traffic; other contexts can be referenced as the destination for RX flow
  956. * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command
  957. * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will
  958. * contain the ID of the newly allocated context.
  959. * @indir_size: On entry, the array size of the user buffer for the
  960. * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
  961. * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
  962. * the array size of the hardware indirection table.
  963. * @key_size: On entry, the array size of the user buffer for the hash key,
  964. * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
  965. * hardware hash key.
  966. * @hfunc: Defines the current RSS hash function used by HW (or to be set to).
  967. * Valid values are one of the %ETH_RSS_HASH_*.
  968. * @rsvd: Reserved for future extensions.
  969. * @rss_config: RX ring/queue index for each hash value i.e., indirection table
  970. * of @indir_size __u32 elements, followed by hash key of @key_size
  971. * bytes.
  972. *
  973. * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
  974. * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
  975. * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
  976. * and a @indir_size of zero means the indir table should be reset to default
  977. * values (if @rss_context == 0) or that the RSS context should be deleted.
  978. * An hfunc of zero means that hash function setting is not requested.
  979. */
  980. struct ethtool_rxfh {
  981. __u32 cmd;
  982. __u32 rss_context;
  983. __u32 indir_size;
  984. __u32 key_size;
  985. __u8 hfunc;
  986. __u8 rsvd8[3];
  987. __u32 rsvd32;
  988. __u32 rss_config[0];
  989. };
  990. #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
  991. #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
  992. /**
  993. * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
  994. * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
  995. * @h_u: Flow field values to match (dependent on @flow_type)
  996. * @m_u: Masks for flow field value bits to be ignored
  997. * @vlan_tag: VLAN tag to match
  998. * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
  999. * @data: Driver-dependent data to match
  1000. * @data_mask: Mask for driver-dependent data bits to be ignored
  1001. * @action: RX ring/queue index to deliver to (non-negative) or other action
  1002. * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
  1003. *
  1004. * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
  1005. * a field value and mask are both zero this is treated as if all mask
  1006. * bits are set i.e. the field is ignored.
  1007. */
  1008. struct ethtool_rx_ntuple_flow_spec {
  1009. __u32 flow_type;
  1010. union {
  1011. struct ethtool_tcpip4_spec tcp_ip4_spec;
  1012. struct ethtool_tcpip4_spec udp_ip4_spec;
  1013. struct ethtool_tcpip4_spec sctp_ip4_spec;
  1014. struct ethtool_ah_espip4_spec ah_ip4_spec;
  1015. struct ethtool_ah_espip4_spec esp_ip4_spec;
  1016. struct ethtool_usrip4_spec usr_ip4_spec;
  1017. struct ethhdr ether_spec;
  1018. __u8 hdata[72];
  1019. } h_u, m_u;
  1020. __u16 vlan_tag;
  1021. __u16 vlan_tag_mask;
  1022. __u64 data;
  1023. __u64 data_mask;
  1024. __s32 action;
  1025. #define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
  1026. #define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
  1027. };
  1028. /**
  1029. * struct ethtool_rx_ntuple - command to set or clear RX flow filter
  1030. * @cmd: Command number - %ETHTOOL_SRXNTUPLE
  1031. * @fs: Flow filter specification
  1032. */
  1033. struct ethtool_rx_ntuple {
  1034. __u32 cmd;
  1035. struct ethtool_rx_ntuple_flow_spec fs;
  1036. };
  1037. #define ETHTOOL_FLASH_MAX_FILENAME 128
  1038. enum ethtool_flash_op_type {
  1039. ETHTOOL_FLASH_ALL_REGIONS = 0,
  1040. };
  1041. /* for passing firmware flashing related parameters */
  1042. struct ethtool_flash {
  1043. __u32 cmd;
  1044. __u32 region;
  1045. char data[ETHTOOL_FLASH_MAX_FILENAME];
  1046. };
  1047. /**
  1048. * struct ethtool_dump - used for retrieving, setting device dump
  1049. * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
  1050. * %ETHTOOL_SET_DUMP
  1051. * @version: FW version of the dump, filled in by driver
  1052. * @flag: driver dependent flag for dump setting, filled in by driver during
  1053. * get and filled in by ethtool for set operation.
  1054. * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
  1055. * firmware dump is disabled.
  1056. * @len: length of dump data, used as the length of the user buffer on entry to
  1057. * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
  1058. * for %ETHTOOL_GET_DUMP_FLAG command
  1059. * @data: data collected for get dump data operation
  1060. */
  1061. struct ethtool_dump {
  1062. __u32 cmd;
  1063. __u32 version;
  1064. __u32 flag;
  1065. __u32 len;
  1066. __u8 data[0];
  1067. };
  1068. #define ETH_FW_DUMP_DISABLE 0
  1069. /* for returning and changing feature sets */
  1070. /**
  1071. * struct ethtool_get_features_block - block with state of 32 features
  1072. * @available: mask of changeable features
  1073. * @requested: mask of features requested to be enabled if possible
  1074. * @active: mask of currently enabled features
  1075. * @never_changed: mask of features not changeable for any device
  1076. */
  1077. struct ethtool_get_features_block {
  1078. __u32 available;
  1079. __u32 requested;
  1080. __u32 active;
  1081. __u32 never_changed;
  1082. };
  1083. /**
  1084. * struct ethtool_gfeatures - command to get state of device's features
  1085. * @cmd: command number = %ETHTOOL_GFEATURES
  1086. * @size: On entry, the number of elements in the features[] array;
  1087. * on return, the number of elements in features[] needed to hold
  1088. * all features
  1089. * @features: state of features
  1090. */
  1091. struct ethtool_gfeatures {
  1092. __u32 cmd;
  1093. __u32 size;
  1094. struct ethtool_get_features_block features[0];
  1095. };
  1096. /**
  1097. * struct ethtool_set_features_block - block with request for 32 features
  1098. * @valid: mask of features to be changed
  1099. * @requested: values of features to be changed
  1100. */
  1101. struct ethtool_set_features_block {
  1102. __u32 valid;
  1103. __u32 requested;
  1104. };
  1105. /**
  1106. * struct ethtool_sfeatures - command to request change in device's features
  1107. * @cmd: command number = %ETHTOOL_SFEATURES
  1108. * @size: array size of the features[] array
  1109. * @features: feature change masks
  1110. */
  1111. struct ethtool_sfeatures {
  1112. __u32 cmd;
  1113. __u32 size;
  1114. struct ethtool_set_features_block features[0];
  1115. };
  1116. /**
  1117. * struct ethtool_ts_info - holds a device's timestamping and PHC association
  1118. * @cmd: command number = %ETHTOOL_GET_TS_INFO
  1119. * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
  1120. * @phc_index: device index of the associated PHC, or -1 if there is none
  1121. * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
  1122. * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
  1123. *
  1124. * The bits in the 'tx_types' and 'rx_filters' fields correspond to
  1125. * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
  1126. * respectively. For example, if the device supports HWTSTAMP_TX_ON,
  1127. * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
  1128. *
  1129. * Drivers should only report the filters they actually support without
  1130. * upscaling in the SIOCSHWTSTAMP ioctl. If the SIOCSHWSTAMP request for
  1131. * HWTSTAMP_FILTER_V1_SYNC is supported by HWTSTAMP_FILTER_V1_EVENT, then the
  1132. * driver should only report HWTSTAMP_FILTER_V1_EVENT in this op.
  1133. */
  1134. struct ethtool_ts_info {
  1135. __u32 cmd;
  1136. __u32 so_timestamping;
  1137. __s32 phc_index;
  1138. __u32 tx_types;
  1139. __u32 tx_reserved[3];
  1140. __u32 rx_filters;
  1141. __u32 rx_reserved[3];
  1142. };
  1143. /*
  1144. * %ETHTOOL_SFEATURES changes features present in features[].valid to the
  1145. * values of corresponding bits in features[].requested. Bits in .requested
  1146. * not set in .valid or not changeable are ignored.
  1147. *
  1148. * Returns %EINVAL when .valid contains undefined or never-changeable bits
  1149. * or size is not equal to required number of features words (32-bit blocks).
  1150. * Returns >= 0 if request was completed; bits set in the value mean:
  1151. * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
  1152. * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
  1153. * those bits were ignored.
  1154. * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
  1155. * resulting state of bits masked by .valid is not equal to .requested.
  1156. * Probably there are other device-specific constraints on some features
  1157. * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
  1158. * here as though ignored bits were cleared.
  1159. * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
  1160. * compatibility functions. Requested offload state cannot be properly
  1161. * managed by kernel.
  1162. *
  1163. * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
  1164. * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
  1165. * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
  1166. * significant bit in features[0] fields. Empty strings mark undefined features.
  1167. */
  1168. enum ethtool_sfeatures_retval_bits {
  1169. ETHTOOL_F_UNSUPPORTED__BIT,
  1170. ETHTOOL_F_WISH__BIT,
  1171. ETHTOOL_F_COMPAT__BIT,
  1172. };
  1173. #define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
  1174. #define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
  1175. #define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
  1176. #define MAX_NUM_QUEUE 4096
  1177. /**
  1178. * struct ethtool_per_queue_op - apply sub command to the queues in mask.
  1179. * @cmd: ETHTOOL_PERQUEUE
  1180. * @sub_command: the sub command which apply to each queues
  1181. * @queue_mask: Bitmap of the queues which sub command apply to
  1182. * @data: A complete command structure following for each of the queues addressed
  1183. */
  1184. struct ethtool_per_queue_op {
  1185. __u32 cmd;
  1186. __u32 sub_command;
  1187. __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
  1188. char data[];
  1189. };
  1190. /**
  1191. * struct ethtool_fecparam - Ethernet forward error correction(fec) parameters
  1192. * @cmd: Command number = %ETHTOOL_GFECPARAM or %ETHTOOL_SFECPARAM
  1193. * @active_fec: FEC mode which is active on porte
  1194. * @fec: Bitmask of supported/configured FEC modes
  1195. * @rsvd: Reserved for future extensions. i.e FEC bypass feature.
  1196. *
  1197. * Drivers should reject a non-zero setting of @autoneg when
  1198. * autoneogotiation is disabled (or not supported) for the link.
  1199. *
  1200. */
  1201. struct ethtool_fecparam {
  1202. __u32 cmd;
  1203. /* bitmask of FEC modes */
  1204. __u32 active_fec;
  1205. __u32 fec;
  1206. __u32 reserved;
  1207. };
  1208. /**
  1209. * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration
  1210. * @ETHTOOL_FEC_NONE: FEC mode configuration is not supported
  1211. * @ETHTOOL_FEC_AUTO: Default/Best FEC mode provided by driver
  1212. * @ETHTOOL_FEC_OFF: No FEC Mode
  1213. * @ETHTOOL_FEC_RS: Reed-Solomon Forward Error Detection mode
  1214. * @ETHTOOL_FEC_BASER: Base-R/Reed-Solomon Forward Error Detection mode
  1215. */
  1216. enum ethtool_fec_config_bits {
  1217. ETHTOOL_FEC_NONE_BIT,
  1218. ETHTOOL_FEC_AUTO_BIT,
  1219. ETHTOOL_FEC_OFF_BIT,
  1220. ETHTOOL_FEC_RS_BIT,
  1221. ETHTOOL_FEC_BASER_BIT,
  1222. };
  1223. #define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
  1224. #define ETHTOOL_FEC_AUTO (1 << ETHTOOL_FEC_AUTO_BIT)
  1225. #define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)
  1226. #define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)
  1227. #define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT)
  1228. /* CMDs currently supported */
  1229. #define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
  1230. * Please use ETHTOOL_GLINKSETTINGS
  1231. */
  1232. #define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
  1233. * Please use ETHTOOL_SLINKSETTINGS
  1234. */
  1235. #define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
  1236. #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
  1237. #define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
  1238. #define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
  1239. #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
  1240. #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
  1241. #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
  1242. /* Get link status for host, i.e. whether the interface *and* the
  1243. * physical port (if there is one) are up (ethtool_value). */
  1244. #define ETHTOOL_GLINK 0x0000000a
  1245. #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
  1246. #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
  1247. #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
  1248. #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
  1249. #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
  1250. #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
  1251. #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
  1252. #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
  1253. #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
  1254. #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
  1255. #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
  1256. #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
  1257. #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
  1258. * (ethtool_value) */
  1259. #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
  1260. * (ethtool_value). */
  1261. #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
  1262. #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
  1263. #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
  1264. #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
  1265. #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
  1266. #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
  1267. #define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
  1268. #define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
  1269. #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
  1270. #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
  1271. #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
  1272. #define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
  1273. #define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
  1274. #define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
  1275. #define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
  1276. #define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
  1277. #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
  1278. #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
  1279. #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
  1280. #define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
  1281. #define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
  1282. #define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
  1283. #define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
  1284. #define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
  1285. #define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
  1286. #define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
  1287. #define ETHTOOL_RESET 0x00000034 /* Reset hardware */
  1288. #define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
  1289. #define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
  1290. #define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
  1291. #define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
  1292. #define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
  1293. #define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
  1294. #define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
  1295. #define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
  1296. #define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
  1297. #define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
  1298. #define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
  1299. #define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
  1300. #define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
  1301. #define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
  1302. #define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
  1303. #define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
  1304. #define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
  1305. #define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
  1306. #define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
  1307. #define ETHTOOL_GTUNABLE 0x00000048 /* Get tunable configuration */
  1308. #define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
  1309. #define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */
  1310. #define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */
  1311. #define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
  1312. #define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
  1313. #define ETHTOOL_PHY_GTUNABLE 0x0000004e /* Get PHY tunable configuration */
  1314. #define ETHTOOL_PHY_STUNABLE 0x0000004f /* Set PHY tunable configuration */
  1315. #define ETHTOOL_GFECPARAM 0x00000050 /* Get FEC settings */
  1316. #define ETHTOOL_SFECPARAM 0x00000051 /* Set FEC settings */
  1317. /* compatibility with older code */
  1318. #define SPARC_ETH_GSET ETHTOOL_GSET
  1319. #define SPARC_ETH_SSET ETHTOOL_SSET
  1320. /* Link mode bit indices */
  1321. enum ethtool_link_mode_bit_indices {
  1322. ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
  1323. ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
  1324. ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
  1325. ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
  1326. ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
  1327. ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
  1328. ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
  1329. ETHTOOL_LINK_MODE_TP_BIT = 7,
  1330. ETHTOOL_LINK_MODE_AUI_BIT = 8,
  1331. ETHTOOL_LINK_MODE_MII_BIT = 9,
  1332. ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
  1333. ETHTOOL_LINK_MODE_BNC_BIT = 11,
  1334. ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
  1335. ETHTOOL_LINK_MODE_Pause_BIT = 13,
  1336. ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
  1337. ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
  1338. ETHTOOL_LINK_MODE_Backplane_BIT = 16,
  1339. ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
  1340. ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
  1341. ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
  1342. ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
  1343. ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
  1344. ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
  1345. ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
  1346. ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
  1347. ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
  1348. ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
  1349. ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
  1350. ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
  1351. ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
  1352. ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
  1353. ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31,
  1354. ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32,
  1355. ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33,
  1356. ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34,
  1357. ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35,
  1358. ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36,
  1359. ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37,
  1360. ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38,
  1361. ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39,
  1362. ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40,
  1363. ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41,
  1364. ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42,
  1365. ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43,
  1366. ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44,
  1367. ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45,
  1368. ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46,
  1369. ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47,
  1370. ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48,
  1371. ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49,
  1372. ETHTOOL_LINK_MODE_FEC_RS_BIT = 50,
  1373. ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51,
  1374. /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
  1375. * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
  1376. * macro for bits > 31. The only way to use indices > 31 is to
  1377. * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
  1378. */
  1379. __ETHTOOL_LINK_MODE_LAST
  1380. = ETHTOOL_LINK_MODE_FEC_BASER_BIT,
  1381. };
  1382. #define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
  1383. (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
  1384. /* DEPRECATED macros. Please migrate to
  1385. * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
  1386. * define any new SUPPORTED_* macro for bits > 31.
  1387. */
  1388. #define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
  1389. #define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
  1390. #define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
  1391. #define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
  1392. #define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
  1393. #define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
  1394. #define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
  1395. #define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
  1396. #define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
  1397. #define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
  1398. #define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
  1399. #define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
  1400. #define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
  1401. #define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
  1402. #define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
  1403. #define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
  1404. #define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
  1405. #define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
  1406. #define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
  1407. #define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
  1408. #define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
  1409. #define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
  1410. #define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
  1411. #define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
  1412. #define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
  1413. #define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
  1414. #define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
  1415. #define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
  1416. #define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
  1417. #define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
  1418. #define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
  1419. /* Please do not define any new SUPPORTED_* macro for bits > 31, see
  1420. * notice above.
  1421. */
  1422. /*
  1423. * DEPRECATED macros. Please migrate to
  1424. * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
  1425. * define any new ADERTISE_* macro for bits > 31.
  1426. */
  1427. #define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
  1428. #define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
  1429. #define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
  1430. #define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
  1431. #define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
  1432. #define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
  1433. #define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
  1434. #define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
  1435. #define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
  1436. #define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
  1437. #define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
  1438. #define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
  1439. #define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
  1440. #define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
  1441. #define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
  1442. #define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
  1443. #define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
  1444. #define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
  1445. #define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
  1446. #define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
  1447. #define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
  1448. #define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
  1449. #define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
  1450. #define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
  1451. #define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
  1452. #define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
  1453. #define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
  1454. #define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
  1455. #define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
  1456. #define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
  1457. #define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
  1458. /* Please do not define any new ADVERTISED_* macro for bits > 31, see
  1459. * notice above.
  1460. */
  1461. /* The following are all involved in forcing a particular link
  1462. * mode for the device for setting things. When getting the
  1463. * devices settings, these indicate the current mode and whether
  1464. * it was forced up into this mode or autonegotiated.
  1465. */
  1466. /* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal.
  1467. * Update drivers/net/phy/phy.c:phy_speed_to_str() and
  1468. * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values.
  1469. */
  1470. #define SPEED_10 10
  1471. #define SPEED_100 100
  1472. #define SPEED_1000 1000
  1473. #define SPEED_2500 2500
  1474. #define SPEED_5000 5000
  1475. #define SPEED_10000 10000
  1476. #define SPEED_14000 14000
  1477. #define SPEED_20000 20000
  1478. #define SPEED_25000 25000
  1479. #define SPEED_40000 40000
  1480. #define SPEED_50000 50000
  1481. #define SPEED_56000 56000
  1482. #define SPEED_100000 100000
  1483. #define SPEED_UNKNOWN -1
  1484. static inline int ethtool_validate_speed(__u32 speed)
  1485. {
  1486. return speed <= INT_MAX || speed == SPEED_UNKNOWN;
  1487. }
  1488. /* Duplex, half or full. */
  1489. #define DUPLEX_HALF 0x00
  1490. #define DUPLEX_FULL 0x01
  1491. #define DUPLEX_UNKNOWN 0xff
  1492. static inline int ethtool_validate_duplex(__u8 duplex)
  1493. {
  1494. switch (duplex) {
  1495. case DUPLEX_HALF:
  1496. case DUPLEX_FULL:
  1497. case DUPLEX_UNKNOWN:
  1498. return 1;
  1499. }
  1500. return 0;
  1501. }
  1502. /* Which connector port. */
  1503. #define PORT_TP 0x00
  1504. #define PORT_AUI 0x01
  1505. #define PORT_MII 0x02
  1506. #define PORT_FIBRE 0x03
  1507. #define PORT_BNC 0x04
  1508. #define PORT_DA 0x05
  1509. #define PORT_NONE 0xef
  1510. #define PORT_OTHER 0xff
  1511. /* Which transceiver to use. */
  1512. #define XCVR_INTERNAL 0x00 /* PHY and MAC are in the same package */
  1513. #define XCVR_EXTERNAL 0x01 /* PHY and MAC are in different packages */
  1514. #define XCVR_DUMMY1 0x02
  1515. #define XCVR_DUMMY2 0x03
  1516. #define XCVR_DUMMY3 0x04
  1517. /* Enable or disable autonegotiation. */
  1518. #define AUTONEG_DISABLE 0x00
  1519. #define AUTONEG_ENABLE 0x01
  1520. /* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
  1521. * the driver is required to renegotiate link
  1522. */
  1523. #define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
  1524. #define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
  1525. #define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
  1526. #define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
  1527. /* Wake-On-Lan options. */
  1528. #define WAKE_PHY (1 << 0)
  1529. #define WAKE_UCAST (1 << 1)
  1530. #define WAKE_MCAST (1 << 2)
  1531. #define WAKE_BCAST (1 << 3)
  1532. #define WAKE_ARP (1 << 4)
  1533. #define WAKE_MAGIC (1 << 5)
  1534. #define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
  1535. #define WAKE_FILTER (1 << 7)
  1536. /* L2-L4 network traffic flow types */
  1537. #define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
  1538. #define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
  1539. #define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
  1540. #define AH_ESP_V4_FLOW 0x04 /* hash only */
  1541. #define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */
  1542. #define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */
  1543. #define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */
  1544. #define AH_ESP_V6_FLOW 0x08 /* hash only */
  1545. #define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
  1546. #define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
  1547. #define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */
  1548. #define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */
  1549. #define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
  1550. #define IP_USER_FLOW IPV4_USER_FLOW
  1551. #define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */
  1552. #define IPV4_FLOW 0x10 /* hash only */
  1553. #define IPV6_FLOW 0x11 /* hash only */
  1554. #define ETHER_FLOW 0x12 /* spec only (ether_spec) */
  1555. /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
  1556. #define FLOW_EXT 0x80000000
  1557. #define FLOW_MAC_EXT 0x40000000
  1558. /* Flag to enable RSS spreading of traffic matching rule (nfc only) */
  1559. #define FLOW_RSS 0x20000000
  1560. /* L3-L4 network traffic flow hash options */
  1561. #define RXH_L2DA (1 << 1)
  1562. #define RXH_VLAN (1 << 2)
  1563. #define RXH_L3_PROTO (1 << 3)
  1564. #define RXH_IP_SRC (1 << 4)
  1565. #define RXH_IP_DST (1 << 5)
  1566. #define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
  1567. #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
  1568. #define RXH_DISCARD (1 << 31)
  1569. #define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
  1570. #define RX_CLS_FLOW_WAKE 0xfffffffffffffffeULL
  1571. /* Special RX classification rule insert location values */
  1572. #define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
  1573. #define RX_CLS_LOC_ANY 0xffffffff
  1574. #define RX_CLS_LOC_FIRST 0xfffffffe
  1575. #define RX_CLS_LOC_LAST 0xfffffffd
  1576. /* EEPROM Standards for plug in modules */
  1577. #define ETH_MODULE_SFF_8079 0x1
  1578. #define ETH_MODULE_SFF_8079_LEN 256
  1579. #define ETH_MODULE_SFF_8472 0x2
  1580. #define ETH_MODULE_SFF_8472_LEN 512
  1581. #define ETH_MODULE_SFF_8636 0x3
  1582. #define ETH_MODULE_SFF_8636_LEN 256
  1583. #define ETH_MODULE_SFF_8436 0x4
  1584. #define ETH_MODULE_SFF_8436_LEN 256
  1585. /* Reset flags */
  1586. /* The reset() operation must clear the flags for the components which
  1587. * were actually reset. On successful return, the flags indicate the
  1588. * components which were not reset, either because they do not exist
  1589. * in the hardware or because they cannot be reset independently. The
  1590. * driver must never reset any components that were not requested.
  1591. */
  1592. enum ethtool_reset_flags {
  1593. /* These flags represent components dedicated to the interface
  1594. * the command is addressed to. Shift any flag left by
  1595. * ETH_RESET_SHARED_SHIFT to reset a shared component of the
  1596. * same type.
  1597. */
  1598. ETH_RESET_MGMT = 1 << 0, /* Management processor */
  1599. ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
  1600. ETH_RESET_DMA = 1 << 2, /* DMA engine */
  1601. ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
  1602. ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
  1603. ETH_RESET_MAC = 1 << 5, /* Media access controller */
  1604. ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
  1605. ETH_RESET_RAM = 1 << 7, /* RAM shared between
  1606. * multiple components */
  1607. ETH_RESET_AP = 1 << 8, /* Application processor */
  1608. ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
  1609. * this interface */
  1610. ETH_RESET_ALL = 0xffffffff, /* All components used by this
  1611. * interface, even if shared */
  1612. };
  1613. #define ETH_RESET_SHARED_SHIFT 16
  1614. /**
  1615. * struct ethtool_link_settings - link control and status
  1616. *
  1617. * IMPORTANT, Backward compatibility notice: When implementing new
  1618. * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
  1619. * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
  1620. * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
  1621. * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
  1622. * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
  1623. * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
  1624. * settings; do not use %ETHTOOL_SLINKSETTINGS if
  1625. * %ETHTOOL_GLINKSETTINGS failed: stick to
  1626. * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
  1627. *
  1628. * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
  1629. * @speed: Link speed (Mbps)
  1630. * @duplex: Duplex mode; one of %DUPLEX_*
  1631. * @port: Physical connector type; one of %PORT_*
  1632. * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
  1633. * applicable. For clause 45 PHYs this is the PRTAD.
  1634. * @autoneg: Enable/disable autonegotiation and auto-detection;
  1635. * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
  1636. * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
  1637. * protocols supported by the interface; 0 if unknown.
  1638. * Read-only.
  1639. * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
  1640. * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
  1641. * value will be %ETH_TP_MDI_INVALID. Read-only.
  1642. * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
  1643. * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
  1644. * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
  1645. * When written successfully, the link should be renegotiated if
  1646. * necessary.
  1647. * @link_mode_masks_nwords: Number of 32-bit words for each of the
  1648. * supported, advertising, lp_advertising link mode bitmaps. For
  1649. * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
  1650. * (>= 0); on return, if handshake in progress, negative if
  1651. * request size unsupported by kernel: absolute value indicates
  1652. * kernel expected size and all the other fields but cmd
  1653. * are 0; otherwise (handshake completed), strictly positive
  1654. * to indicate size used by kernel and cmd field stays
  1655. * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
  1656. * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
  1657. * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
  1658. * refused. For drivers: ignore this field (use kernel's
  1659. * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
  1660. * be overwritten by kernel.
  1661. * @supported: Bitmap with each bit meaning given by
  1662. * %ethtool_link_mode_bit_indices for the link modes, physical
  1663. * connectors and other link features for which the interface
  1664. * supports autonegotiation or auto-detection. Read-only.
  1665. * @advertising: Bitmap with each bit meaning given by
  1666. * %ethtool_link_mode_bit_indices for the link modes, physical
  1667. * connectors and other link features that are advertised through
  1668. * autonegotiation or enabled for auto-detection.
  1669. * @lp_advertising: Bitmap with each bit meaning given by
  1670. * %ethtool_link_mode_bit_indices for the link modes, and other
  1671. * link features that the link partner advertised through
  1672. * autonegotiation; 0 if unknown or not applicable. Read-only.
  1673. * @transceiver: Used to distinguish different possible PHY types,
  1674. * reported consistently by PHYLIB. Read-only.
  1675. *
  1676. * If autonegotiation is disabled, the speed and @duplex represent the
  1677. * fixed link mode and are writable if the driver supports multiple
  1678. * link modes. If it is enabled then they are read-only; if the link
  1679. * is up they represent the negotiated link mode; if the link is down,
  1680. * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
  1681. * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
  1682. *
  1683. * Some hardware interfaces may have multiple PHYs and/or physical
  1684. * connectors fitted or do not allow the driver to detect which are
  1685. * fitted. For these interfaces @port and/or @phy_address may be
  1686. * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
  1687. * Otherwise, attempts to write different values may be ignored or
  1688. * rejected.
  1689. *
  1690. * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
  1691. * are not available in %ethtool_link_settings. Until all drivers are
  1692. * converted to ignore them or to the new %ethtool_link_settings API,
  1693. * for both queries and changes, users should always try
  1694. * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
  1695. * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
  1696. * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
  1697. * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
  1698. * either %ethtool_cmd or %ethtool_link_settings).
  1699. *
  1700. * Users should assume that all fields not marked read-only are
  1701. * writable and subject to validation by the driver. They should use
  1702. * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
  1703. * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
  1704. *
  1705. * Drivers that implement %get_link_ksettings and/or
  1706. * %set_link_ksettings should ignore the @cmd
  1707. * and @link_mode_masks_nwords fields (any change to them overwritten
  1708. * by kernel), and rely only on kernel's internal
  1709. * %__ETHTOOL_LINK_MODE_MASK_NBITS and
  1710. * %ethtool_link_mode_mask_t. Drivers that implement
  1711. * %set_link_ksettings() should validate all fields other than @cmd
  1712. * and @link_mode_masks_nwords that are not described as read-only or
  1713. * deprecated, and must ignore all fields described as read-only.
  1714. */
  1715. struct ethtool_link_settings {
  1716. __u32 cmd;
  1717. __u32 speed;
  1718. __u8 duplex;
  1719. __u8 port;
  1720. __u8 phy_address;
  1721. __u8 autoneg;
  1722. __u8 mdio_support;
  1723. __u8 eth_tp_mdix;
  1724. __u8 eth_tp_mdix_ctrl;
  1725. __s8 link_mode_masks_nwords;
  1726. __u8 transceiver;
  1727. __u8 reserved1[3];
  1728. __u32 reserved[7];
  1729. __u32 link_mode_masks[0];
  1730. /* layout of link_mode_masks fields:
  1731. * __u32 map_supported[link_mode_masks_nwords];
  1732. * __u32 map_advertising[link_mode_masks_nwords];
  1733. * __u32 map_lp_advertising[link_mode_masks_nwords];
  1734. */
  1735. };
  1736. #endif /* _UAPI_LINUX_ETHTOOL_H */