kni: support minimal ethtool
Some applications use ethtool so add the minimum ethtool ops. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
dbb69b7b64
commit
398d6f94d3
@ -11,6 +11,8 @@
|
||||
#endif
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#define KNI_VERSION "1.0"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#include <linux/if.h>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "compat.h"
|
||||
#include "kni_dev.h"
|
||||
|
||||
MODULE_VERSION(KNI_VERSION);
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_AUTHOR("Intel Corporation");
|
||||
MODULE_DESCRIPTION("Kernel Module for managing kni devices");
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/version.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h> /* eth_type_trans */
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/delay.h>
|
||||
@ -725,6 +726,18 @@ static const struct net_device_ops kni_net_netdev_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static void kni_get_drvinfo(struct net_device *dev,
|
||||
struct ethtool_drvinfo *info)
|
||||
{
|
||||
strlcpy(info->version, KNI_VERSION, sizeof(info->version));
|
||||
strlcpy(info->driver, "kni", sizeof(info->driver));
|
||||
}
|
||||
|
||||
static const struct ethtool_ops kni_net_ethtool_ops = {
|
||||
.get_drvinfo = kni_get_drvinfo,
|
||||
.get_link = ethtool_op_get_link,
|
||||
};
|
||||
|
||||
void
|
||||
kni_net_init(struct net_device *dev)
|
||||
{
|
||||
@ -736,6 +749,7 @@ kni_net_init(struct net_device *dev)
|
||||
ether_setup(dev); /* assign some of the fields */
|
||||
dev->netdev_ops = &kni_net_netdev_ops;
|
||||
dev->header_ops = &kni_net_header_ops;
|
||||
dev->ethtool_ops = &kni_net_ethtool_ops;
|
||||
dev->watchdog_timeo = WD_TIMEOUT;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user