public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, David Sterba <dsterba@suse.cz>,
	Jiri Kosina <jkosina@suse.cz>, Chris Wright <chrisw@sous-sol.org>
Subject: [patch 02/47] ipwireless: Fix blocked sending
Date: Fri, 13 Jun 2008 17:10:16 -0700	[thread overview]
Message-ID: <20080614001016.GB24698@suse.de> (raw)
In-Reply-To: <20080614000840.GA24659@suse.de>

[-- Attachment #1: ipwireless-fix-blocked-sending.patch --]
[-- Type: text/plain, Size: 3935 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: David Sterba <dsterba@suse.cz>

upstream commit: eb4e545d4ac82d9018487edb4419b33b9930c857

Packet sending is driven by two flags, tx_ready and tx_queued.
It was possible, that there were queued data for sending and
hardware was flagged as blocked but in fact it was not.

The tx_queued was indicator but should be really a counter else
first fragmented packet resets tx_queued flag, but there may be
pending packets which do not get sent.

New semantics:
tx_ready - set, if hw is ready to send packet, no packet is being
           transferred right now
           set the flag right at the place where data are copied
           into hw memory and not earlier without checking if it
           was succesful
tx_queued - count of enqueued packets, including fragments

Tested-by: Michal Rokos <michal.rokos@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 drivers/char/pcmcia/ipwireless/hardware.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -251,10 +251,11 @@ struct ipw_hardware {
 	int init_loops;
 	struct timer_list setup_timer;
 
+	/* Flag if hw is ready to send next packet */
 	int tx_ready;
-	struct list_head tx_queue[NL_NUM_OF_PRIORITIES];
-	/* True if any packets are queued for transmission */
+	/* Count of pending packets to be sent */
 	int tx_queued;
+	struct list_head tx_queue[NL_NUM_OF_PRIORITIES];
 
 	int rx_bytes_queued;
 	struct list_head rx_queue;
@@ -430,6 +431,8 @@ static int do_send_fragment(struct ipw_h
 
 	spin_lock_irqsave(&hw->spinlock, flags);
 
+	hw->tx_ready = 0;
+
 	if (hw->hw_version == HW_VERSION_1) {
 		outw((unsigned short) length, hw->base_port + IODWR);
 
@@ -518,6 +521,7 @@ static int do_send_packet(struct ipw_har
 
 		spin_lock_irqsave(&hw->spinlock, flags);
 		list_add(&packet->queue, &hw->tx_queue[0]);
+		hw->tx_queued++;
 		spin_unlock_irqrestore(&hw->spinlock, flags);
 	} else {
 		if (packet->packet_callback)
@@ -975,12 +979,10 @@ static int send_pending_packet(struct ip
 	unsigned long flags;
 
 	spin_lock_irqsave(&hw->spinlock, flags);
-	if (hw->tx_queued && hw->tx_ready != 0) {
+	if (hw->tx_queued && hw->tx_ready) {
 		int priority;
 		struct ipw_tx_packet *packet = NULL;
 
-		hw->tx_ready--;
-
 		/* Pick a packet */
 		for (priority = 0; priority < priority_limit; priority++) {
 			if (!list_empty(&hw->tx_queue[priority])) {
@@ -989,6 +991,7 @@ static int send_pending_packet(struct ip
 						struct ipw_tx_packet,
 						queue);
 
+				hw->tx_queued--;
 				list_del(&packet->queue);
 
 				break;
@@ -999,6 +1002,7 @@ static int send_pending_packet(struct ip
 			spin_unlock_irqrestore(&hw->spinlock, flags);
 			return 0;
 		}
+
 		spin_unlock_irqrestore(&hw->spinlock, flags);
 
 		/* Send */
@@ -1089,7 +1093,7 @@ static irqreturn_t ipwireless_handle_v1_
 		if (irqn & IR_TXINTR) {
 			ack |= IR_TXINTR;
 			spin_lock_irqsave(&hw->spinlock, flags);
-			hw->tx_ready++;
+			hw->tx_ready = 1;
 			spin_unlock_irqrestore(&hw->spinlock, flags);
 		}
 		/* Received data */
@@ -1196,7 +1200,7 @@ static irqreturn_t ipwireless_handle_v2_
 	if (memrxdone & MEMRX_RX_DONE) {
 		writew(0, &hw->memory_info_regs->memreg_rx_done);
 		spin_lock_irqsave(&hw->spinlock, flags);
-		hw->tx_ready++;
+		hw->tx_ready = 1;
 		spin_unlock_irqrestore(&hw->spinlock, flags);
 		tx = 1;
 	}
@@ -1260,7 +1264,7 @@ static void send_packet(struct ipw_hardw
 
 	spin_lock_irqsave(&hw->spinlock, flags);
 	list_add_tail(&packet->queue, &hw->tx_queue[priority]);
-	hw->tx_queued = 1;
+	hw->tx_queued++;
 	spin_unlock_irqrestore(&hw->spinlock, flags);
 
 	flush_packets_to_hw(hw);

-- 

  parent reply	other threads:[~2008-06-14  0:12 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080613234753.235721454@mini.kroah.org>
2008-06-14  0:08 ` [patch 00/47] 2.6.25-stable review Greg KH
2008-06-14  0:10   ` [patch 01/47] b43: Fix controller restart crash Greg KH
2008-06-14  0:10   ` Greg KH [this message]
2008-06-14  0:10   ` [patch 03/47] Add rd alias to new brd ramdisk driver Greg KH
2008-06-14  0:10   ` [patch 04/47] ssb: Fix context assertion in ssb_pcicore_dev_irqvecs_enable Greg KH
2008-06-14  0:10   ` [patch 05/47] double-free of inode on alloc_file() failure exit in create_write_pipe() Greg KH
2008-06-14  0:10   ` [patch 06/47] ALSA: hda - Fix resume of auto-config mode with Realtek codecs Greg KH
2008-06-14  0:10   ` [patch 07/47] sound: emu10k1 - fix system hang with Audigy2 ZS Notebook PCMCIA card Greg KH
2008-06-14  0:10   ` [patch 08/47] ecryptfs: add missing lock around notify_change Greg KH
2008-06-14  0:10   ` [patch 09/47] eCryptfs: protect crypt_stat->flags in ecryptfs_open() Greg KH
2008-06-14  0:10   ` [patch 10/47] ecryptfs: clean up (un)lock_parent Greg KH
2008-06-14  0:10   ` [patch 11/47] ecryptfs: fix missed mutex_unlock Greg KH
2008-06-14  0:10   ` [patch 12/47] fbdev: export symbol fb_mode_option Greg KH
2008-06-14  0:10   ` [patch 13/47] sunhv: Fix locking in non-paged I/O case Greg KH
2008-06-14  0:10   ` [patch 14/47] af_key: Fix selector family initialization Greg KH
2008-06-14  0:10   ` [patch 15/47] ax25: Fix NULL pointer dereference and lockup Greg KH
2008-06-14  0:10   ` [patch 16/47] bluetooth: fix locking bug in the rfcomm socket cleanup handling Greg KH
2008-06-14  2:50     ` Dave Young
2008-06-14  3:46       ` David Miller
2008-06-16 19:40         ` [stable] " Greg KH
2008-06-14 12:26       ` Marcel Holtmann
2008-06-15  3:35         ` Dave Young
2008-06-14  0:11   ` [patch 17/47] can: Fix copy_from_user() results interpretation Greg KH
2008-06-14  0:11   ` [patch 18/47] cassini: Only use chip checksum for ipv4 packets Greg KH
2008-06-14  0:11   ` [patch 19/47] net: Fix call to ->change_rx_flags(dev, IFF_MULTICAST) in dev_change_flags() Greg KH
2008-06-14  0:11   ` [patch 20/47] net_sched: cls_api: fix return value for non-existant classifiers Greg KH
2008-06-14  0:11   ` [patch 21/47] ipsec: Use the correct ip_local_out function Greg KH
2008-06-14  0:11   ` [patch 22/47] netlink: Fix nla_parse_nested_compat() to call nla_parse() directly Greg KH
2008-06-14  0:11   ` [patch 23/47] l2tp: avoid skb truesize bug if headroom is increased Greg KH
2008-06-14  0:11   ` [patch 24/47] vlan: Correctly handle device notifications for layered VLAN devices Greg KH
2008-06-14  0:11   ` [patch 25/47] tcp: TCP connection times out if ICMP frag needed is delayed Greg KH
2008-06-14  0:11   ` [patch 26/47] tcp: Allow send-limited cwnd to grow up to max_burst when gso disabled Greg KH
2008-06-14  0:11   ` [patch 27/47] tcp: Limit cwnd growth when deferring for GSO Greg KH
2008-06-14  0:11   ` [patch 28/47] l2tp: Fix possible WARN_ON from socket code when UDP socket is closed Greg KH
2008-06-14  0:11   ` [patch 29/47] l2tp: Fix possible oops if transmitting or receiving when tunnel goes down Greg KH
2008-06-14  0:11   ` [patch 30/47] tcp: fix skb vs fack_count out-of-sync condition Greg KH
2008-06-14  0:11   ` [patch 31/47] tcp FRTO: Fix fallback to conventional recovery Greg KH
2008-06-14  0:11   ` [patch 32/47] tcp FRTO: SACK variant is errorneously used with NewReno Greg KH
2008-06-14  0:11   ` [patch 33/47] tcp FRTO: work-around inorder receivers Greg KH
2008-06-14  0:11   ` [patch 34/47] mmc: wbsd: initialize tasklets before requesting interrupt Greg KH
2008-06-14  0:11   ` [patch 35/47] cciss: add new hardware support Greg KH
2008-06-14  0:11   ` [patch 36/47] hgafb: resource management fix Greg KH
2008-06-14  0:11   ` [patch 37/47] forcedeth: msi interrupts Greg KH
2008-06-14  0:12   ` [patch 38/47] tcp: Fix inconsistency source (CA_Open only when !tcp_left_out(tp)) Greg KH
2008-06-14  0:12   ` [patch 39/47] IB/umem: Avoid sign problems when demoting npages to integer Greg KH
2008-06-14  0:12   ` [patch 40/47] m68k: Add ext2_find_{first,next}_bit() for ext4 Greg KH
2008-06-14  0:12   ` [patch 41/47] cifs: fix oops on mount when CONFIG_CIFS_DFS_UPCALL is enabled Greg KH
2008-06-14  0:12   ` [patch 42/47] CPUFREQ: Fix format string bug Greg KH
2008-06-14  0:12   ` [patch 43/47] serial: fix enable_irq_wake/disable_irq_wake imbalance in serial_core.c Greg KH
2008-06-14  0:12   ` [patch 44/47] Kconfig: introduce ARCH_DEFCONFIG to DEFCONFIG_LIST Greg KH
2008-06-14  0:12   ` [patch 45/47] bttv: Fix a deadlock in the bttv driver Greg KH
2008-06-14  0:12   ` [patch 46/47] x86: fix recursive dependencies Greg KH
2008-06-14  0:12   ` [patch 47/47] mac80211: send association event on IBSS create Greg KH

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=20080614001016.GB24698@suse.de \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=dsterba@suse.cz \
    --cc=jkosina@suse.cz \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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