aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ethtool.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r--include/linux/ethtool.h112
1 files changed, 107 insertions, 5 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 15e4eb713694..b33f316bb92e 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -49,17 +49,25 @@ static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
49 return (ep->speed_hi << 16) | ep->speed; 49 return (ep->speed_hi << 16) | ep->speed;
50} 50}
51 51
52#define ETHTOOL_FWVERS_LEN 32
52#define ETHTOOL_BUSINFO_LEN 32 53#define ETHTOOL_BUSINFO_LEN 32
53/* these strings are set to whatever the driver author decides... */ 54/* these strings are set to whatever the driver author decides... */
54struct ethtool_drvinfo { 55struct ethtool_drvinfo {
55 __u32 cmd; 56 __u32 cmd;
56 char driver[32]; /* driver short name, "tulip", "eepro100" */ 57 char driver[32]; /* driver short name, "tulip", "eepro100" */
57 char version[32]; /* driver version string */ 58 char version[32]; /* driver version string */
58 char fw_version[32]; /* firmware version string, if applicable */ 59 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */
59 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ 60 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
60 /* For PCI devices, use pci_name(pci_dev). */ 61 /* For PCI devices, use pci_name(pci_dev). */
61 char reserved1[32]; 62 char reserved1[32];
62 char reserved2[12]; 63 char reserved2[12];
64 /*
65 * Some struct members below are filled in
66 * using ops->get_sset_count(). Obtaining
67 * this info from ethtool_drvinfo is now
68 * deprecated; Use ETHTOOL_GSSET_INFO
69 * instead.
70 */
63 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */ 71 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
64 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */ 72 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
65 __u32 testinfo_len; 73 __u32 testinfo_len;
@@ -241,6 +249,7 @@ enum ethtool_stringset {
241 ETH_SS_TEST = 0, 249 ETH_SS_TEST = 0,
242 ETH_SS_STATS, 250 ETH_SS_STATS,
243 ETH_SS_PRIV_FLAGS, 251 ETH_SS_PRIV_FLAGS,
252 ETH_SS_NTUPLE_FILTERS,
244}; 253};
245 254
246/* for passing string sets for data tagging */ 255/* for passing string sets for data tagging */
@@ -251,6 +260,17 @@ struct ethtool_gstrings {
251 __u8 data[0]; 260 __u8 data[0];
252}; 261};
253 262
263struct ethtool_sset_info {
264 __u32 cmd; /* ETHTOOL_GSSET_INFO */
265 __u32 reserved;
266 __u64 sset_mask; /* input: each bit selects an sset to query */
267 /* output: each bit a returned sset */
268 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
269 in sset_mask. One bit implies one
270 __u32, two bits implies two
271 __u32's, etc. */
272};
273
254enum ethtool_test_flags { 274enum ethtool_test_flags {
255 ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ 275 ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */
256 ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ 276 ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */
@@ -289,6 +309,7 @@ struct ethtool_perm_addr {
289 */ 309 */
290enum ethtool_flags { 310enum ethtool_flags {
291 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
292}; 313};
293 314
294/* The following structures are for supporting RX network flow 315/* The following structures are for supporting RX network flow
@@ -362,6 +383,35 @@ struct ethtool_rxnfc {
362 __u32 rule_locs[0]; 383 __u32 rule_locs[0];
363}; 384};
364 385
386struct ethtool_rx_ntuple_flow_spec {
387 __u32 flow_type;
388 union {
389 struct ethtool_tcpip4_spec tcp_ip4_spec;
390 struct ethtool_tcpip4_spec udp_ip4_spec;
391 struct ethtool_tcpip4_spec sctp_ip4_spec;
392 struct ethtool_ah_espip4_spec ah_ip4_spec;
393 struct ethtool_ah_espip4_spec esp_ip4_spec;
394 struct ethtool_rawip4_spec raw_ip4_spec;
395 struct ethtool_ether_spec ether_spec;
396 struct ethtool_usrip4_spec usr_ip4_spec;
397 __u8 hdata[64];
398 } h_u, m_u; /* entry, mask */
399
400 __u16 vlan_tag;
401 __u16 vlan_tag_mask;
402 __u64 data; /* user-defined flow spec data */
403 __u64 data_mask; /* user-defined flow spec mask */
404
405 /* signed to distinguish between queue and actions (DROP) */
406 __s32 action;
407#define ETHTOOL_RXNTUPLE_ACTION_DROP -1
408};
409
410struct ethtool_rx_ntuple {
411 __u32 cmd;
412 struct ethtool_rx_ntuple_flow_spec fs;
413};
414
365#define ETHTOOL_FLASH_MAX_FILENAME 128 415#define ETHTOOL_FLASH_MAX_FILENAME 128
366enum ethtool_flash_op_type { 416enum ethtool_flash_op_type {
367 ETHTOOL_FLASH_ALL_REGIONS = 0, 417 ETHTOOL_FLASH_ALL_REGIONS = 0,
@@ -376,6 +426,20 @@ struct ethtool_flash {
376 426
377#ifdef __KERNEL__ 427#ifdef __KERNEL__
378 428
429#include <linux/rculist.h>
430
431struct ethtool_rx_ntuple_flow_spec_container {
432 struct ethtool_rx_ntuple_flow_spec fs;
433 struct list_head list;
434};
435
436struct ethtool_rx_ntuple_list {
437#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
438#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
439 struct list_head list;
440 unsigned int count;
441};
442
379struct net_device; 443struct net_device;
380 444
381/* Some generic methods drivers may use in their ethtool_ops */ 445/* Some generic methods drivers may use in their ethtool_ops */
@@ -393,6 +457,7 @@ u32 ethtool_op_get_ufo(struct net_device *dev);
393int ethtool_op_set_ufo(struct net_device *dev, u32 data); 457int ethtool_op_set_ufo(struct net_device *dev, u32 data);
394u32 ethtool_op_get_flags(struct net_device *dev); 458u32 ethtool_op_get_flags(struct net_device *dev);
395int ethtool_op_set_flags(struct net_device *dev, u32 data); 459int ethtool_op_set_flags(struct net_device *dev, u32 data);
460void ethtool_ntuple_flush(struct net_device *dev);
396 461
397/** 462/**
398 * &ethtool_ops - Alter and report network device settings 463 * &ethtool_ops - Alter and report network device settings
@@ -495,13 +560,12 @@ struct ethtool_ops {
495 u32 (*get_priv_flags)(struct net_device *); 560 u32 (*get_priv_flags)(struct net_device *);
496 int (*set_priv_flags)(struct net_device *, u32); 561 int (*set_priv_flags)(struct net_device *, u32);
497 int (*get_sset_count)(struct net_device *, int); 562 int (*get_sset_count)(struct net_device *, int);
498
499 /* the following hooks are obsolete */
500 int (*self_test_count)(struct net_device *);/* use get_sset_count */
501 int (*get_stats_count)(struct net_device *);/* use get_sset_count */
502 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 563 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
503 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 564 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
504 int (*flash_device)(struct net_device *, struct ethtool_flash *); 565 int (*flash_device)(struct net_device *, struct ethtool_flash *);
566 int (*reset)(struct net_device *, u32 *);
567 int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *);
568 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
505}; 569};
506#endif /* __KERNEL__ */ 570#endif /* __KERNEL__ */
507 571
@@ -559,6 +623,10 @@ struct ethtool_ops {
559#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 623#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
560#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 624#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
561#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 625#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
626#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
627#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
628#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */
629#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
562 630
563/* compatibility with older code */ 631/* compatibility with older code */
564#define SPARC_ETH_GSET ETHTOOL_GSET 632#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -633,6 +701,8 @@ struct ethtool_ops {
633#define PORT_MII 0x02 701#define PORT_MII 0x02
634#define PORT_FIBRE 0x03 702#define PORT_FIBRE 0x03
635#define PORT_BNC 0x04 703#define PORT_BNC 0x04
704#define PORT_DA 0x05
705#define PORT_NONE 0xef
636#define PORT_OTHER 0xff 706#define PORT_OTHER 0xff
637 707
638/* Which transceiver to use. */ 708/* Which transceiver to use. */
@@ -676,6 +746,8 @@ struct ethtool_ops {
676#define AH_V6_FLOW 0x0b 746#define AH_V6_FLOW 0x0b
677#define ESP_V6_FLOW 0x0c 747#define ESP_V6_FLOW 0x0c
678#define IP_USER_FLOW 0x0d 748#define IP_USER_FLOW 0x0d
749#define IPV4_FLOW 0x10
750#define IPV6_FLOW 0x11
679 751
680/* L3-L4 network traffic flow hash options */ 752/* L3-L4 network traffic flow hash options */
681#define RXH_L2DA (1 << 1) 753#define RXH_L2DA (1 << 1)
@@ -689,4 +761,34 @@ struct ethtool_ops {
689 761
690#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 762#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
691 763
764/* Reset flags */
765/* The reset() operation must clear the flags for the components which
766 * were actually reset. On successful return, the flags indicate the
767 * components which were not reset, either because they do not exist
768 * in the hardware or because they cannot be reset independently. The
769 * driver must never reset any components that were not requested.
770 */
771enum ethtool_reset_flags {
772 /* These flags represent components dedicated to the interface
773 * the command is addressed to. Shift any flag left by
774 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
775 * same type.
776 */
777 ETH_RESET_MGMT = 1 << 0, /* Management processor */
778 ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
779 ETH_RESET_DMA = 1 << 2, /* DMA engine */
780 ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
781 ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
782 ETH_RESET_MAC = 1 << 5, /* Media access controller */
783 ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
784 ETH_RESET_RAM = 1 << 7, /* RAM shared between
785 * multiple components */
786
787 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
788 * this interface */
789 ETH_RESET_ALL = 0xffffffff, /* All components used by this
790 * interface, even if shared */
791};
792#define ETH_RESET_SHARED_SHIFT 16
793
692#endif /* _LINUX_ETHTOOL_H */ 794#endif /* _LINUX_ETHTOOL_H */