diff options
author | David S. Miller <davem@davemloft.net> | 2020-02-29 21:48:55 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-29 21:48:55 -0800 |
commit | de30181093891d1735a700e7c628d0135f53ed35 (patch) | |
tree | 7ca50d57eb4d305a193132f5526025e12141e903 /include/linux/ethtool.h | |
parent | 68e2c37690b0da7539cfa2928bf1e4f50d88a1bb (diff) | |
parent | 9aedc6e2f1c6708120b80748556fb6ad0567d15d (diff) |
Merge branch 'net-ethtool-Introduce-link_ksettings-API-for-virtual-network-devices'
Cris Forno says:
====================
net/ethtool: Introduce link_ksettings API for virtual network devices
This series provides an API for drivers of virtual network devices that
allows users to alter initial device speed and duplex settings to reflect
the actual capabilities of underlying hardware. The changes made include
a helper function ethtool_virtdev_set_link_ksettings, which is used to
retrieve alterable link settings. In addition, there is a new ethtool
function defined to validate those settings. These changes resolve code
duplication for existing virtual network drivers that have already
implemented this behavior. In the case of the ibmveth driver, this API is
used to provide this capability for the first time.
---
v7: - removed ethtool_validate_cmd function pointer parameter from
ethtool_virtdev_set_link_ksettings since none of the virtual drivers
pass in a custom validate function as suggested by Michal Kubecek.
v6: - removed netvsc_validate_ethtool_ss_cmd(). netvsc_drv now uses
ethtool_virtdev_validate_cmd() instead as suggested by Michal Kubecek
and approved by Haiyang Zhang.
- matched handler argument name of ethtool_virtdev_set_link_ksettings
in declaration and definition as suggested by Michal Kubecek.
- shortened validate variable assignment in
ethtool_virtdev_set_link_ksettings as suggested by Michal Kubecek.
v5: - virtdev_validate_link_ksettings is taken out of the ethtool global
structure and is instead added as an argument to
ethtool_virtdev_set_link_ksettings as suggested by Jakub Kicinski.
v4: - Cleaned up return statement in ethtool_virtdev_validate_cmd based
off of Michal Kubecek's and Thomas Falcon's suggestion.
- If the netvsc driver is using the VF device in order to get
accelerated networking, the real speed and duplex is reported by using
the VF device as suggested by Stephen Hemminger.
- The speed and duplex variables are now passed by value rather than
passed by pointer as suggested by Willem de Bruijin and Michal
Kubecek.
- Removed ethtool_virtdev_get_link_ksettings since it was too simple
to warrant a helper function.
v3: - Factored out duplicated code to core/ethtool to provide API to
virtual drivers
v2: - Updated default driver speed/duplex settings to avoid breaking
existing setups
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r-- | include/linux/ethtool.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 95991e4300bf..23373978cb3c 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -420,4 +420,10 @@ struct ethtool_rx_flow_rule * ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input); void ethtool_rx_flow_rule_destroy(struct ethtool_rx_flow_rule *rule); +bool ethtool_virtdev_validate_cmd(const struct ethtool_link_ksettings *cmd); +int ethtool_virtdev_set_link_ksettings(struct net_device *dev, + const struct ethtool_link_ksettings *cmd, + u32 *dev_speed, u8 *dev_duplex); + + #endif /* _LINUX_ETHTOOL_H */ |