diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-12-15 08:55:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-16 13:52:47 -0500 |
commit | 7850f63f1620512631445b901ae11cd149e7375c (patch) | |
tree | d26a5f049dcf3634c4bf9e1b86915d201fab3836 /include/linux/ethtool.h | |
parent | 14596f7006297b67516e2b6a2b26bcb11fe08fb3 (diff) |
ethtool: Centralise validation of ETHTOOL_{G, S}RXFHINDIR parameters
Add a new ethtool operation (get_rxfh_indir_size) to get the
indirectional table size. Use this to validate the user buffer size
before calling get_rxfh_indir or set_rxfh_indir. Use get_rxnfc to get
the number of RX rings, and validate the contents of the new
indirection table before calling set_rxfh_indir. Remove this
validation from drivers.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r-- | include/linux/ethtool.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 0ec2fd412d03..3b9f09d55b5c 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -828,9 +828,13 @@ u32 ethtool_op_get_link(struct net_device *dev); | |||
828 | * error code or zero. | 828 | * error code or zero. |
829 | * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code | 829 | * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code |
830 | * or zero. | 830 | * or zero. |
831 | * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table. | ||
832 | * Returns zero if not supported for this specific device. | ||
831 | * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. | 833 | * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. |
834 | * Will not be called if @get_rxfh_indir_size returns zero. | ||
832 | * Returns a negative error code or zero. | 835 | * Returns a negative error code or zero. |
833 | * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. | 836 | * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. |
837 | * Will not be called if @get_rxfh_indir_size returns zero. | ||
834 | * Returns a negative error code or zero. | 838 | * Returns a negative error code or zero. |
835 | * @get_channels: Get number of channels. | 839 | * @get_channels: Get number of channels. |
836 | * @set_channels: Set number of channels. Returns a negative error code or | 840 | * @set_channels: Set number of channels. Returns a negative error code or |
@@ -894,10 +898,9 @@ struct ethtool_ops { | |||
894 | int (*reset)(struct net_device *, u32 *); | 898 | int (*reset)(struct net_device *, u32 *); |
895 | int (*set_rx_ntuple)(struct net_device *, | 899 | int (*set_rx_ntuple)(struct net_device *, |
896 | struct ethtool_rx_ntuple *); | 900 | struct ethtool_rx_ntuple *); |
897 | int (*get_rxfh_indir)(struct net_device *, | 901 | u32 (*get_rxfh_indir_size)(struct net_device *); |
898 | struct ethtool_rxfh_indir *); | 902 | int (*get_rxfh_indir)(struct net_device *, u32 *); |
899 | int (*set_rxfh_indir)(struct net_device *, | 903 | int (*set_rxfh_indir)(struct net_device *, const u32 *); |
900 | const struct ethtool_rxfh_indir *); | ||
901 | void (*get_channels)(struct net_device *, struct ethtool_channels *); | 904 | void (*get_channels)(struct net_device *, struct ethtool_channels *); |
902 | int (*set_channels)(struct net_device *, struct ethtool_channels *); | 905 | int (*set_channels)(struct net_device *, struct ethtool_channels *); |
903 | int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); | 906 | int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); |