public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: m.nazarewicz@samsung.com
Cc: dbrownell@users.sourceforge.net, gregkh@suse.de,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	eric.dumazet@gmail.com
Subject: Re: [PATCH] usb: gadget: rndis: don't use dev_get_stats()
Date: Mon, 20 Sep 2010 11:27:27 -0700 (PDT)	[thread overview]
Message-ID: <20100920.112727.214208208.davem@davemloft.net> (raw)
In-Reply-To: <bdd595ff5a45c008254da0a0c4322b6e7b699cf2.1285006511.git.m.nazarewicz@samsung.com>

From: Michal Nazarewicz <m.nazarewicz@samsung.com>
Date: Mon, 20 Sep 2010 20:23:04 +0200

> This commit removes the call to dev_get_stats() from the
> gen_ndis_query_resp() function.  Since spin_lock_bh() was
> added to dev_txq_stats_fold() the call started causing
> warnings.  This is because gen_ndis_query_resp() can be
> (indirectly) called from rndis_command_complete() which is
> called with interrupts disabled.
> 
> While at it, this commit also changes the
> gen_ndis_query_resp() function so that "net" local variable is
> used instead of "rndis_per_dev_params[configNr].dev" in all
> places this is referenced.
> 
> Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>

The way this works is dev_get_stats() takes that "temp" object the
caller provides, it writes the correct statistics into it (with any
necessary translations), and then passes back a pointer to it.

See net/core/dev.c:dev_get_stats()

You must use dev_get_stats() or else the statistics won't be properly
converted.

Like I originally suggested, you need to rearrange the code in this
driver such that the gen_ndis_query_resp() work happens in a tasklet,
workqueue, or some other non-hardware-irq context.

  reply	other threads:[~2010-09-20 18:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20 18:23 [PATCH] usb: gadget: rndis: don't use dev_get_stats() Michal Nazarewicz
2010-09-20 18:27 ` David Miller [this message]
2010-09-20 18:48   ` Eric Dumazet
2010-09-20 19:00     ` Michał Nazarewicz
2010-09-20 18:58   ` Michał Nazarewicz

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=20100920.112727.214208208.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=eric.dumazet@gmail.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.nazarewicz@samsung.com \
    /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