diff mbox

[3/5] ifb: fix tx_queue_len overlimit

Message ID 1292251414-5154-3-git-send-email-xiaosuo@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Changli Gao Dec. 13, 2010, 2:43 p.m. UTC
We should check the length of rq after enqueuing, otherwise the length
of rq will be over tx_queue_len.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 drivers/net/ifb.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

jamal Dec. 15, 2010, 12:33 p.m. UTC | #1
On Mon, 2010-12-13 at 22:43 +0800, Changli Gao wrote:
> We should check the length of rq after enqueuing, otherwise the length
> of rq will be over tx_queue_len.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Not sure about this one. The check is also for ==, so we are going
to stop before we go over tx_queue_len. What am i missing?

cheers,
jamal

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Changli Gao Dec. 15, 2010, 12:36 p.m. UTC | #2
On Wed, Dec 15, 2010 at 8:33 PM, jamal <hadi@cyberus.ca> wrote:
> On Mon, 2010-12-13 at 22:43 +0800, Changli Gao wrote:
>> We should check the length of rq after enqueuing, otherwise the length
>> of rq will be over tx_queue_len.
>>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>
> Not sure about this one. The check is also for ==, so we are going
> to stop before we go over tx_queue_len. What am i missing?
>

But then, we put this skb into rq in any way, and the length of rq
becomes tx_queue_len + 1.
jamal Dec. 15, 2010, 12:42 p.m. UTC | #3
On Wed, 2010-12-15 at 20:36 +0800, Changli Gao wrote:

> 
> But then, we put this skb into rq in any way, and the length of rq
> becomes tx_queue_len + 1.

;->

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>


cheers,
jamal


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 1628d01..57c5cfb 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -131,15 +131,15 @@  static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev)
 		return NETDEV_TX_OK;
 	}
 
-	if (skb_queue_len(&dp->rq) >= dev->tx_queue_len)
-		netif_stop_queue(dev);
-
 	__skb_queue_tail(&dp->rq, skb);
 	if (!dp->tasklet_pending) {
 		dp->tasklet_pending = 1;
 		tasklet_schedule(&dp->ifb_tasklet);
 	}
 
+	if (skb_queue_len(&dp->rq) >= dev->tx_queue_len)
+		netif_stop_queue(dev);
+
 	return NETDEV_TX_OK;
 }