From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06528A0547; Thu, 26 Aug 2021 17:19:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C054341230; Thu, 26 Aug 2021 17:19:17 +0200 (CEST) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by mails.dpdk.org (Postfix) with ESMTP id A8DCF41228 for ; Thu, 26 Aug 2021 17:19:14 +0200 (CEST) Received: by mail-lf1-f50.google.com with SMTP id g13so7562630lfj.12 for ; Thu, 26 Aug 2021 08:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nfware.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3jIgzZ3EmW1KrgVIAZtGVe/ZLyx6LOQM39qunOg+d2g=; b=Tu2+1j7tcalZjb49+C/9keGfbqs+8yojDv8cFG8yQP9EcxUyhv6wvXWKaVa8iKUReW bhjd6n9+PWrn7KCQ7ofmGhWToZ4UyfnLEWwS9oU0fTArtBAIm5JeVrUeGxQJjC7/jiPc 7WJYUpH9IfuSKD7Ls4XjlfCyPPc3Vtnm0iyXt5JvcWYVKsHPVqEM/zGiWhVIBiqY2yLC N+qWprF1IP2cvp7VLW5rpE6zFWBEFclYwQknbPPj3rFD66Wug5WMiOAovGytY7K4uehf mhheIIf673kOtJT9RcRDB+eqLM8gEhjTXAzqei+fKvjoqUvkFz+ajzil+VX/dYreJDkB btOQ== 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=3jIgzZ3EmW1KrgVIAZtGVe/ZLyx6LOQM39qunOg+d2g=; b=d1fL/xfI3wHUJ52MKhW6Gy//AOPm9QIG8edIMwAtpY2EqxsDoYTMmfx7nHpR4a90jZ e6LW2moT3+5Gr+DWVnQ6AUtn5khqeVGiWmYydBrk8PHHckSbTQmhA+Gh4NTxDcetBFL9 w/Umg8NiNyKvPCw0ALxcNt7LagZpCgq6XMnsa6MpJXbEi5UbJ7hM9e//MXV1dT5L88Ba +G68Cxg876hkRScaqbyNIxnlZzwYEBvLJ1eMQgr3ruvOLMFfxhnbvJw6VJKJSLnlsnGI biZ1JLt+adaYlMli0jxdS3uZ89SDFsdfXomh+DOdOII6rTsW5tJ6gLxJ1N5Cl+k0rdYU LEvQ== X-Gm-Message-State: AOAM5303+/DMsGswfLfi85sEiUPVr4Rjgf0+Fop52+ZcSQjPhOsbzZ9r GqSCTbZaTjTI8jmGKHqWj75Pbgu1EiSFJg== X-Google-Smtp-Source: ABdhPJyR+LECVNlDtNLszYU0drLQe8XhqlRCHA7Ss8kE996CvKiUSBMWWxyVhNHved4Y76HFykgTRQ== X-Received: by 2002:a05:6512:1695:: with SMTP id bu21mr3199017lfb.506.1629991153948; Thu, 26 Aug 2021 08:19:13 -0700 (PDT) Received: from localhost.localdomain ([212.48.63.198]) by smtp.gmail.com with ESMTPSA id z13sm377267lfu.0.2021.08.26.08.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 08:19:13 -0700 (PDT) From: Igor Ryzhov To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 26 Aug 2021 18:19:10 +0300 Message-Id: <20210826151911.15699-2-iryzhov@nfware.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210826151911.15699-1-iryzhov@nfware.com> References: <20210704160610.62682-1-iryzhov@nfware.com> <20210826151911.15699-1-iryzhov@nfware.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 2/3] kni: implement basic get_link_ksettings callback X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" It allows inspecting link parameters using ethtool. Signed-off-by: Igor Ryzhov --- kernel/linux/kni/kni_net.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c index 611719b5ee27..931b9daf104f 100644 --- a/kernel/linux/kni/kni_net.c +++ b/kernel/linux/kni/kni_net.c @@ -820,9 +820,34 @@ static void kni_get_drvinfo(struct net_device *dev, strlcpy(info->driver, "kni", sizeof(info->driver)); } +#ifdef ETHTOOL_GLINKSETTINGS +static int kni_get_link_ksettings(struct net_device *dev, + struct ethtool_link_ksettings *settings) +{ + struct kni_dev *kni = netdev_priv(dev); + + settings->base.port = PORT_OTHER; + + if (netif_carrier_ok(dev)) { + settings->base.speed = kni->speed; + settings->base.duplex = kni->duplex; + settings->base.autoneg = kni->autoneg; + } else { + settings->base.speed = SPEED_UNKNOWN; + settings->base.duplex = DUPLEX_UNKNOWN; + settings->base.autoneg = AUTONEG_ENABLE; + } + + return 0; +} +#endif + static const struct ethtool_ops kni_net_ethtool_ops = { .get_drvinfo = kni_get_drvinfo, .get_link = ethtool_op_get_link, +#ifdef ETHTOOL_GLINKSETTINGS + .get_link_ksettings = kni_get_link_ksettings, +#endif }; void -- 2.33.0