aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorDavid Decotigny <decot@googlers.com>2016-02-24 13:57:59 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-25 22:06:45 -0500
commit3f1ac7a700d039c61d8d8b99f28d605d489a60cf (patch)
tree29c4c9832e87bce2f685a097b00029f64d93f88c /include/uapi
parent48133335d7e0a661f40a5899d20945dabb600f0a (diff)
net: ethtool: add new ETHTOOL_xLINKSETTINGS API
This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API, handled by the new get_link_ksettings/set_link_ksettings callbacks. This API provides support for most legacy ethtool_cmd fields, adds support for larger link mode masks (up to 4064 bits, variable length), and removes ethtool_cmd deprecated fields (transceiver/maxrxpkt/maxtxpkt). This API is deprecating the legacy ETHTOOL_GSET/SSET API and provides the following backward compatibility properties: - legacy ethtool with legacy drivers: no change, still using the get_settings/set_settings callbacks. - legacy ethtool with new get/set_link_ksettings drivers: the new driver callbacks are used, data internally converted to legacy ethtool_cmd. ETHTOOL_GSET will return only the 1st 32b of each link mode mask. ETHTOOL_SSET will fail if user tries to set the ethtool_cmd deprecated fields to non-0 (transceiver/maxrxpkt/maxtxpkt). A kernel warning is logged if driver sets higher bits. - future ethtool with legacy drivers: no change, still using the get_settings/set_settings callbacks, internally converted to new data structure. Deprecated fields (transceiver/maxrxpkt/maxtxpkt) will be ignored and seen as 0 from user space. Note that that "future" ethtool tool will not allow changes to these deprecated fields. - future ethtool with new drivers: direct call to the new callbacks. By "future" ethtool, what is meant is: - query: first try ETHTOOL_GLINKSETTINGS, and revert to ETHTOOL_GSET if fails - set: query first and remember which of ETHTOOL_GLINKSETTINGS or ETHTOOL_GSET was successful + if ETHTOOL_GLINKSETTINGS was successful, then change config with ETHTOOL_SLINKSETTINGS. A failure there is final (do not try ETHTOOL_SSET). + otherwise ETHTOOL_GSET was successful, change config with ETHTOOL_SSET. A failure there is final (do not try ETHTOOL_SLINKSETTINGS). The interaction user/kernel via the new API requires a small ETHTOOL_GLINKSETTINGS handshake first to agree on the length of the link mode bitmaps. If kernel doesn't agree with user, it returns the bitmap length it is expecting from user as a negative length (and cmd field is 0). When kernel and user agree, kernel returns valid info in all fields (ie. link mode length > 0 and cmd is ETHTOOL_GLINKSETTINGS). Data structure crossing user/kernel boundary is 32/64-bit agnostic. Converted internally to a legal kernel bitmap. The internal __ethtool_get_settings kernel helper will gradually be replaced by __ethtool_get_link_ksettings by the time the first "link_settings" drivers start to appear. So this patch doesn't change it, it will be removed before it needs to be changed. Signed-off-by: David Decotigny <decot@googlers.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/ethtool.h322
1 files changed, 256 insertions, 66 deletions
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index f15ae02621a1..37fd6dc33de4 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -21,7 +21,8 @@
21 */ 21 */
22 22
23/** 23/**
24 * struct ethtool_cmd - link control and status 24 * struct ethtool_cmd - DEPRECATED, link control and status
25 * This structure is DEPRECATED, please use struct ethtool_link_settings.
25 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET 26 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
26 * @supported: Bitmask of %SUPPORTED_* flags for the link modes, 27 * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
27 * physical connectors and other link features for which the 28 * physical connectors and other link features for which the
@@ -1219,8 +1220,12 @@ struct ethtool_per_queue_op {
1219}; 1220};
1220 1221
1221/* CMDs currently supported */ 1222/* CMDs currently supported */
1222#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 1223#define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
1223#define ETHTOOL_SSET 0x00000002 /* Set settings. */ 1224 * Please use ETHTOOL_GLINKSETTINGS
1225 */
1226#define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
1227 * Please use ETHTOOL_SLINKSETTINGS
1228 */
1224#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1229#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
1225#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1230#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
1226#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1231#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
@@ -1302,73 +1307,139 @@ struct ethtool_per_queue_op {
1302 1307
1303#define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */ 1308#define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */
1304 1309
1310#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
1311#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
1312
1313
1305/* compatibility with older code */ 1314/* compatibility with older code */
1306#define SPARC_ETH_GSET ETHTOOL_GSET 1315#define SPARC_ETH_GSET ETHTOOL_GSET
1307#define SPARC_ETH_SSET ETHTOOL_SSET 1316#define SPARC_ETH_SSET ETHTOOL_SSET
1308 1317
1309#define SUPPORTED_10baseT_Half (1 << 0) 1318/* Link mode bit indices */
1310#define SUPPORTED_10baseT_Full (1 << 1) 1319enum ethtool_link_mode_bit_indices {
1311#define SUPPORTED_100baseT_Half (1 << 2) 1320 ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
1312#define SUPPORTED_100baseT_Full (1 << 3) 1321 ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
1313#define SUPPORTED_1000baseT_Half (1 << 4) 1322 ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
1314#define SUPPORTED_1000baseT_Full (1 << 5) 1323 ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
1315#define SUPPORTED_Autoneg (1 << 6) 1324 ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
1316#define SUPPORTED_TP (1 << 7) 1325 ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
1317#define SUPPORTED_AUI (1 << 8) 1326 ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
1318#define SUPPORTED_MII (1 << 9) 1327 ETHTOOL_LINK_MODE_TP_BIT = 7,
1319#define SUPPORTED_FIBRE (1 << 10) 1328 ETHTOOL_LINK_MODE_AUI_BIT = 8,
1320#define SUPPORTED_BNC (1 << 11) 1329 ETHTOOL_LINK_MODE_MII_BIT = 9,
1321#define SUPPORTED_10000baseT_Full (1 << 12) 1330 ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
1322#define SUPPORTED_Pause (1 << 13) 1331 ETHTOOL_LINK_MODE_BNC_BIT = 11,
1323#define SUPPORTED_Asym_Pause (1 << 14) 1332 ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
1324#define SUPPORTED_2500baseX_Full (1 << 15) 1333 ETHTOOL_LINK_MODE_Pause_BIT = 13,
1325#define SUPPORTED_Backplane (1 << 16) 1334 ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
1326#define SUPPORTED_1000baseKX_Full (1 << 17) 1335 ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
1327#define SUPPORTED_10000baseKX4_Full (1 << 18) 1336 ETHTOOL_LINK_MODE_Backplane_BIT = 16,
1328#define SUPPORTED_10000baseKR_Full (1 << 19) 1337 ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
1329#define SUPPORTED_10000baseR_FEC (1 << 20) 1338 ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
1330#define SUPPORTED_20000baseMLD2_Full (1 << 21) 1339 ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
1331#define SUPPORTED_20000baseKR2_Full (1 << 22) 1340 ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
1332#define SUPPORTED_40000baseKR4_Full (1 << 23) 1341 ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
1333#define SUPPORTED_40000baseCR4_Full (1 << 24) 1342 ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
1334#define SUPPORTED_40000baseSR4_Full (1 << 25) 1343 ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
1335#define SUPPORTED_40000baseLR4_Full (1 << 26) 1344 ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
1336#define SUPPORTED_56000baseKR4_Full (1 << 27) 1345 ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
1337#define SUPPORTED_56000baseCR4_Full (1 << 28) 1346 ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
1338#define SUPPORTED_56000baseSR4_Full (1 << 29) 1347 ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
1339#define SUPPORTED_56000baseLR4_Full (1 << 30) 1348 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
1340 1349 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
1341#define ADVERTISED_10baseT_Half (1 << 0) 1350 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
1342#define ADVERTISED_10baseT_Full (1 << 1) 1351
1343#define ADVERTISED_100baseT_Half (1 << 2) 1352 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1344#define ADVERTISED_100baseT_Full (1 << 3) 1353 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
1345#define ADVERTISED_1000baseT_Half (1 << 4) 1354 * macro for bits > 31. The only way to use indices > 31 is to
1346#define ADVERTISED_1000baseT_Full (1 << 5) 1355 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
1347#define ADVERTISED_Autoneg (1 << 6) 1356 */
1348#define ADVERTISED_TP (1 << 7) 1357
1349#define ADVERTISED_AUI (1 << 8) 1358 __ETHTOOL_LINK_MODE_LAST
1350#define ADVERTISED_MII (1 << 9) 1359 = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT,
1351#define ADVERTISED_FIBRE (1 << 10) 1360};
1352#define ADVERTISED_BNC (1 << 11) 1361
1353#define ADVERTISED_10000baseT_Full (1 << 12) 1362#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
1354#define ADVERTISED_Pause (1 << 13) 1363 (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
1355#define ADVERTISED_Asym_Pause (1 << 14) 1364
1356#define ADVERTISED_2500baseX_Full (1 << 15) 1365/* DEPRECATED macros. Please migrate to
1357#define ADVERTISED_Backplane (1 << 16) 1366 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1358#define ADVERTISED_1000baseKX_Full (1 << 17) 1367 * define any new SUPPORTED_* macro for bits > 31.
1359#define ADVERTISED_10000baseKX4_Full (1 << 18) 1368 */
1360#define ADVERTISED_10000baseKR_Full (1 << 19) 1369#define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1361#define ADVERTISED_10000baseR_FEC (1 << 20) 1370#define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1362#define ADVERTISED_20000baseMLD2_Full (1 << 21) 1371#define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1363#define ADVERTISED_20000baseKR2_Full (1 << 22) 1372#define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1364#define ADVERTISED_40000baseKR4_Full (1 << 23) 1373#define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1365#define ADVERTISED_40000baseCR4_Full (1 << 24) 1374#define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1366#define ADVERTISED_40000baseSR4_Full (1 << 25) 1375#define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1367#define ADVERTISED_40000baseLR4_Full (1 << 26) 1376#define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1368#define ADVERTISED_56000baseKR4_Full (1 << 27) 1377#define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1369#define ADVERTISED_56000baseCR4_Full (1 << 28) 1378#define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1370#define ADVERTISED_56000baseSR4_Full (1 << 29) 1379#define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1371#define ADVERTISED_56000baseLR4_Full (1 << 30) 1380#define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1381#define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1382#define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1383#define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1384#define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1385#define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1386#define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1387#define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1388#define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1389#define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1390#define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1391#define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1392#define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1393#define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1394#define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1395#define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1396#define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1397#define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1398#define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1399#define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1400/* Please do not define any new SUPPORTED_* macro for bits > 31, see
1401 * notice above.
1402 */
1403
1404/*
1405 * DEPRECATED macros. Please migrate to
1406 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1407 * define any new ADERTISE_* macro for bits > 31.
1408 */
1409#define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1410#define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1411#define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1412#define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1413#define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1414#define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1415#define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1416#define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1417#define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1418#define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1419#define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1420#define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1421#define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1422#define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1423#define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1424#define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1425#define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1426#define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1427#define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1428#define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1429#define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1430#define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1431#define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1432#define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1433#define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1434#define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1435#define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1436#define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1437#define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1438#define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1439#define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1440/* Please do not define any new ADVERTISED_* macro for bits > 31, see
1441 * notice above.
1442 */
1372 1443
1373/* The following are all involved in forcing a particular link 1444/* The following are all involved in forcing a particular link
1374 * mode for the device for setting things. When getting the 1445 * mode for the device for setting things. When getting the
@@ -1533,4 +1604,123 @@ enum ethtool_reset_flags {
1533}; 1604};
1534#define ETH_RESET_SHARED_SHIFT 16 1605#define ETH_RESET_SHARED_SHIFT 16
1535 1606
1607
1608/**
1609 * struct ethtool_link_settings - link control and status
1610 *
1611 * IMPORTANT, Backward compatibility notice: When implementing new
1612 * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
1613 * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
1614 * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
1615 * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
1616 * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
1617 * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
1618 * settings; do not use %ETHTOOL_SLINKSETTINGS if
1619 * %ETHTOOL_GLINKSETTINGS failed: stick to
1620 * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
1621 *
1622 * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
1623 * @speed: Link speed (Mbps)
1624 * @duplex: Duplex mode; one of %DUPLEX_*
1625 * @port: Physical connector type; one of %PORT_*
1626 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
1627 * applicable. For clause 45 PHYs this is the PRTAD.
1628 * @autoneg: Enable/disable autonegotiation and auto-detection;
1629 * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
1630 * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
1631 * protocols supported by the interface; 0 if unknown.
1632 * Read-only.
1633 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
1634 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
1635 * value will be %ETH_TP_MDI_INVALID. Read-only.
1636 * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
1637 * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
1638 * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
1639 * When written successfully, the link should be renegotiated if
1640 * necessary.
1641 * @link_mode_masks_nwords: Number of 32-bit words for each of the
1642 * supported, advertising, lp_advertising link mode bitmaps. For
1643 * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
1644 * (>= 0); on return, if handshake in progress, negative if
1645 * request size unsupported by kernel: absolute value indicates
1646 * kernel recommended size and cmd field is 0, as well as all the
1647 * other fields; otherwise (handshake completed), strictly
1648 * positive to indicate size used by kernel and cmd field is
1649 * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
1650 * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
1651 * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
1652 * refused. For drivers: ignore this field (use kernel's
1653 * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
1654 * be overwritten by kernel.
1655 * @supported: Bitmap with each bit meaning given by
1656 * %ethtool_link_mode_bit_indices for the link modes, physical
1657 * connectors and other link features for which the interface
1658 * supports autonegotiation or auto-detection. Read-only.
1659 * @advertising: Bitmap with each bit meaning given by
1660 * %ethtool_link_mode_bit_indices for the link modes, physical
1661 * connectors and other link features that are advertised through
1662 * autonegotiation or enabled for auto-detection.
1663 * @lp_advertising: Bitmap with each bit meaning given by
1664 * %ethtool_link_mode_bit_indices for the link modes, and other
1665 * link features that the link partner advertised through
1666 * autonegotiation; 0 if unknown or not applicable. Read-only.
1667 *
1668 * If autonegotiation is disabled, the speed and @duplex represent the
1669 * fixed link mode and are writable if the driver supports multiple
1670 * link modes. If it is enabled then they are read-only; if the link
1671 * is up they represent the negotiated link mode; if the link is down,
1672 * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
1673 * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
1674 *
1675 * Some hardware interfaces may have multiple PHYs and/or physical
1676 * connectors fitted or do not allow the driver to detect which are
1677 * fitted. For these interfaces @port and/or @phy_address may be
1678 * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
1679 * Otherwise, attempts to write different values may be ignored or
1680 * rejected.
1681 *
1682 * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
1683 * are not available in %ethtool_link_settings. Until all drivers are
1684 * converted to ignore them or to the new %ethtool_link_settings API,
1685 * for both queries and changes, users should always try
1686 * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
1687 * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
1688 * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
1689 * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
1690 * either %ethtool_cmd or %ethtool_link_settings).
1691 *
1692 * Users should assume that all fields not marked read-only are
1693 * writable and subject to validation by the driver. They should use
1694 * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
1695 * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
1696 *
1697 * Drivers that implement %get_link_ksettings and/or
1698 * %set_link_ksettings should ignore the @cmd
1699 * and @link_mode_masks_nwords fields (any change to them overwritten
1700 * by kernel), and rely only on kernel's internal
1701 * %__ETHTOOL_LINK_MODE_MASK_NBITS and
1702 * %ethtool_link_mode_mask_t. Drivers that implement
1703 * %set_link_ksettings() should validate all fields other than @cmd
1704 * and @link_mode_masks_nwords that are not described as read-only or
1705 * deprecated, and must ignore all fields described as read-only.
1706 */
1707struct ethtool_link_settings {
1708 __u32 cmd;
1709 __u32 speed;
1710 __u8 duplex;
1711 __u8 port;
1712 __u8 phy_address;
1713 __u8 autoneg;
1714 __u8 mdio_support;
1715 __u8 eth_tp_mdix;
1716 __u8 eth_tp_mdix_ctrl;
1717 __s8 link_mode_masks_nwords;
1718 __u32 reserved[8];
1719 __u32 link_mode_masks[0];
1720 /* layout of link_mode_masks fields:
1721 * __u32 map_supported[link_mode_masks_nwords];
1722 * __u32 map_advertising[link_mode_masks_nwords];
1723 * __u32 map_lp_advertising[link_mode_masks_nwords];
1724 */
1725};
1536#endif /* _UAPI_LINUX_ETHTOOL_H */ 1726#endif /* _UAPI_LINUX_ETHTOOL_H */