ethtool.h 68 KB

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