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.h116
1 files changed, 51 insertions, 65 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index de33de1e2052..da5b2de99ae4 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -489,7 +489,10 @@ struct ethtool_rx_flow_spec {
489 * on return. 489 * on return.
490 * 490 *
491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined 491 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
492 * rules on return. 492 * rules on return. If @data is non-zero on return then it is the
493 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
494 * driver supports any special location values. If that flag is not
495 * set in @data then special location values should not be used.
493 * 496 *
494 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an 497 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
495 * existing rule on entry and @fs contains the rule on return. 498 * existing rule on entry and @fs contains the rule on return.
@@ -501,10 +504,23 @@ struct ethtool_rx_flow_spec {
501 * must use the second parameter to get_rxnfc() instead of @rule_locs. 504 * must use the second parameter to get_rxnfc() instead of @rule_locs.
502 * 505 *
503 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update. 506 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
504 * @fs.@location specifies the location to use and must not be ignored. 507 * @fs.@location either specifies the location to use or is a special
508 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
509 * @fs.@location is the actual rule location.
505 * 510 *
506 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an 511 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
507 * existing rule on entry. 512 * existing rule on entry.
513 *
514 * A driver supporting the special location values for
515 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
516 * location, and may remove a rule at a later location (lower
517 * priority) that matches exactly the same set of flows. The special
518 * values are: %RX_CLS_LOC_ANY, selecting any location;
519 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
520 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
521 * location (minimum priority). Additional special values may be
522 * defined in future and drivers must return -%EINVAL for any
523 * unrecognised value.
508 */ 524 */
509struct ethtool_rxnfc { 525struct ethtool_rxnfc {
510 __u32 cmd; 526 __u32 cmd;
@@ -543,9 +559,15 @@ struct compat_ethtool_rxnfc {
543/** 559/**
544 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 560 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
545 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 561 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
546 * @size: On entry, the array size of the user buffer. On return from 562 * @size: On entry, the array size of the user buffer, which may be zero.
547 * %ETHTOOL_GRXFHINDIR, the array size of the hardware indirection table. 563 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
564 * indirection table.
548 * @ring_index: RX ring/queue index for each hash value 565 * @ring_index: RX ring/queue index for each hash value
566 *
567 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
568 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
569 * the table should be reset to default values. This last feature
570 * is not supported by the original implementations.
549 */ 571 */
550struct ethtool_rxfh_indir { 572struct ethtool_rxfh_indir {
551 __u32 cmd; 573 __u32 cmd;
@@ -724,9 +746,6 @@ enum ethtool_sfeatures_retval_bits {
724 746
725#include <linux/rculist.h> 747#include <linux/rculist.h>
726 748
727/* needed by dev_disable_lro() */
728extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
729
730extern int __ethtool_get_settings(struct net_device *dev, 749extern int __ethtool_get_settings(struct net_device *dev,
731 struct ethtool_cmd *cmd); 750 struct ethtool_cmd *cmd);
732 751
@@ -750,19 +769,18 @@ struct net_device;
750 769
751/* Some generic methods drivers may use in their ethtool_ops */ 770/* Some generic methods drivers may use in their ethtool_ops */
752u32 ethtool_op_get_link(struct net_device *dev); 771u32 ethtool_op_get_link(struct net_device *dev);
753u32 ethtool_op_get_tx_csum(struct net_device *dev); 772
754int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 773/**
755int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 774 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
756int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data); 775 * @index: Index in RX flow hash indirection table
757u32 ethtool_op_get_sg(struct net_device *dev); 776 * @n_rx_rings: Number of RX rings to use
758int ethtool_op_set_sg(struct net_device *dev, u32 data); 777 *
759u32 ethtool_op_get_tso(struct net_device *dev); 778 * This function provides the default policy for RX flow hash indirection.
760int ethtool_op_set_tso(struct net_device *dev, u32 data); 779 */
761u32 ethtool_op_get_ufo(struct net_device *dev); 780static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
762int ethtool_op_set_ufo(struct net_device *dev, u32 data); 781{
763u32 ethtool_op_get_flags(struct net_device *dev); 782 return index % n_rx_rings;
764int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 783}
765bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
766 784
767/** 785/**
768 * struct ethtool_ops - optional netdev operations 786 * struct ethtool_ops - optional netdev operations
@@ -807,22 +825,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
807 * @get_pauseparam: Report pause parameters 825 * @get_pauseparam: Report pause parameters
808 * @set_pauseparam: Set pause parameters. Returns a negative error code 826 * @set_pauseparam: Set pause parameters. Returns a negative error code
809 * or zero. 827 * or zero.
810 * @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
811 * Report whether receive checksums are turned on or off.
812 * @set_rx_csum: Deprecated in favour of generic netdev features. Turn
813 * receive checksum on or off. Returns a negative error code or zero.
814 * @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
815 * are turned on or off.
816 * @set_tx_csum: Deprecated in favour of generic netdev features. Turn
817 * transmit checksums on or off. Returns a negative error code or zero.
818 * @get_sg: Deprecated as redundant. Report whether scatter-gather is
819 * enabled.
820 * @set_sg: Deprecated in favour of generic netdev features. Turn
821 * scatter-gather on or off. Returns a negative error code or zero.
822 * @get_tso: Deprecated as redundant. Report whether TCP segmentation
823 * offload is enabled.
824 * @set_tso: Deprecated in favour of generic netdev features. Turn TCP
825 * segmentation offload on or off. Returns a negative error code or zero.
826 * @self_test: Run specified self-tests 828 * @self_test: Run specified self-tests
827 * @get_strings: Return a set of strings that describe the requested objects 829 * @get_strings: Return a set of strings that describe the requested objects
828 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED 830 * @set_phys_id: Identify the physical devices, e.g. by flashing an LED
@@ -844,15 +846,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
844 * negative error code or zero. 846 * negative error code or zero.
845 * @complete: Function to be called after any other operation except 847 * @complete: Function to be called after any other operation except
846 * @begin. Will be called even if the other operation failed. 848 * @begin. Will be called even if the other operation failed.
847 * @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
848 * offload is enabled.
849 * @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
850 * fragmentation offload on or off. Returns a negative error code or zero.
851 * @get_flags: Deprecated as redundant. Report features included in
852 * &enum ethtool_flags that are enabled.
853 * @set_flags: Deprecated in favour of generic netdev features. Turn
854 * features included in &enum ethtool_flags on or off. Returns a
855 * negative error code or zero.
856 * @get_priv_flags: Report driver-specific feature flags. 849 * @get_priv_flags: Report driver-specific feature flags.
857 * @set_priv_flags: Set driver-specific feature flags. Returns a negative 850 * @set_priv_flags: Set driver-specific feature flags. Returns a negative
858 * error code or zero. 851 * error code or zero.
@@ -866,11 +859,13 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
866 * @reset: Reset (part of) the device, as specified by a bitmask of 859 * @reset: Reset (part of) the device, as specified by a bitmask of
867 * flags from &enum ethtool_reset_flags. Returns a negative 860 * flags from &enum ethtool_reset_flags. Returns a negative
868 * error code or zero. 861 * error code or zero.
869 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code 862 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
870 * or zero. 863 * Returns zero if not supported for this specific device.
871 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 864 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
865 * Will not be called if @get_rxfh_indir_size returns zero.
872 * Returns a negative error code or zero. 866 * Returns a negative error code or zero.
873 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 867 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
868 * Will not be called if @get_rxfh_indir_size returns zero.
874 * Returns a negative error code or zero. 869 * Returns a negative error code or zero.
875 * @get_channels: Get number of channels. 870 * @get_channels: Get number of channels.
876 * @set_channels: Set number of channels. Returns a negative error code or 871 * @set_channels: Set number of channels. Returns a negative error code or
@@ -917,14 +912,6 @@ struct ethtool_ops {
917 struct ethtool_pauseparam*); 912 struct ethtool_pauseparam*);
918 int (*set_pauseparam)(struct net_device *, 913 int (*set_pauseparam)(struct net_device *,
919 struct ethtool_pauseparam*); 914 struct ethtool_pauseparam*);
920 u32 (*get_rx_csum)(struct net_device *);
921 int (*set_rx_csum)(struct net_device *, u32);
922 u32 (*get_tx_csum)(struct net_device *);
923 int (*set_tx_csum)(struct net_device *, u32);
924 u32 (*get_sg)(struct net_device *);
925 int (*set_sg)(struct net_device *, u32);
926 u32 (*get_tso)(struct net_device *);
927 int (*set_tso)(struct net_device *, u32);
928 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 915 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
929 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 916 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
930 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); 917 int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
@@ -932,10 +919,6 @@ struct ethtool_ops {
932 struct ethtool_stats *, u64 *); 919 struct ethtool_stats *, u64 *);
933 int (*begin)(struct net_device *); 920 int (*begin)(struct net_device *);
934 void (*complete)(struct net_device *); 921 void (*complete)(struct net_device *);
935 u32 (*get_ufo)(struct net_device *);
936 int (*set_ufo)(struct net_device *, u32);
937 u32 (*get_flags)(struct net_device *);
938 int (*set_flags)(struct net_device *, u32);
939 u32 (*get_priv_flags)(struct net_device *); 922 u32 (*get_priv_flags)(struct net_device *);
940 int (*set_priv_flags)(struct net_device *, u32); 923 int (*set_priv_flags)(struct net_device *, u32);
941 int (*get_sset_count)(struct net_device *, int); 924 int (*get_sset_count)(struct net_device *, int);
@@ -944,12 +927,9 @@ struct ethtool_ops {
944 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 927 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
945 int (*flash_device)(struct net_device *, struct ethtool_flash *); 928 int (*flash_device)(struct net_device *, struct ethtool_flash *);
946 int (*reset)(struct net_device *, u32 *); 929 int (*reset)(struct net_device *, u32 *);
947 int (*set_rx_ntuple)(struct net_device *, 930 u32 (*get_rxfh_indir_size)(struct net_device *);
948 struct ethtool_rx_ntuple *); 931 int (*get_rxfh_indir)(struct net_device *, u32 *);
949 int (*get_rxfh_indir)(struct net_device *, 932 int (*set_rxfh_indir)(struct net_device *, const u32 *);
950 struct ethtool_rxfh_indir *);
951 int (*set_rxfh_indir)(struct net_device *,
952 const struct ethtool_rxfh_indir *);
953 void (*get_channels)(struct net_device *, struct ethtool_channels *); 933 void (*get_channels)(struct net_device *, struct ethtool_channels *);
954 int (*set_channels)(struct net_device *, struct ethtool_channels *); 934 int (*set_channels)(struct net_device *, struct ethtool_channels *);
955 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 935 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
@@ -1173,6 +1153,12 @@ struct ethtool_ops {
1173 1153
1174#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL 1154#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1175 1155
1156/* Special RX classification rule insert location values */
1157#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1158#define RX_CLS_LOC_ANY 0xffffffff
1159#define RX_CLS_LOC_FIRST 0xfffffffe
1160#define RX_CLS_LOC_LAST 0xfffffffd
1161
1176/* Reset flags */ 1162/* Reset flags */
1177/* The reset() operation must clear the flags for the components which 1163/* The reset() operation must clear the flags for the components which
1178 * were actually reset. On successful return, the flags indicate the 1164 * were actually reset. On successful return, the flags indicate the