netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices
@ 2019-09-20 12:15 Konstantin Khlebnikov
  2019-09-22 22:21 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Khlebnikov @ 2019-09-20 12:15 UTC (permalink / raw)
  To: netdev, David S. Miller

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);
 	}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices
  2019-09-20 12:15 [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices Konstantin Khlebnikov
@ 2019-09-22 22:21 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-09-22 22:21 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: netdev, David S. Miller

On Fri, 20 Sep 2019 15:15:55 +0300, Konstantin Khlebnikov wrote:
> Device kind gives more information than only arbitrary device name.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

Hi Konstantin!

These look like nice improvements, unfortunately the net-next tree is
now closed [1], and will reopen some time after the merge window is
over. Hopefully you can gather feedback now, but I'm dropping the patch
from patchwork, and you'll have to resubmit once Dave opens net-next
again.

[1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html

Same goes for:
ipv6/addrconf: use netdev_info()/netdev_warn()/netdev_dbg() for logging

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-22 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 12:15 [PATCH] net/core/dev: print rtnl kind as driver name for virtual devices Konstantin Khlebnikov
2019-09-22 22:21 ` Jakub Kicinski

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).