Skip to content

Commit

Permalink
net: remove legacy ethtool ops
Browse files Browse the repository at this point in the history
As all drivers are converted, we may now remove discrete offload setting
callback handling.

Signed-off-by: Michał Mirosław <[email protected]>
Acked-by: Ben Hutchings <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
osctobe authored and davem330 committed Nov 16, 2011
1 parent 33a5ba1 commit bc5787c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 479 deletions.
53 changes: 0 additions & 53 deletions include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,6 @@ enum ethtool_sfeatures_retval_bits {

#include <linux/rculist.h>

/* needed by dev_disable_lro() */
extern int __ethtool_set_flags(struct net_device *dev, u32 flags);

extern int __ethtool_get_settings(struct net_device *dev,
struct ethtool_cmd *cmd);

Expand All @@ -750,19 +747,6 @@ struct net_device;

/* Some generic methods drivers may use in their ethtool_ops */
u32 ethtool_op_get_link(struct net_device *dev);
u32 ethtool_op_get_tx_csum(struct net_device *dev);
int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
int ethtool_op_set_tx_ipv6_csum(struct net_device *dev, u32 data);
u32 ethtool_op_get_sg(struct net_device *dev);
int ethtool_op_set_sg(struct net_device *dev, u32 data);
u32 ethtool_op_get_tso(struct net_device *dev);
int ethtool_op_set_tso(struct net_device *dev, u32 data);
u32 ethtool_op_get_ufo(struct net_device *dev);
int ethtool_op_set_ufo(struct net_device *dev, u32 data);
u32 ethtool_op_get_flags(struct net_device *dev);
int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);

/**
* struct ethtool_ops - optional netdev operations
Expand Down Expand Up @@ -807,22 +791,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
* @get_pauseparam: Report pause parameters
* @set_pauseparam: Set pause parameters. Returns a negative error code
* or zero.
* @get_rx_csum: Deprecated in favour of the netdev feature %NETIF_F_RXCSUM.
* Report whether receive checksums are turned on or off.
* @set_rx_csum: Deprecated in favour of generic netdev features. Turn
* receive checksum on or off. Returns a negative error code or zero.
* @get_tx_csum: Deprecated as redundant. Report whether transmit checksums
* are turned on or off.
* @set_tx_csum: Deprecated in favour of generic netdev features. Turn
* transmit checksums on or off. Returns a negative error code or zero.
* @get_sg: Deprecated as redundant. Report whether scatter-gather is
* enabled.
* @set_sg: Deprecated in favour of generic netdev features. Turn
* scatter-gather on or off. Returns a negative error code or zero.
* @get_tso: Deprecated as redundant. Report whether TCP segmentation
* offload is enabled.
* @set_tso: Deprecated in favour of generic netdev features. Turn TCP
* segmentation offload on or off. Returns a negative error code or zero.
* @self_test: Run specified self-tests
* @get_strings: Return a set of strings that describe the requested objects
* @set_phys_id: Identify the physical devices, e.g. by flashing an LED
Expand All @@ -844,15 +812,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
* negative error code or zero.
* @complete: Function to be called after any other operation except
* @begin. Will be called even if the other operation failed.
* @get_ufo: Deprecated as redundant. Report whether UDP fragmentation
* offload is enabled.
* @set_ufo: Deprecated in favour of generic netdev features. Turn UDP
* fragmentation offload on or off. Returns a negative error code or zero.
* @get_flags: Deprecated as redundant. Report features included in
* &enum ethtool_flags that are enabled.
* @set_flags: Deprecated in favour of generic netdev features. Turn
* features included in &enum ethtool_flags on or off. Returns a
* negative error code or zero.
* @get_priv_flags: Report driver-specific feature flags.
* @set_priv_flags: Set driver-specific feature flags. Returns a negative
* error code or zero.
Expand Down Expand Up @@ -917,25 +876,13 @@ struct ethtool_ops {
struct ethtool_pauseparam*);
int (*set_pauseparam)(struct net_device *,
struct ethtool_pauseparam*);
u32 (*get_rx_csum)(struct net_device *);
int (*set_rx_csum)(struct net_device *, u32);
u32 (*get_tx_csum)(struct net_device *);
int (*set_tx_csum)(struct net_device *, u32);
u32 (*get_sg)(struct net_device *);
int (*set_sg)(struct net_device *, u32);
u32 (*get_tso)(struct net_device *);
int (*set_tso)(struct net_device *, u32);
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);
void (*get_ethtool_stats)(struct net_device *,
struct ethtool_stats *, u64 *);
int (*begin)(struct net_device *);
void (*complete)(struct net_device *);
u32 (*get_ufo)(struct net_device *);
int (*set_ufo)(struct net_device *, u32);
u32 (*get_flags)(struct net_device *);
int (*set_flags)(struct net_device *, u32);
u32 (*get_priv_flags)(struct net_device *);
int (*set_priv_flags)(struct net_device *, u32);
int (*get_sset_count)(struct net_device *, int);
Expand Down
16 changes: 0 additions & 16 deletions include/linux/netdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -2592,22 +2592,6 @@ static inline int netif_is_bond_slave(struct net_device *dev)

extern struct pernet_operations __net_initdata loopback_net_ops;

static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
{
if (dev->features & NETIF_F_RXCSUM)
return 1;
if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
return 0;
return dev->ethtool_ops->get_rx_csum(dev);
}

static inline u32 dev_ethtool_get_flags(struct net_device *dev)
{
if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
return 0;
return dev->ethtool_ops->get_flags(dev);
}

/* Logging, debugging and troubleshooting/diagnostic helpers. */

/* netdev_printk helpers, similar to dev_printk */
Expand Down
6 changes: 2 additions & 4 deletions net/8021q/vlan_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,11 @@ static u32 vlan_dev_fix_features(struct net_device *dev, u32 features)
struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
u32 old_features = features;

features &= real_dev->features;
features &= real_dev->vlan_features;
features |= NETIF_F_RXCSUM;
features &= real_dev->features;

features |= old_features & NETIF_F_SOFT_FEATURES;

if (dev_ethtool_get_rx_csum(real_dev))
features |= NETIF_F_RXCSUM;
features |= NETIF_F_LLTX;

return features;
Expand Down
12 changes: 2 additions & 10 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,24 +1321,16 @@ EXPORT_SYMBOL(dev_close);
*/
void dev_disable_lro(struct net_device *dev)
{
u32 flags;

/*
* If we're trying to disable lro on a vlan device
* use the underlying physical device instead
*/
if (is_vlan_dev(dev))
dev = vlan_dev_real_dev(dev);

if (dev->ethtool_ops && dev->ethtool_ops->get_flags)
flags = dev->ethtool_ops->get_flags(dev);
else
flags = ethtool_op_get_flags(dev);

if (!(flags & ETH_FLAG_LRO))
return;
dev->wanted_features &= ~NETIF_F_LRO;
netdev_update_features(dev);

__ethtool_set_flags(dev, flags & ~ETH_FLAG_LRO);
if (unlikely(dev->features & NETIF_F_LRO))
netdev_WARN(dev, "failed to disable LRO!\n");
}
Expand Down
Loading

0 comments on commit bc5787c

Please sign in to comment.