ethtool.h 67 KB

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