From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 21B46A0471 for ; Thu, 20 Jun 2019 21:22:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ADDD71D4AF; Thu, 20 Jun 2019 21:21:25 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 72EE41D473 for ; Thu, 20 Jun 2019 21:21:09 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id p10so2092650pgn.1 for ; Thu, 20 Jun 2019 12:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VHA65NftE/bw5p/GVwIeWgkJKcWI3PGvUBPGSt32qbc=; b=mCjrPyRF6FmlFR3wtvJ7+VC8lJL/Ex60V3J1V8h8nPMC3ZM3vzbgOxJGQ54b83nJa4 dYiWXdWSXip3ttV6lDNvRbj+4m+odVKSLZ8Fjvlrg4UMqDE8D7mgZ5rv7yH0GspB3WCE LGPs9OoC8FTFHWnFxJMyRmVfsqJrOZ0fc5zzOA6RXYCrDxraZ8tnPSx5U+z9ZEcbo1xi wE0XdTNHBfwiB78h23QOHCg84Fa3yOCKvsK5j1mJBYczcIOh2rXEcErzrO+xTEjH6QRW D9Q5kew0YJipTaZPqd8j6hv8To6P6YQKFyZJ6gTqmG7uV9k9ZUOwNh8gyzsQ/NZ2C3tR jDeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VHA65NftE/bw5p/GVwIeWgkJKcWI3PGvUBPGSt32qbc=; b=QIlA2oefJHJ8f5oPK0OQ5uDGDv13DOus2tEDdB88IQufv4BRk41p0HQ5SDUurjN+bY mwN6V+ihDeZo025/nvNIFPh/NVCGkLjMiBm7gwaSVrko7UO9XXOXGU1Rehk4JocsT+t4 Ua+Nmcis4kOPYssVXuY+obhNpd7kz8LPvb3QtySDXtcyhJCsu8rYUQsjo+BoFpm1aHmd TwsBJbMVs12sP9drK0UW5kuOyoITfhVba3vqwteJ6OUtF2BJrs8v06inK+x0zy9tqaSf z793SOy1I7dV6wb/lYP8tr1iIvrR0Es64EBx6cmXelsWvw4ySoiLAul1WpgdvcprDRpC 7o4w== X-Gm-Message-State: APjAAAUMaSU7ls4A4u4HFimrIEKGJopK/tJmuB8lwl2eLyppWfuB+tMd ajmefTXtyGGFBKwB/WVEAuAxdTRVmmY= X-Google-Smtp-Source: APXvYqwR63gaOpIUYxDeOa4jq4u8GEgvUi31i9qmRCy+cqUQkoimKxyPeo/7sF9JKAQCmmJROQSDyQ== X-Received: by 2002:a17:90a:214f:: with SMTP id a73mr1256261pje.21.1561058468421; Thu, 20 Jun 2019 12:21:08 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j11sm255703pfa.2.2019.06.20.12.21.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 12:21:07 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 20 Jun 2019 12:20:48 -0700 Message-Id: <20190620192048.13814-10-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620192048.13814-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190620192048.13814-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 9/9] kni: add minimal ethtool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some applications use ethtool so add the minimum ethtool ops. Signed-off-by: Stephen Hemminger --- kernel/linux/kni/kni_dev.h | 2 ++ kernel/linux/kni/kni_misc.c | 1 + kernel/linux/kni/kni_net.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h index ceba5f73c1d9..c1ca6789ce12 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 be45f823408f..2b75502a8b0e 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 320d51d7fc83..319ee2dcb19a 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; } -- 2.20.1