netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Max Krasnyansky <maxk@qualcomm.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] tun: Persistent devices can get stuck in xoff state
Date: Wed, 9 Jul 2008 17:15:25 +0200	[thread overview]
Message-ID: <200807091715.25464.borntraeger@de.ibm.com> (raw)
In-Reply-To: <1215584648-13444-1-git-send-email-maxk@qualcomm.com>

Am Mittwoch, 9. Juli 2008 schrieb Max Krasnyansky:
> The scenario goes like this. App stops reading from tun/tap.
> TX queue gets full and driver does netif_stop_queue().
> App closes fd and TX queue gets flushed as part of the cleanup.
> Next time the app opens tun/tap and starts reading from it but
> the xoff state is not cleared. We're stuck.
> Normally xoff state is cleared when netdev is brought up. But
> in the case of persistent devices this happens only during
> initial setup.

Thats interesting. I believe we have seen exactly this behaviour
with KVM and lots of preallocated tap devices. 
[...]
> +++ b/drivers/net/tun.c
> @@ -576,6 +576,11 @@ static int tun_set_iff(struct file *file, struct ifreq 
*ifr)
>  	file->private_data = tun;
>  	tun->attached = 1;
> 
> +	/* Make sure persistent devices do not get stuck in
> +	 * xoff state */
> +	if (netif_running(tun->dev))
> +		netif_wake_queue(tun->dev);
> +
>  	strcpy(ifr->ifr_name, tun->dev->name);
>  	return 0;

I think that patch looks ok, but I am curious why you dont clear the xoff 
state on application close at the same time when the TX queue gets flushed?

Christian

  reply	other threads:[~2008-07-09 15:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09  6:24 [PATCH] tun: Persistent devices can get stuck in xoff state Max Krasnyansky
2008-07-09 15:15 ` Christian Borntraeger [this message]
2008-07-09 21:15   ` Max Krasnyansky
2008-07-09 15:59 ` Christian Borntraeger
2008-07-09 21:19   ` Max Krasnyansky
2008-07-11  0:00     ` David Miller
2008-07-11  0:53       ` Max Krasnyansky

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=200807091715.25464.borntraeger@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=davem@davemloft.net \
    --cc=maxk@qualcomm.com \
    --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).