Bug 13589 - usbnet and /proc/net/dev stats
Summary: usbnet and /proc/net/dev stats
Status: CLOSED OBSOLETE
Alias: None
Product: Networking
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-20 16:24 UTC by Ben Kibbey
Modified: 2012-06-08 15:40 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.30
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Ben Kibbey 2009-06-20 16:24:12 UTC
Commit 805aaa29fa breaks device statistics with the usbnet module. Reverting this commit fixes it. I think usbnet needed this callback to lookup the dev so it could update .stats.

Also, I do have CONFIG_COMPAT_NET_DEV_OPS defined and am using usbnet with cdc_ether and zaurus.

Thanks
Comment 1 Ben Kibbey 2009-06-20 16:28:18 UTC
Actually reverting the commit didn't fix it. Adding the following to 
usbnet_netdev_ops works:

	.ndo_get_stats		= usbnet_get_stats,
Comment 2 Alan 2009-06-29 11:30:15 UTC
Ben can you send that as a patch with Signed-off-by: line to the linux-kernel@vger.kernel.org mailing list (don't need to be subscribed) that way you'll get the due credit. If not I can just submit a fix anyway
Comment 3 Ben Kibbey 2009-06-29 23:47:15 UTC
I'm not sure how the patch was applied, but the notice I got from lkml about the patch being accepted looked like it wouldn't work. Commit 805aaa29fa needed to be reverted and modified to add the mentioned line to usbnet_netdev_opts. I didn't see any usbnet_get_stats in the lkml patch. But like I said, I'm not sure how it was applied.

As far as creating a a Signed-off-by: line, I'd rather you just submit the fix.

Thanks
Comment 4 Andrew Morton 2009-06-30 00:24:12 UTC
(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Sat, 20 Jun 2009 16:24:13 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=13589
> 
>            Summary: usbnet and /proc/net/dev stats
>            Product: Networking
>            Version: 2.5
>     Kernel Version: 2.6.30
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Other
>         AssignedTo: acme@ghostprotocols.net
>         ReportedBy: bjk@luxsci.net
>         Regression: No
> 
> 
> Commit 805aaa29fa breaks device statistics with the usbnet module. Reverting
> this commit fixes it. I think usbnet needed this callback to lookup the dev
> so
> it could update .stats.
> 
> Also, I do have CONFIG_COMPAT_NET_DEV_OPS defined and am using usbnet with
> cdc_ether and zaurus.
> 

This has turned into a bit of a mess, as the fix which I typed in needs
the revert of another patch, and I don't know what actually went wrong
with usbnet stats anyway.

Could someone (Stephen?) please take a look?

As it appears to be a 2.6.29->2.6.30 regression, please remember to cc
stable@kernel.org on any fixes, thanks.
Comment 5 Ben Kibbey 2009-06-30 00:45:20 UTC
On Mon, Jun 29, 2009 at 05:23:41PM -0700, Andrew Morton wrote:

All usbnet stats weren't getting updated (ifconfig, was always showing 0).
When applied to 2.6.30 this fixes it. Commit 805aaa29fa was the culprit and
reverting it re-adds usbnet_get_stats() but needed to be modified to add whats
in usbnet_netdev_ops:

--- /tmp/usbnet.c	2009-06-29 20:35:59.000000000 -0400
+++ usbnet.c	2009-06-20 11:40:41.000000000 -0400
@@ -1106,9 +1106,16 @@
 }
 EXPORT_SYMBOL_GPL(usbnet_disconnect);
 
+static struct net_device_stats *usbnet_get_stats (struct net_device *net)
+{
+       struct usbnet   *dev = netdev_priv(net);
+       return &dev->stats;
+}
+
 static const struct net_device_ops usbnet_netdev_ops = {
 	.ndo_open		= usbnet_open,
 	.ndo_stop		= usbnet_stop,
+	.ndo_get_stats		= usbnet_get_stats,
 	.ndo_start_xmit		= usbnet_start_xmit,
 	.ndo_tx_timeout		= usbnet_tx_timeout,
 	.ndo_change_mtu		= usbnet_change_mtu,

Note You need to log in before you can comment on or make changes to this bug.