From: Oliver Neukum <oliver@neukum.org>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>,
netdev@vger.kernel.org,
ct-linux-kernel <linux-kernel@codethink.co.uk>,
linux-usb@vger.kernel.org,
Sami Farin <hvtaifwkbgefbaei@gmail.com>,
Aleksander Morgado <aleksander@aleksander.es>
Subject: Re: [RFC][PATCH] usbnet: Fix tx_bytes statistic running backward in cdc_ncm
Date: Fri, 27 Feb 2015 10:17:59 +0100 [thread overview]
Message-ID: <1425028679.12236.6.camel@linux-0dmf.site> (raw)
In-Reply-To: <87h9u73eh0.fsf@nemi.mork.no>
On Fri, 2015-02-27 at 10:12 +0100, Bjørn Mork wrote:
> Ben Hutchings <ben.hutchings@codethink.co.uk> writes:
>
> > cdc_ncm disagrees with usbnet about how much framing overhead should
> > be counted in the tx_bytes statistics, and tries 'fix' this by
> > decrementing tx_bytes on the transmit path. But statistics must never
> > be decremented except due to roll-over; this will thoroughly confuse
> > user-space. Also, tx_bytes is only incremented by usbnet in the
> > completion path.
> >
> > Fix this by requiring drivers that set FLAG_MULTI_FRAME to set a
> > tx_bytes delta along with the tx_packets count.
> >
> > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
> > ---
> > I noticed this bug while trying to fix the tx_packets statistic in asix.
> > It depends on the patch I just sent for that. I don't have any hardware
> > to test this with, or any need to make it work. If you want this fix,
> > please test and re-submit it yoursef.
>
> I tested this on an MBIM device, and it worked perfectly as-is. Please
> submit it without the RFC prefix. This fixes a real and reported
> problem with the cdc_ncm driver, so I'd claim it's "net" material along
> with a stable Cc and
>
> Fixes: beeecd42c3b4 ("net: cdc_ncm/cdc_mbim: adding NCM protocol statistics")
>
> But you and David decide that, of course...
>
>
> Fixing this was actually on my TODO-list after a recent report showing
> one of the problems with the previous hack: The decremented tx_bytes
> counter was never corrected if the URB transmission failed, possibly
> ending up with a negative (i.e. very large since it is unsigned)
> tx_bytes counter.
>
> Thanks a lot. I didn't know how to do this without introducing a new
> callback or something. Your solutions is very nice, and so obvious when
> I see it. Just brilliant :-)
>
> Tested-by: Bjørn Mork <bjorn@mork.no>
>
> And you might also want (if this is OK for Sami):
>
> Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
Acked-by: Oliver Neukum <oliver@neukum.org>
prev parent reply other threads:[~2015-02-27 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 19:43 [RFC][PATCH] usbnet: Fix tx_bytes statistic running backward in cdc_ncm Ben Hutchings
2015-02-27 9:12 ` Bjørn Mork
2015-02-27 9:17 ` Oliver Neukum [this message]
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=1425028679.12236.6.camel@linux-0dmf.site \
--to=oliver@neukum.org \
--cc=aleksander@aleksander.es \
--cc=ben.hutchings@codethink.co.uk \
--cc=bjorn@mork.no \
--cc=hvtaifwkbgefbaei@gmail.com \
--cc=linux-kernel@codethink.co.uk \
--cc=linux-usb@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).