public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public•gmane.org>
To: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public•gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public•gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public•gmane.org>,
	Oliver Neukum <oneukum-l3A5Bk7waGM@public•gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: Re: [PATCH -v1 3/3] usbnet: handle remote wakeup asap
Date: Wed, 20 Jun 2012 15:02:12 +0400	[thread overview]
Message-ID: <4FE1ADB4.4060302@mvista.com> (raw)
In-Reply-To: <1340176553-32225-4-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Hello.

On 20-06-2012 11:15, Ming Lei wrote:

> If usbnet is resumed by remote wakeup, generally there are
> some packets comming to be handled, so allocate and submit
> rx URBs in usbnet_resume to avoid delays introduced by tasklet.
> Otherwise, usbnet may have been runtime suspended before the
> usbnet_bh is executed to schedule Rx URBs.

> Without the patch, usbnet can't recieve any packets from peer
> in runtime suspend state if runtime PM is enabled and
> autosuspend_delay is set as zero.

> Signed-off-by: Ming Lei<ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public•gmane.org>
> ---
>   drivers/net/usb/usbnet.c |   42 ++++++++++++++++++++++++++----------------
>   1 file changed, 26 insertions(+), 16 deletions(-)

> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 9bfa775..a89d6c5 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1201,6 +1201,21 @@ deferred:
>   }
>   EXPORT_SYMBOL_GPL(usbnet_start_xmit);
>
> +static void rx_alloc_submit(struct usbnet *dev, gfp_t flags)
> +{
> +	struct urb	*urb;
> +	int		i;
> +
> +	/* don't refill the queue all at once */
> +	for (i = 0; i<  10&&  dev->rxq.qlen<  RX_QLEN(dev); i++) {
> +		urb = usb_alloc_urb(0, flags);
> +		if (urb != NULL) {
> +			if (rx_submit(dev, urb, flags) == -ENOLINK)

    The above 2 *if* statements can be collapsed into single one.

> +				return;
> +		}
> +	}
> +}
> +

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-06-20 11:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  7:15 [PATCH -v1 0/3] usbnet: usbnet: PM related fixes Ming Lei
2012-06-20  7:15 ` [PATCH -v1 1/3] usbnet: clear OPEN flag in failure path Ming Lei
2012-06-20  7:44   ` Oliver Neukum
     [not found] ` <1340176553-32225-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2012-06-20  7:15   ` [PATCH -v1 2/3] usbnet: decrease suspend count if returning -EBUSY for runtime suspend Ming Lei
     [not found]     ` <1340176553-32225-3-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2012-06-20  7:45       ` Oliver Neukum
2012-06-20  7:15   ` [PATCH -v1 3/3] usbnet: handle remote wakeup asap Ming Lei
2012-06-20  7:46     ` Oliver Neukum
     [not found]     ` <1340176553-32225-4-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2012-06-20 11:02       ` Sergei Shtylyov [this message]
     [not found]         ` <4FE1ADB4.4060302-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2012-06-20 11:24           ` Oliver Neukum
2012-06-23  0:34   ` [PATCH -v1 0/3] usbnet: usbnet: PM related fixes David Miller
2012-06-20  7:46 ` Oliver Neukum

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=4FE1ADB4.4060302@mvista.com \
    --to=sshtylyov-igf4poytycdqt0dzr+alfa@public$(echo .)gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public$(echo .)gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public$(echo .)gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=oneukum-l3A5Bk7waGM@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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