aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/ethtool.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-19 13:05:34 -0400
commit1200b6809dfd9d73bc4c7db76d288c35fa4b2ebe (patch)
tree552e03de245cdbd0780ca1215914edc4a26540f7 /include/uapi/linux/ethtool.h
parent6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f (diff)
parentfe30937b65354c7fec244caebbdaae68e28ca797 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights: 1) Support more Realtek wireless chips, from Jes Sorenson. 2) New BPF types for per-cpu hash and arrap maps, from Alexei Starovoitov. 3) Make several TCP sysctls per-namespace, from Nikolay Borisov. 4) Allow the use of SO_REUSEPORT in order to do per-thread processing of incoming TCP/UDP connections. The muxing can be done using a BPF program which hashes the incoming packet. From Craig Gallek. 5) Add a multiplexer for TCP streams, to provide a messaged based interface. BPF programs can be used to determine the message boundaries. From Tom Herbert. 6) Add 802.1AE MACSEC support, from Sabrina Dubroca. 7) Avoid factorial complexity when taking down an inetdev interface with lots of configured addresses. We were doing things like traversing the entire address less for each address removed, and flushing the entire netfilter conntrack table for every address as well. 8) Add and use SKB bulk free infrastructure, from Jesper Brouer. 9) Allow offloading u32 classifiers to hardware, and implement for ixgbe, from John Fastabend. 10) Allow configuring IRQ coalescing parameters on a per-queue basis, from Kan Liang. 11) Extend ethtool so that larger link mode masks can be supported. From David Decotigny. 12) Introduce devlink, which can be used to configure port link types (ethernet vs Infiniband, etc.), port splitting, and switch device level attributes as a whole. From Jiri Pirko. 13) Hardware offload support for flower classifiers, from Amir Vadai. 14) Add "Local Checksum Offload". Basically, for a tunneled packet the checksum of the outer header is 'constant' (because with the checksum field filled into the inner protocol header, the payload of the outer frame checksums to 'zero'), and we can take advantage of that in various ways. From Edward Cree" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits) bonding: fix bond_get_stats() net: bcmgenet: fix dma api length mismatch net/mlx4_core: Fix backward compatibility on VFs phy: mdio-thunder: Fix some Kconfig typos lan78xx: add ndo_get_stats64 lan78xx: handle statistics counter rollover RDS: TCP: Remove unused constant RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket net: smc911x: convert pxa dma to dmaengine team: remove duplicate set of flag IFF_MULTICAST bonding: remove duplicate set of flag IFF_MULTICAST net: fix a comment typo ethernet: micrel: fix some error codes ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it bpf, dst: add and use dst_tclassid helper bpf: make skb->tc_classid also readable net: mvneta: bm: clarify dependencies cls_bpf: reset class and reuse major in da ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c ldmvsw: Add ldmvsw.c driver code ...
Diffstat (limited to 'include/uapi/linux/ethtool.h')
-rw-r--r--include/uapi/linux/ethtool.h437
1 files changed, 362 insertions, 75 deletions
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 57fa39005e79..2835b07416b7 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -13,15 +13,21 @@
13#ifndef _UAPI_LINUX_ETHTOOL_H 13#ifndef _UAPI_LINUX_ETHTOOL_H
14#define _UAPI_LINUX_ETHTOOL_H 14#define _UAPI_LINUX_ETHTOOL_H
15 15
16#include <linux/kernel.h>
16#include <linux/types.h> 17#include <linux/types.h>
17#include <linux/if_ether.h> 18#include <linux/if_ether.h>
18 19
20#ifndef __KERNEL__
21#include <limits.h> /* for INT_MAX */
22#endif
23
19/* All structures exposed to userland should be defined such that they 24/* All structures exposed to userland should be defined such that they
20 * have the same layout for 32-bit and 64-bit userland. 25 * have the same layout for 32-bit and 64-bit userland.
21 */ 26 */
22 27
23/** 28/**
24 * struct ethtool_cmd - link control and status 29 * struct ethtool_cmd - DEPRECATED, link control and status
30 * This structure is DEPRECATED, please use struct ethtool_link_settings.
25 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET 31 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
26 * @supported: Bitmask of %SUPPORTED_* flags for the link modes, 32 * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
27 * physical connectors and other link features for which the 33 * physical connectors and other link features for which the
@@ -31,7 +37,7 @@
31 * physical connectors and other link features that are 37 * physical connectors and other link features that are
32 * advertised through autonegotiation or enabled for 38 * advertised through autonegotiation or enabled for
33 * auto-detection. 39 * auto-detection.
34 * @speed: Low bits of the speed 40 * @speed: Low bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
35 * @duplex: Duplex mode; one of %DUPLEX_* 41 * @duplex: Duplex mode; one of %DUPLEX_*
36 * @port: Physical connector type; one of %PORT_* 42 * @port: Physical connector type; one of %PORT_*
37 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not 43 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
@@ -47,7 +53,7 @@
47 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 53 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
48 * @maxrxpkt: Historically used to report RX IRQ coalescing; now 54 * @maxrxpkt: Historically used to report RX IRQ coalescing; now
49 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated. 55 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
50 * @speed_hi: High bits of the speed 56 * @speed_hi: High bits of the speed, 1Mb units, 0 to INT_MAX or SPEED_UNKNOWN
51 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of 57 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
52 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the 58 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
53 * value will be %ETH_TP_MDI_INVALID. Read-only. 59 * value will be %ETH_TP_MDI_INVALID. Read-only.
@@ -748,6 +754,56 @@ struct ethtool_usrip4_spec {
748 __u8 proto; 754 __u8 proto;
749}; 755};
750 756
757/**
758 * struct ethtool_tcpip6_spec - flow specification for TCP/IPv6 etc.
759 * @ip6src: Source host
760 * @ip6dst: Destination host
761 * @psrc: Source port
762 * @pdst: Destination port
763 * @tclass: Traffic Class
764 *
765 * This can be used to specify a TCP/IPv6, UDP/IPv6 or SCTP/IPv6 flow.
766 */
767struct ethtool_tcpip6_spec {
768 __be32 ip6src[4];
769 __be32 ip6dst[4];
770 __be16 psrc;
771 __be16 pdst;
772 __u8 tclass;
773};
774
775/**
776 * struct ethtool_ah_espip6_spec - flow specification for IPsec/IPv6
777 * @ip6src: Source host
778 * @ip6dst: Destination host
779 * @spi: Security parameters index
780 * @tclass: Traffic Class
781 *
782 * This can be used to specify an IPsec transport or tunnel over IPv6.
783 */
784struct ethtool_ah_espip6_spec {
785 __be32 ip6src[4];
786 __be32 ip6dst[4];
787 __be32 spi;
788 __u8 tclass;
789};
790
791/**
792 * struct ethtool_usrip6_spec - general flow specification for IPv6
793 * @ip6src: Source host
794 * @ip6dst: Destination host
795 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
796 * @tclass: Traffic Class
797 * @l4_proto: Transport protocol number (nexthdr after any Extension Headers)
798 */
799struct ethtool_usrip6_spec {
800 __be32 ip6src[4];
801 __be32 ip6dst[4];
802 __be32 l4_4_bytes;
803 __u8 tclass;
804 __u8 l4_proto;
805};
806
751union ethtool_flow_union { 807union ethtool_flow_union {
752 struct ethtool_tcpip4_spec tcp_ip4_spec; 808 struct ethtool_tcpip4_spec tcp_ip4_spec;
753 struct ethtool_tcpip4_spec udp_ip4_spec; 809 struct ethtool_tcpip4_spec udp_ip4_spec;
@@ -755,6 +811,12 @@ union ethtool_flow_union {
755 struct ethtool_ah_espip4_spec ah_ip4_spec; 811 struct ethtool_ah_espip4_spec ah_ip4_spec;
756 struct ethtool_ah_espip4_spec esp_ip4_spec; 812 struct ethtool_ah_espip4_spec esp_ip4_spec;
757 struct ethtool_usrip4_spec usr_ip4_spec; 813 struct ethtool_usrip4_spec usr_ip4_spec;
814 struct ethtool_tcpip6_spec tcp_ip6_spec;
815 struct ethtool_tcpip6_spec udp_ip6_spec;
816 struct ethtool_tcpip6_spec sctp_ip6_spec;
817 struct ethtool_ah_espip6_spec ah_ip6_spec;
818 struct ethtool_ah_espip6_spec esp_ip6_spec;
819 struct ethtool_usrip6_spec usr_ip6_spec;
758 struct ethhdr ether_spec; 820 struct ethhdr ether_spec;
759 __u8 hdata[52]; 821 __u8 hdata[52];
760}; 822};
@@ -1146,10 +1208,29 @@ enum ethtool_sfeatures_retval_bits {
1146#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT) 1208#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
1147#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT) 1209#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
1148 1210
1211#define MAX_NUM_QUEUE 4096
1212
1213/**
1214 * struct ethtool_per_queue_op - apply sub command to the queues in mask.
1215 * @cmd: ETHTOOL_PERQUEUE
1216 * @sub_command: the sub command which apply to each queues
1217 * @queue_mask: Bitmap of the queues which sub command apply to
1218 * @data: A complete command structure following for each of the queues addressed
1219 */
1220struct ethtool_per_queue_op {
1221 __u32 cmd;
1222 __u32 sub_command;
1223 __u32 queue_mask[__KERNEL_DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
1224 char data[];
1225};
1149 1226
1150/* CMDs currently supported */ 1227/* CMDs currently supported */
1151#define ETHTOOL_GSET 0x00000001 /* Get settings. */ 1228#define ETHTOOL_GSET 0x00000001 /* DEPRECATED, Get settings.
1152#define ETHTOOL_SSET 0x00000002 /* Set settings. */ 1229 * Please use ETHTOOL_GLINKSETTINGS
1230 */
1231#define ETHTOOL_SSET 0x00000002 /* DEPRECATED, Set settings.
1232 * Please use ETHTOOL_SLINKSETTINGS
1233 */
1153#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */ 1234#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
1154#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */ 1235#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
1155#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */ 1236#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
@@ -1229,73 +1310,141 @@ enum ethtool_sfeatures_retval_bits {
1229#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */ 1310#define ETHTOOL_STUNABLE 0x00000049 /* Set tunable configuration */
1230#define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */ 1311#define ETHTOOL_GPHYSTATS 0x0000004a /* get PHY-specific statistics */
1231 1312
1313#define ETHTOOL_PERQUEUE 0x0000004b /* Set per queue options */
1314
1315#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
1316#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
1317
1318
1232/* compatibility with older code */ 1319/* compatibility with older code */
1233#define SPARC_ETH_GSET ETHTOOL_GSET 1320#define SPARC_ETH_GSET ETHTOOL_GSET
1234#define SPARC_ETH_SSET ETHTOOL_SSET 1321#define SPARC_ETH_SSET ETHTOOL_SSET
1235 1322
1236#define SUPPORTED_10baseT_Half (1 << 0) 1323/* Link mode bit indices */
1237#define SUPPORTED_10baseT_Full (1 << 1) 1324enum ethtool_link_mode_bit_indices {
1238#define SUPPORTED_100baseT_Half (1 << 2) 1325 ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0,
1239#define SUPPORTED_100baseT_Full (1 << 3) 1326 ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1,
1240#define SUPPORTED_1000baseT_Half (1 << 4) 1327 ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2,
1241#define SUPPORTED_1000baseT_Full (1 << 5) 1328 ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3,
1242#define SUPPORTED_Autoneg (1 << 6) 1329 ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4,
1243#define SUPPORTED_TP (1 << 7) 1330 ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5,
1244#define SUPPORTED_AUI (1 << 8) 1331 ETHTOOL_LINK_MODE_Autoneg_BIT = 6,
1245#define SUPPORTED_MII (1 << 9) 1332 ETHTOOL_LINK_MODE_TP_BIT = 7,
1246#define SUPPORTED_FIBRE (1 << 10) 1333 ETHTOOL_LINK_MODE_AUI_BIT = 8,
1247#define SUPPORTED_BNC (1 << 11) 1334 ETHTOOL_LINK_MODE_MII_BIT = 9,
1248#define SUPPORTED_10000baseT_Full (1 << 12) 1335 ETHTOOL_LINK_MODE_FIBRE_BIT = 10,
1249#define SUPPORTED_Pause (1 << 13) 1336 ETHTOOL_LINK_MODE_BNC_BIT = 11,
1250#define SUPPORTED_Asym_Pause (1 << 14) 1337 ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12,
1251#define SUPPORTED_2500baseX_Full (1 << 15) 1338 ETHTOOL_LINK_MODE_Pause_BIT = 13,
1252#define SUPPORTED_Backplane (1 << 16) 1339 ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14,
1253#define SUPPORTED_1000baseKX_Full (1 << 17) 1340 ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15,
1254#define SUPPORTED_10000baseKX4_Full (1 << 18) 1341 ETHTOOL_LINK_MODE_Backplane_BIT = 16,
1255#define SUPPORTED_10000baseKR_Full (1 << 19) 1342 ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17,
1256#define SUPPORTED_10000baseR_FEC (1 << 20) 1343 ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18,
1257#define SUPPORTED_20000baseMLD2_Full (1 << 21) 1344 ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19,
1258#define SUPPORTED_20000baseKR2_Full (1 << 22) 1345 ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20,
1259#define SUPPORTED_40000baseKR4_Full (1 << 23) 1346 ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21,
1260#define SUPPORTED_40000baseCR4_Full (1 << 24) 1347 ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22,
1261#define SUPPORTED_40000baseSR4_Full (1 << 25) 1348 ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23,
1262#define SUPPORTED_40000baseLR4_Full (1 << 26) 1349 ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24,
1263#define SUPPORTED_56000baseKR4_Full (1 << 27) 1350 ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25,
1264#define SUPPORTED_56000baseCR4_Full (1 << 28) 1351 ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26,
1265#define SUPPORTED_56000baseSR4_Full (1 << 29) 1352 ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27,
1266#define SUPPORTED_56000baseLR4_Full (1 << 30) 1353 ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28,
1267 1354 ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29,
1268#define ADVERTISED_10baseT_Half (1 << 0) 1355 ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30,
1269#define ADVERTISED_10baseT_Full (1 << 1) 1356
1270#define ADVERTISED_100baseT_Half (1 << 2) 1357 /* Last allowed bit for __ETHTOOL_LINK_MODE_LEGACY_MASK is bit
1271#define ADVERTISED_100baseT_Full (1 << 3) 1358 * 31. Please do NOT define any SUPPORTED_* or ADVERTISED_*
1272#define ADVERTISED_1000baseT_Half (1 << 4) 1359 * macro for bits > 31. The only way to use indices > 31 is to
1273#define ADVERTISED_1000baseT_Full (1 << 5) 1360 * use the new ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API.
1274#define ADVERTISED_Autoneg (1 << 6) 1361 */
1275#define ADVERTISED_TP (1 << 7) 1362
1276#define ADVERTISED_AUI (1 << 8) 1363 __ETHTOOL_LINK_MODE_LAST
1277#define ADVERTISED_MII (1 << 9) 1364 = ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT,
1278#define ADVERTISED_FIBRE (1 << 10) 1365};
1279#define ADVERTISED_BNC (1 << 11) 1366
1280#define ADVERTISED_10000baseT_Full (1 << 12) 1367#define __ETHTOOL_LINK_MODE_LEGACY_MASK(base_name) \
1281#define ADVERTISED_Pause (1 << 13) 1368 (1UL << (ETHTOOL_LINK_MODE_ ## base_name ## _BIT))
1282#define ADVERTISED_Asym_Pause (1 << 14) 1369
1283#define ADVERTISED_2500baseX_Full (1 << 15) 1370/* DEPRECATED macros. Please migrate to
1284#define ADVERTISED_Backplane (1 << 16) 1371 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1285#define ADVERTISED_1000baseKX_Full (1 << 17) 1372 * define any new SUPPORTED_* macro for bits > 31.
1286#define ADVERTISED_10000baseKX4_Full (1 << 18) 1373 */
1287#define ADVERTISED_10000baseKR_Full (1 << 19) 1374#define SUPPORTED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1288#define ADVERTISED_10000baseR_FEC (1 << 20) 1375#define SUPPORTED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1289#define ADVERTISED_20000baseMLD2_Full (1 << 21) 1376#define SUPPORTED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1290#define ADVERTISED_20000baseKR2_Full (1 << 22) 1377#define SUPPORTED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1291#define ADVERTISED_40000baseKR4_Full (1 << 23) 1378#define SUPPORTED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1292#define ADVERTISED_40000baseCR4_Full (1 << 24) 1379#define SUPPORTED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1293#define ADVERTISED_40000baseSR4_Full (1 << 25) 1380#define SUPPORTED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1294#define ADVERTISED_40000baseLR4_Full (1 << 26) 1381#define SUPPORTED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1295#define ADVERTISED_56000baseKR4_Full (1 << 27) 1382#define SUPPORTED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1296#define ADVERTISED_56000baseCR4_Full (1 << 28) 1383#define SUPPORTED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1297#define ADVERTISED_56000baseSR4_Full (1 << 29) 1384#define SUPPORTED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1298#define ADVERTISED_56000baseLR4_Full (1 << 30) 1385#define SUPPORTED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1386#define SUPPORTED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1387#define SUPPORTED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1388#define SUPPORTED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1389#define SUPPORTED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1390#define SUPPORTED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1391#define SUPPORTED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1392#define SUPPORTED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1393#define SUPPORTED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1394#define SUPPORTED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1395#define SUPPORTED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1396#define SUPPORTED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1397#define SUPPORTED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1398#define SUPPORTED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1399#define SUPPORTED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1400#define SUPPORTED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1401#define SUPPORTED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1402#define SUPPORTED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1403#define SUPPORTED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1404#define SUPPORTED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1405/* Please do not define any new SUPPORTED_* macro for bits > 31, see
1406 * notice above.
1407 */
1408
1409/*
1410 * DEPRECATED macros. Please migrate to
1411 * ETHTOOL_GLINKSETTINGS/ETHTOOL_SLINKSETTINGS API. Please do NOT
1412 * define any new ADERTISE_* macro for bits > 31.
1413 */
1414#define ADVERTISED_10baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Half)
1415#define ADVERTISED_10baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10baseT_Full)
1416#define ADVERTISED_100baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Half)
1417#define ADVERTISED_100baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(100baseT_Full)
1418#define ADVERTISED_1000baseT_Half __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Half)
1419#define ADVERTISED_1000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseT_Full)
1420#define ADVERTISED_Autoneg __ETHTOOL_LINK_MODE_LEGACY_MASK(Autoneg)
1421#define ADVERTISED_TP __ETHTOOL_LINK_MODE_LEGACY_MASK(TP)
1422#define ADVERTISED_AUI __ETHTOOL_LINK_MODE_LEGACY_MASK(AUI)
1423#define ADVERTISED_MII __ETHTOOL_LINK_MODE_LEGACY_MASK(MII)
1424#define ADVERTISED_FIBRE __ETHTOOL_LINK_MODE_LEGACY_MASK(FIBRE)
1425#define ADVERTISED_BNC __ETHTOOL_LINK_MODE_LEGACY_MASK(BNC)
1426#define ADVERTISED_10000baseT_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseT_Full)
1427#define ADVERTISED_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Pause)
1428#define ADVERTISED_Asym_Pause __ETHTOOL_LINK_MODE_LEGACY_MASK(Asym_Pause)
1429#define ADVERTISED_2500baseX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(2500baseX_Full)
1430#define ADVERTISED_Backplane __ETHTOOL_LINK_MODE_LEGACY_MASK(Backplane)
1431#define ADVERTISED_1000baseKX_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(1000baseKX_Full)
1432#define ADVERTISED_10000baseKX4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKX4_Full)
1433#define ADVERTISED_10000baseKR_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseKR_Full)
1434#define ADVERTISED_10000baseR_FEC __ETHTOOL_LINK_MODE_LEGACY_MASK(10000baseR_FEC)
1435#define ADVERTISED_20000baseMLD2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseMLD2_Full)
1436#define ADVERTISED_20000baseKR2_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(20000baseKR2_Full)
1437#define ADVERTISED_40000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseKR4_Full)
1438#define ADVERTISED_40000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseCR4_Full)
1439#define ADVERTISED_40000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseSR4_Full)
1440#define ADVERTISED_40000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(40000baseLR4_Full)
1441#define ADVERTISED_56000baseKR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseKR4_Full)
1442#define ADVERTISED_56000baseCR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseCR4_Full)
1443#define ADVERTISED_56000baseSR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseSR4_Full)
1444#define ADVERTISED_56000baseLR4_Full __ETHTOOL_LINK_MODE_LEGACY_MASK(56000baseLR4_Full)
1445/* Please do not define any new ADVERTISED_* macro for bits > 31, see
1446 * notice above.
1447 */
1299 1448
1300/* The following are all involved in forcing a particular link 1449/* The following are all involved in forcing a particular link
1301 * mode for the device for setting things. When getting the 1450 * mode for the device for setting things. When getting the
@@ -1303,7 +1452,7 @@ enum ethtool_sfeatures_retval_bits {
1303 * it was forced up into this mode or autonegotiated. 1452 * it was forced up into this mode or autonegotiated.
1304 */ 1453 */
1305 1454
1306/* The forced speed, 10Mb, 100Mb, gigabit, [2.5|5|10|20|25|40|50|56|100]GbE. */ 1455/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */
1307#define SPEED_10 10 1456#define SPEED_10 10
1308#define SPEED_100 100 1457#define SPEED_100 100
1309#define SPEED_1000 1000 1458#define SPEED_1000 1000
@@ -1319,11 +1468,28 @@ enum ethtool_sfeatures_retval_bits {
1319 1468
1320#define SPEED_UNKNOWN -1 1469#define SPEED_UNKNOWN -1
1321 1470
1471static inline int ethtool_validate_speed(__u32 speed)
1472{
1473 return speed <= INT_MAX || speed == SPEED_UNKNOWN;
1474}
1475
1322/* Duplex, half or full. */ 1476/* Duplex, half or full. */
1323#define DUPLEX_HALF 0x00 1477#define DUPLEX_HALF 0x00
1324#define DUPLEX_FULL 0x01 1478#define DUPLEX_FULL 0x01
1325#define DUPLEX_UNKNOWN 0xff 1479#define DUPLEX_UNKNOWN 0xff
1326 1480
1481static inline int ethtool_validate_duplex(__u8 duplex)
1482{
1483 switch (duplex) {
1484 case DUPLEX_HALF:
1485 case DUPLEX_FULL:
1486 case DUPLEX_UNKNOWN:
1487 return 1;
1488 }
1489
1490 return 0;
1491}
1492
1327/* Which connector port. */ 1493/* Which connector port. */
1328#define PORT_TP 0x00 1494#define PORT_TP 0x00
1329#define PORT_AUI 0x01 1495#define PORT_AUI 0x01
@@ -1367,15 +1533,17 @@ enum ethtool_sfeatures_retval_bits {
1367#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */ 1533#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1368#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */ 1534#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1369#define AH_ESP_V4_FLOW 0x04 /* hash only */ 1535#define AH_ESP_V4_FLOW 0x04 /* hash only */
1370#define TCP_V6_FLOW 0x05 /* hash only */ 1536#define TCP_V6_FLOW 0x05 /* hash or spec (tcp_ip6_spec; nfc only) */
1371#define UDP_V6_FLOW 0x06 /* hash only */ 1537#define UDP_V6_FLOW 0x06 /* hash or spec (udp_ip6_spec; nfc only) */
1372#define SCTP_V6_FLOW 0x07 /* hash only */ 1538#define SCTP_V6_FLOW 0x07 /* hash or spec (sctp_ip6_spec; nfc only) */
1373#define AH_ESP_V6_FLOW 0x08 /* hash only */ 1539#define AH_ESP_V6_FLOW 0x08 /* hash only */
1374#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */ 1540#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1375#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */ 1541#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1376#define AH_V6_FLOW 0x0b /* hash only */ 1542#define AH_V6_FLOW 0x0b /* hash or spec (ah_ip6_spec; nfc only) */
1377#define ESP_V6_FLOW 0x0c /* hash only */ 1543#define ESP_V6_FLOW 0x0c /* hash or spec (esp_ip6_spec; nfc only) */
1378#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */ 1544#define IPV4_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1545#define IP_USER_FLOW IPV4_USER_FLOW
1546#define IPV6_USER_FLOW 0x0e /* spec only (usr_ip6_spec; nfc only) */
1379#define IPV4_FLOW 0x10 /* hash only */ 1547#define IPV4_FLOW 0x10 /* hash only */
1380#define IPV6_FLOW 0x11 /* hash only */ 1548#define IPV6_FLOW 0x11 /* hash only */
1381#define ETHER_FLOW 0x12 /* spec only (ether_spec) */ 1549#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
@@ -1441,4 +1609,123 @@ enum ethtool_reset_flags {
1441}; 1609};
1442#define ETH_RESET_SHARED_SHIFT 16 1610#define ETH_RESET_SHARED_SHIFT 16
1443 1611
1612
1613/**
1614 * struct ethtool_link_settings - link control and status
1615 *
1616 * IMPORTANT, Backward compatibility notice: When implementing new
1617 * user-space tools, please first try %ETHTOOL_GLINKSETTINGS, and
1618 * if it succeeds use %ETHTOOL_SLINKSETTINGS to change link
1619 * settings; do not use %ETHTOOL_SSET if %ETHTOOL_GLINKSETTINGS
1620 * succeeded: stick to %ETHTOOL_GLINKSETTINGS/%SLINKSETTINGS in
1621 * that case. Conversely, if %ETHTOOL_GLINKSETTINGS fails, use
1622 * %ETHTOOL_GSET to query and %ETHTOOL_SSET to change link
1623 * settings; do not use %ETHTOOL_SLINKSETTINGS if
1624 * %ETHTOOL_GLINKSETTINGS failed: stick to
1625 * %ETHTOOL_GSET/%ETHTOOL_SSET in that case.
1626 *
1627 * @cmd: Command number = %ETHTOOL_GLINKSETTINGS or %ETHTOOL_SLINKSETTINGS
1628 * @speed: Link speed (Mbps)
1629 * @duplex: Duplex mode; one of %DUPLEX_*
1630 * @port: Physical connector type; one of %PORT_*
1631 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
1632 * applicable. For clause 45 PHYs this is the PRTAD.
1633 * @autoneg: Enable/disable autonegotiation and auto-detection;
1634 * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
1635 * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
1636 * protocols supported by the interface; 0 if unknown.
1637 * Read-only.
1638 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
1639 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
1640 * value will be %ETH_TP_MDI_INVALID. Read-only.
1641 * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
1642 * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
1643 * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
1644 * When written successfully, the link should be renegotiated if
1645 * necessary.
1646 * @link_mode_masks_nwords: Number of 32-bit words for each of the
1647 * supported, advertising, lp_advertising link mode bitmaps. For
1648 * %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
1649 * (>= 0); on return, if handshake in progress, negative if
1650 * request size unsupported by kernel: absolute value indicates
1651 * kernel recommended size and cmd field is 0, as well as all the
1652 * other fields; otherwise (handshake completed), strictly
1653 * positive to indicate size used by kernel and cmd field is
1654 * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
1655 * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
1656 * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
1657 * refused. For drivers: ignore this field (use kernel's
1658 * __ETHTOOL_LINK_MODE_MASK_NBITS instead), any change to it will
1659 * be overwritten by kernel.
1660 * @supported: Bitmap with each bit meaning given by
1661 * %ethtool_link_mode_bit_indices for the link modes, physical
1662 * connectors and other link features for which the interface
1663 * supports autonegotiation or auto-detection. Read-only.
1664 * @advertising: Bitmap with each bit meaning given by
1665 * %ethtool_link_mode_bit_indices for the link modes, physical
1666 * connectors and other link features that are advertised through
1667 * autonegotiation or enabled for auto-detection.
1668 * @lp_advertising: Bitmap with each bit meaning given by
1669 * %ethtool_link_mode_bit_indices for the link modes, and other
1670 * link features that the link partner advertised through
1671 * autonegotiation; 0 if unknown or not applicable. Read-only.
1672 *
1673 * If autonegotiation is disabled, the speed and @duplex represent the
1674 * fixed link mode and are writable if the driver supports multiple
1675 * link modes. If it is enabled then they are read-only; if the link
1676 * is up they represent the negotiated link mode; if the link is down,
1677 * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
1678 * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
1679 *
1680 * Some hardware interfaces may have multiple PHYs and/or physical
1681 * connectors fitted or do not allow the driver to detect which are
1682 * fitted. For these interfaces @port and/or @phy_address may be
1683 * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
1684 * Otherwise, attempts to write different values may be ignored or
1685 * rejected.
1686 *
1687 * Deprecated %ethtool_cmd fields transceiver, maxtxpkt and maxrxpkt
1688 * are not available in %ethtool_link_settings. Until all drivers are
1689 * converted to ignore them or to the new %ethtool_link_settings API,
1690 * for both queries and changes, users should always try
1691 * %ETHTOOL_GLINKSETTINGS first, and if it fails with -ENOTSUPP stick
1692 * only to %ETHTOOL_GSET and %ETHTOOL_SSET consistently. If it
1693 * succeeds, then users should stick to %ETHTOOL_GLINKSETTINGS and
1694 * %ETHTOOL_SLINKSETTINGS (which would support drivers implementing
1695 * either %ethtool_cmd or %ethtool_link_settings).
1696 *
1697 * Users should assume that all fields not marked read-only are
1698 * writable and subject to validation by the driver. They should use
1699 * %ETHTOOL_GLINKSETTINGS to get the current values before making specific
1700 * changes and then applying them with %ETHTOOL_SLINKSETTINGS.
1701 *
1702 * Drivers that implement %get_link_ksettings and/or
1703 * %set_link_ksettings should ignore the @cmd
1704 * and @link_mode_masks_nwords fields (any change to them overwritten
1705 * by kernel), and rely only on kernel's internal
1706 * %__ETHTOOL_LINK_MODE_MASK_NBITS and
1707 * %ethtool_link_mode_mask_t. Drivers that implement
1708 * %set_link_ksettings() should validate all fields other than @cmd
1709 * and @link_mode_masks_nwords that are not described as read-only or
1710 * deprecated, and must ignore all fields described as read-only.
1711 */
1712struct ethtool_link_settings {
1713 __u32 cmd;
1714 __u32 speed;
1715 __u8 duplex;
1716 __u8 port;
1717 __u8 phy_address;
1718 __u8 autoneg;
1719 __u8 mdio_support;
1720 __u8 eth_tp_mdix;
1721 __u8 eth_tp_mdix_ctrl;
1722 __s8 link_mode_masks_nwords;
1723 __u32 reserved[8];
1724 __u32 link_mode_masks[0];
1725 /* layout of link_mode_masks fields:
1726 * __u32 map_supported[link_mode_masks_nwords];
1727 * __u32 map_advertising[link_mode_masks_nwords];
1728 * __u32 map_lp_advertising[link_mode_masks_nwords];
1729 */
1730};
1444#endif /* _UAPI_LINUX_ETHTOOL_H */ 1731#endif /* _UAPI_LINUX_ETHTOOL_H */