virtio_net: add ethtool support for set and get of settings
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Wed, 3 Feb 2016 03:04:37 +0000 (04:04 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Feb 2016 19:30:45 +0000 (14:30 -0500)
commit16032be56c1f66770da15cb94f0eb366c37aff6e
tree1e2505c493c436ad2caca684eedd8bcb50988027
parent103a8ad1fa3b261c78dfc842cb315defe9d40be0
virtio_net: add ethtool support for set and get of settings

This patch allows the user to set and retrieve speed and duplex of the
virtio_net device via ethtool. Having this functionality is very helpful
for simulating different environments and also enables the virtio_net
device to participate in operations where proper speed and duplex are
required (e.g. currently bonding lacp mode requires full duplex). Custom
speed and duplex are not allowed, the user-supplied settings are validated
before applying.

Example:
$ ethtool eth1
Settings for eth1:
...
Speed: Unknown!
Duplex: Unknown! (255)
$ ethtool -s eth1 speed 1000 duplex full
$ ethtool eth1
Settings for eth1:
...
Speed: 1000Mb/s
Duplex: Full

Based on a patch by Roopa Prabhu.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c