linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] p54: enforce strict tx_queue limits
@ 2008-12-09 20:09 Christian Lamparter
  2008-12-10  2:39 ` Larry Finger
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Lamparter @ 2008-12-09 20:09 UTC (permalink / raw)
  To: linux-wireless; +Cc: John W. Linville

The patch fixes an old FIXME in p54pci.c by moving the "queue full" 
check into the common library, where we can deal with it properly.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
---
diff -Nurp a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
--- a/drivers/net/wireless/p54/p54common.c	2008-12-09 20:13:56.467888032 +0100
+++ b/drivers/net/wireless/p54/p54common.c	2008-12-09 20:49:21.235888230 +0100
@@ -889,7 +889,27 @@ static int p54_assign_address(struct iee
 		return -EINVAL;
 
 	spin_lock_irqsave(&priv->tx_queue.lock, flags);
+
 	left = skb_queue_len(&priv->tx_queue);
+	if (unlikely(left >= 28)) {
+		/*
+		 * The tx_queue is nearly full!
+		 * We have throttle normal data traffic, because we must
+		 * have a few spare slots for control frames left.
+		 */
+		ieee80211_stop_queues(dev);
+
+		if (unlikely(left == 32)) {
+			/*
+			 * The tx_queue is now really full.
+			 *
+			 * TODO: check if the device has crashed and reset it.
+			 */
+			spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
+			return -ENOSPC;
+		}
+	}
+
 	while (left--) {
 		u32 hole_size;
 		info = IEEE80211_SKB_CB(entry);
@@ -918,7 +938,7 @@ static int p54_assign_address(struct iee
 	if (!target_skb) {
 		spin_unlock_irqrestore(&priv->tx_queue.lock, flags);
 		ieee80211_stop_queues(dev);
-		return -ENOMEM;
+		return -ENOSPC;
 	}
 
 	info = IEEE80211_SKB_CB(skb);
diff -Nurp a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
--- a/drivers/net/wireless/p54/p54pci.c	2008-12-09 20:05:21.251888445 +0100
+++ b/drivers/net/wireless/p54/p54pci.c	2008-12-07 22:04:45.952897552 +0100
@@ -332,13 +332,6 @@ static void p54p_tx(struct ieee80211_hw 
 
 	P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
 	P54P_READ(dev_int);
-
-	/* FIXME: unlikely to happen because the device usually runs out of
-	   memory before we fill the ring up, but we can make it impossible */
-	if (idx - device_idx > ARRAY_SIZE(ring_control->tx_data) - 2) {
-		p54_free_skb(dev, skb);
-		printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
-	}
 }
 
 static void p54p_stop(struct ieee80211_hw *dev)

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

* Re: [PATCH 2/2] p54: enforce strict tx_queue limits
  2008-12-09 20:09 [PATCH 2/2] p54: enforce strict tx_queue limits Christian Lamparter
@ 2008-12-10  2:39 ` Larry Finger
  2008-12-10 11:54   ` Christian Lamparter
  0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2008-12-10  2:39 UTC (permalink / raw)
  To: Christian Lamparter; +Cc: linux-wireless, John W. Linville

Christian Lamparter wrote:
> The patch fixes an old FIXME in p54pci.c by moving the "queue full" 
> check into the common library, where we can deal with it properly.
> 
> Signed-off-by: Christian Lamparter <chunkeey@web.de>
> ---
> diff -Nurp a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
> --- a/drivers/net/wireless/p54/p54common.c	2008-12-09 20:13:56.467888032 +0100
> +++ b/drivers/net/wireless/p54/p54common.c	2008-12-09 20:49:21.235888230 +0100
> @@ -889,7 +889,27 @@ static int p54_assign_address(struct iee
>  		return -EINVAL;
>  
>  	spin_lock_irqsave(&priv->tx_queue.lock, flags);
> +
>  	left = skb_queue_len(&priv->tx_queue);
> +	if (unlikely(left >= 28)) {
> +		/*
> +		 * The tx_queue is nearly full!
> +		 * We have throttle normal data traffic, because we must
> +		 * have a few spare slots for control frames left.
> +		 */
> +		ieee80211_stop_queues(dev);

I do not intend this as a criticism of the patch, but how do the queues get
restarted after this?

Larry


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

* Re: [PATCH 2/2] p54: enforce strict tx_queue limits
  2008-12-10  2:39 ` Larry Finger
@ 2008-12-10 11:54   ` Christian Lamparter
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Lamparter @ 2008-12-10 11:54 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, John W. Linville

On Wednesday 10 December 2008 03:39:00 Larry Finger wrote:
> Christian Lamparter wrote:
> > The patch fixes an old FIXME in p54pci.c by moving the "queue full" 
> > check into the common library, where we can deal with it properly.
> > 
> > Signed-off-by: Christian Lamparter <chunkeey@web.de>
> > ---
> > diff -Nurp a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
> > --- a/drivers/net/wireless/p54/p54common.c	2008-12-09 20:13:56.467888032 +0100
> > +++ b/drivers/net/wireless/p54/p54common.c	2008-12-09 20:49:21.235888230 +0100
> > @@ -889,7 +889,27 @@ static int p54_assign_address(struct iee
> >  		return -EINVAL;
> >  
> >  	spin_lock_irqsave(&priv->tx_queue.lock, flags);
> > +
> >  	left = skb_queue_len(&priv->tx_queue);
> > +	if (unlikely(left >= 28)) {
> > +		/*
> > +		 * The tx_queue is nearly full!
> > +		 * We have throttle normal data traffic, because we must
> > +		 * have a few spare slots for control frames left.
> > +		 */
> > +		ieee80211_stop_queues(dev);
> 
> I do not intend this as a criticism of the patch, but how do the queues get
> restarted after this?
> 

The idea is that p54_free_skb & p54_rx_frame_sent callbacks, which are
called whenever the firmware has finished processing a "device control"
or wifi frames. (And at that point there're atleast 28 pending frames,
so one should eventually get freed unless the firmware crashed!)

These routines unlink the frame form the tx_queue and call
p54_wake_free_queues if there's enough space for a new data frame.

Regards,
	Chr

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

end of thread, other threads:[~2008-12-10 11:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 20:09 [PATCH 2/2] p54: enforce strict tx_queue limits Christian Lamparter
2008-12-10  2:39 ` Larry Finger
2008-12-10 11:54   ` Christian Lamparter

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