All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/core: use netdev name in warning if no parent
@ 2015-11-16 18:16 Bjørn Mork
  2015-11-16 21:22 ` David Miller
  2015-11-17  9:44 ` David Laight
  0 siblings, 2 replies; 3+ messages in thread
From: Bjørn Mork @ 2015-11-16 18:16 UTC (permalink / raw)
  To: netdev; +Cc: Bjørn Mork

A recent flaw in the netdev feature setting resulted in warnings
like this one from VLAN interfaces:

 WARNING: CPU: 1 PID: 4975 at net/core/dev.c:2419 skb_warn_bad_offload+0xbc/0xcb()
 : caps=(0x00000000001b5820, 0x00000000001b5829) len=2782 data_len=0 gso_size=1348 gso_type=16 ip_summed=3

The ":" is supposed to be preceded by a driver name, but in this
case it is an empty string since the device has no parent.

There are many types of network devices without a parent. The
anonymous warnings for these devices can be hard to debug.  Log
the network device name instead in these cases to assist further
debugging.

This is mostly similar to how __netdev_printk() handles orphan
devices.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 net/core/dev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index ab9b8d0d115e..4dbf7ae6f8b5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2403,17 +2403,20 @@ static void skb_warn_bad_offload(const struct sk_buff *skb)
 {
 	static const netdev_features_t null_features = 0;
 	struct net_device *dev = skb->dev;
-	const char *driver = "";
+	const char *name = "";
 
 	if (!net_ratelimit())
 		return;
 
-	if (dev && dev->dev.parent)
-		driver = dev_driver_string(dev->dev.parent);
-
+	if (dev) {
+		if (dev->dev.parent)
+			name = dev_driver_string(dev->dev.parent);
+		else
+			name = netdev_name(dev);
+	}
 	WARN(1, "%s: caps=(%pNF, %pNF) len=%d data_len=%d gso_size=%d "
 	     "gso_type=%d ip_summed=%d\n",
-	     driver, dev ? &dev->features : &null_features,
+	     name, dev ? &dev->features : &null_features,
 	     skb->sk ? &skb->sk->sk_route_caps : &null_features,
 	     skb->len, skb->data_len, skb_shinfo(skb)->gso_size,
 	     skb_shinfo(skb)->gso_type, skb->ip_summed);
-- 
2.1.4

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

* Re: [PATCH] net/core: use netdev name in warning if no parent
  2015-11-16 18:16 [PATCH] net/core: use netdev name in warning if no parent Bjørn Mork
@ 2015-11-16 21:22 ` David Miller
  2015-11-17  9:44 ` David Laight
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-11-16 21:22 UTC (permalink / raw)
  To: bjorn; +Cc: netdev

From: Bjørn Mork <bjorn@mork.no>
Date: Mon, 16 Nov 2015 19:16:40 +0100

> A recent flaw in the netdev feature setting resulted in warnings
> like this one from VLAN interfaces:
> 
>  WARNING: CPU: 1 PID: 4975 at net/core/dev.c:2419 skb_warn_bad_offload+0xbc/0xcb()
>  : caps=(0x00000000001b5820, 0x00000000001b5829) len=2782 data_len=0 gso_size=1348 gso_type=16 ip_summed=3
> 
> The ":" is supposed to be preceded by a driver name, but in this
> case it is an empty string since the device has no parent.
> 
> There are many types of network devices without a parent. The
> anonymous warnings for these devices can be hard to debug.  Log
> the network device name instead in these cases to assist further
> debugging.
> 
> This is mostly similar to how __netdev_printk() handles orphan
> devices.
> 
> Signed-off-by: Bjørn Mork <bjorn@mork.no>

Yeah that seems reasonable, applied, thanks!

I wonder if we open-code this in a lot of other places, and
therefore this deserves a helper and some auditing.

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

* RE: [PATCH] net/core: use netdev name in warning if no parent
  2015-11-16 18:16 [PATCH] net/core: use netdev name in warning if no parent Bjørn Mork
  2015-11-16 21:22 ` David Miller
@ 2015-11-17  9:44 ` David Laight
  1 sibling, 0 replies; 3+ messages in thread
From: David Laight @ 2015-11-17  9:44 UTC (permalink / raw)
  To: 'Bjørn Mork', netdev

From: Bjørn Mork
> Sent: 16 November 2015 18:17
> A recent flaw in the netdev feature setting resulted in warnings
> like this one from VLAN interfaces:
> 
>  WARNING: CPU: 1 PID: 4975 at net/core/dev.c:2419 skb_warn_bad_offload+0xbc/0xcb()
>  : caps=(0x00000000001b5820, 0x00000000001b5829) len=2782 data_len=0 gso_size=1348 gso_type=16
> ip_summed=3
> 
> The ":" is supposed to be preceded by a driver name, but in this
> case it is an empty string since the device has no parent.
...

There'll also be no name if skb->dev is NULL.
There may not be anything interesting to print instead, but something
other than "" would be more useful.

	David



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

end of thread, other threads:[~2015-11-17  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 18:16 [PATCH] net/core: use netdev name in warning if no parent Bjørn Mork
2015-11-16 21:22 ` David Miller
2015-11-17  9:44 ` David Laight

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.