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 64B39A046B for ; Mon, 24 Jun 2019 18:48:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 03BD21BD6C; Mon, 24 Jun 2019 18:47:51 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id A3AF81BD23 for ; Mon, 24 Jun 2019 18:47:31 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id m30so7835661pff.8 for ; Mon, 24 Jun 2019 09:47:31 -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=fPhniSRUf6Anabigzq+g/BzAVXFwhkiwU8OTBvwmsGLZ9UPCnmaSyGNksrQGNbguKB Zr86Kbcdv3tYJ5pXf6GipvHWNbbyF2mv8weZfIEg2EWEsmZVknm/RcRKajnZO1UtxPuz murDXt/HzqIuDwmVCDSSwWKn+6Y9COIwS52s8/kXzXRB2VTk8J/hQmzDBtlfCV3JTQ8o FMfF+hTJZe2HkrK8KXmQbuOwCZQzIP8vv29HyN2dUdPitEAzqsMokZPV0c5PrAy2asD1 gX/BalHlcdnY1k0oZm0Rhd2WaupRV7tyhzFdBxK3unL+R+jMGKwJiShBW/cplrkek/IY RaYg== 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=D3wNN7hajzDthG+/QutiVvgSpzxR2rQGS1xdfhq9xUpXQSp2sjtG3YbcJRjMNFwiLb UwcOY1vrqLNTeQD61SbR+V1vlI2P28FGkiDrgtOttgwGkICLdq3wCXsx68uLZ7OZSJCc NQ8/sfe5G8JFCE3c7roqnT9gem9ekaJfy/R5rddEMh5OxVQK40VQ+Oan+NCTzwMxKJ+3 VxMfZ86/yXHLptSVY7V6rQIg4dwCPHAftm8je3ElNrYnPzSlHOHLlrgbCNaflQogsy30 P37mXRDhfJCxTrGDyVQ+E965AdeTXaBhfkcHZVmcf7qojWSivtcZp8Sfo5mBLoCLhZeK lonQ== X-Gm-Message-State: APjAAAVJ3+xcnFvYUwhlWLNPTCZxML/74Hxx3LtEK2AKnEkqn3vPBlwG osgiFwXOIWG8OV85t9tk6tMTqvBeWWI= X-Google-Smtp-Source: APXvYqxwBJ+oFKcpFd5nodOcz/azcBTUn8jWHd+b7a3EVUtvoPjrn6B7L8wwiYJ8i9mT364akOsrow== X-Received: by 2002:a17:90a:aa0a:: with SMTP id k10mr26537013pjq.43.1561394850639; Mon, 24 Jun 2019 09:47:30 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id f7sm12814023pfd.43.2019.06.24.09.47.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 24 Jun 2019 09:47:29 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 24 Jun 2019 09:47:13 -0700 Message-Id: <20190624164714.6560-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190624164714.6560-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190624164714.6560-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 8/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