Netdev List
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices
Date: Fri, 20 Sep 2019 15:15:55 +0300	[thread overview]
Message-ID: <156898175525.7362.16591901912362742168.stgit@buzz> (raw)

Device kind gives more information than only arbitrary device name.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 net/core/dev.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 71b18e80389f..c84561634afd 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9651,17 +9651,14 @@ static int __net_init netdev_init(struct net *net)
  */
 const char *netdev_drivername(const struct net_device *dev)
 {
-	const struct device_driver *driver;
 	const struct device *parent;
 	const char *empty = "";
 
 	parent = dev->dev.parent;
-	if (!parent)
-		return empty;
-
-	driver = parent->driver;
-	if (driver && driver->name)
-		return driver->name;
+	if (parent)
+		return dev_driver_string(parent);
+	if (dev->rtnl_link_ops)
+		return dev->rtnl_link_ops->kind;
 	return empty;
 }
 
@@ -9677,8 +9674,8 @@ static void __netdev_printk(const char *level, const struct net_device *dev,
 				netdev_name(dev), netdev_reg_state(dev),
 				vaf);
 	} else if (dev) {
-		printk("%s%s%s: %pV",
-		       level, netdev_name(dev), netdev_reg_state(dev), vaf);
+		printk("%s%s %s%s: %pV", level, netdev_drivername(dev),
+		       netdev_name(dev), netdev_reg_state(dev), vaf);
 	} else {
 		printk("%s(NULL net_device): %pV", level, vaf);
 	}


             reply	other threads:[~2019-09-20 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 12:15 Konstantin Khlebnikov [this message]
2019-09-22 22:21 ` [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices Jakub Kicinski

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=156898175525.7362.16591901912362742168.stgit@buzz \
    --to=khlebnikov@yandex-team.ru \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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