DPDK patches and discussions
 help / color / mirror / Atom feed
From: Igor Ryzhov <iryzhov@nfware.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v6 2/3] kni: implement basic get_link_ksettings callback
Date: Mon, 30 Aug 2021 17:27:30 +0300	[thread overview]
Message-ID: <20210830142731.32524-2-iryzhov@nfware.com> (raw)
In-Reply-To: <20210830142731.32524-1-iryzhov@nfware.com>

It allows inspecting link parameters using ethtool.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
---
 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


  reply	other threads:[~2021-08-30 14:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 19:25 [dpdk-dev] [PATCH] kni: rework rte_kni_update_link using ioctl Igor Ryzhov
2019-09-24 19:33 ` [dpdk-dev] [PATCH v2] " Igor Ryzhov
2019-09-24 20:37   ` Aaron Conole
2019-09-25  9:00     ` Igor Ryzhov
2019-09-25  9:36   ` [dpdk-dev] [PATCH v3] " Igor Ryzhov
2019-10-14 16:10     ` Ferruh Yigit
2019-10-14 16:17       ` Ferruh Yigit
2019-10-14 19:01         ` Dan Gora
2019-10-14 20:55           ` Dan Gora
2019-10-27 20:16             ` Igor Ryzhov
2021-06-28 12:55               ` Ferruh Yigit
2021-06-28 13:16                 ` Igor Ryzhov
2021-07-04 16:06   ` [dpdk-dev] [PATCH v4 1/2] " Igor Ryzhov
2021-07-04 16:06     ` [dpdk-dev] [PATCH v4 2/2] kni: implement basic get_link_ksettings callback Igor Ryzhov
2021-07-05 11:58     ` [dpdk-dev] [PATCH v4 1/2] kni: rework rte_kni_update_link using ioctl Ferruh Yigit
2021-07-06  9:14       ` Igor Ryzhov
2021-08-26 15:19     ` [dpdk-dev] [PATCH v5 1/3] " Igor Ryzhov
2021-08-26 15:19       ` [dpdk-dev] [PATCH v5 2/3] kni: implement basic get_link_ksettings callback Igor Ryzhov
2021-08-26 15:19       ` [dpdk-dev] [PATCH v5 3/3] app/test: fix return value of test_kni_link_change Igor Ryzhov
2021-08-26 17:15       ` [dpdk-dev] [PATCH v5 1/3] kni: rework rte_kni_update_link using ioctl Stephen Hemminger
2021-08-26 17:46         ` Igor Ryzhov
2021-08-26 18:06           ` Stephen Hemminger
2021-08-30 18:05             ` Igor Ryzhov
2021-08-30 14:27       ` [dpdk-dev] [PATCH v6 " Igor Ryzhov
2021-08-30 14:27         ` Igor Ryzhov [this message]
2021-08-30 14:27         ` [dpdk-dev] [PATCH v6 3/3] app/test: fix return value of test_kni_link_change Igor Ryzhov
2023-06-29 17:05         ` [dpdk-dev] [PATCH v6 1/3] kni: rework rte_kni_update_link using ioctl Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210830142731.32524-2-iryzhov@nfware.com \
    --to=iryzhov@nfware.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).