netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tun: Persistent devices can get stuck in xoff state
@ 2008-07-09  6:24 Max Krasnyansky
  2008-07-09 15:15 ` Christian Borntraeger
  2008-07-09 15:59 ` Christian Borntraeger
  0 siblings, 2 replies; 7+ messages in thread
From: Max Krasnyansky @ 2008-07-09  6:24 UTC (permalink / raw)
  To: davem; +Cc: netdev, 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.

The fix is trivial. If device is already up when an app opens
it we clear xoff state and that gets things moving again.

Signed-off-by: Max Krasnyansky <maxk@qualcomm.com>
---
 drivers/net/tun.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 5b5d875..e665f72 100644
--- a/drivers/net/tun.c
+++ 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;
 
-- 
1.5.5.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-07-11  0:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-09  6:24 [PATCH] tun: Persistent devices can get stuck in xoff state Max Krasnyansky
2008-07-09 15:15 ` Christian Borntraeger
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

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).