Skip to content

Commit deded2b

Browse files
ordexNipaLocal
authored andcommitted
ovpn: add basic ethtool support
Implement support for basic ethtool functionality. Note that ovpn is a virtual device driver, therefore various ethtool APIs are just not meaningful and thus not implemented. Signed-off-by: Antonio Quartulli <antonio@openvpn.net> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: NipaLocal <nipa@local>
1 parent a89b97d commit deded2b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/net/ovpn/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* James Yonan <james@openvpn.net>
88
*/
99

10+
#include <linux/ethtool.h>
1011
#include <linux/genetlink.h>
1112
#include <linux/module.h>
1213
#include <linux/netdevice.h>
@@ -120,6 +121,19 @@ bool ovpn_dev_is_valid(const struct net_device *dev)
120121
return dev->netdev_ops == &ovpn_netdev_ops;
121122
}
122123

124+
static void ovpn_get_drvinfo(struct net_device *dev,
125+
struct ethtool_drvinfo *info)
126+
{
127+
strscpy(info->driver, "ovpn", sizeof(info->driver));
128+
strscpy(info->bus_info, "ovpn", sizeof(info->bus_info));
129+
}
130+
131+
static const struct ethtool_ops ovpn_ethtool_ops = {
132+
.get_drvinfo = ovpn_get_drvinfo,
133+
.get_link = ethtool_op_get_link,
134+
.get_ts_info = ethtool_op_get_ts_info,
135+
};
136+
123137
static void ovpn_setup(struct net_device *dev)
124138
{
125139
netdev_features_t feat = NETIF_F_SG | NETIF_F_GSO |
@@ -129,6 +143,7 @@ static void ovpn_setup(struct net_device *dev)
129143

130144
dev->pcpu_stat_type = NETDEV_PCPU_STAT_DSTATS;
131145

146+
dev->ethtool_ops = &ovpn_ethtool_ops;
132147
dev->netdev_ops = &ovpn_netdev_ops;
133148

134149
dev->priv_destructor = ovpn_priv_free;

0 commit comments

Comments
 (0)