From: Stephen Hemminger Date: Mon, 24 Jun 2019 16:47:13 +0000 (-0700) Subject: kni: support minimal ethtool X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=398d6f94d3fc41d0b96e7cca9ab95be3d0cbfe4c;p=dpdk.git kni: support minimal ethtool Some applications use ethtool so add the minimum ethtool ops. Signed-off-by: Stephen Hemminger Acked-by: Ferruh Yigit --- diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h index ceba5f73c1..c1ca6789ce 100644 --- a/kernel/linux/kni/kni_dev.h +++ b/kernel/linux/kni/kni_dev.h @@ -11,6 +11,8 @@ #endif #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#define KNI_VERSION "1.0" + #include "compat.h" #include diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c index be45f82340..2b75502a8b 100644 --- a/kernel/linux/kni/kni_misc.c +++ b/kernel/linux/kni/kni_misc.c @@ -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"); diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 320d51d7fc..319ee2dcb1 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -13,6 +13,7 @@ #include #include #include /* eth_type_trans */ +#include #include #include #include @@ -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; }