[ 027/187] lpc_eth: fix tx completion

2012-07-12 Thread Greg Kroah-Hartman
From: Greg KH 

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

--


From: Eric Dumazet 

[ Upstream commit 3f16da51b0e533871d22a29682f3c3969d4f7e22 ]

__lpc_handle_xmit() has two bugs :

1) It can leak skbs in case TXSTATUS_ERROR is set

2) It can wake up txqueue while no slot was freed.

Signed-off-by: Eric Dumazet 
Reported-by: Roland Stigge 
Tested-by: Roland Stigge 
Cc: Kevin Wells 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/ethernet/nxp/lpc_eth.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -936,16 +936,16 @@ static void __lpc_handle_xmit(struct net
/* Update stats */
ndev->stats.tx_packets++;
ndev->stats.tx_bytes += skb->len;
-
-   /* Free buffer */
-   dev_kfree_skb_irq(skb);
}
+   dev_kfree_skb_irq(skb);
 
txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base));
}
 
-   if (netif_queue_stopped(ndev))
-   netif_wake_queue(ndev);
+   if (pldat->num_used_tx_buffs <= ENET_TX_DESC/2) {
+   if (netif_queue_stopped(ndev))
+   netif_wake_queue(ndev);
+   }
 }
 
 static int __lpc_handle_recv(struct net_device *ndev, int budget)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ 027/187] lpc_eth: fix tx completion

2012-07-12 Thread Greg Kroah-Hartman
From: Greg KH gre...@linuxfoundation.org

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

--


From: Eric Dumazet eduma...@google.com

[ Upstream commit 3f16da51b0e533871d22a29682f3c3969d4f7e22 ]

__lpc_handle_xmit() has two bugs :

1) It can leak skbs in case TXSTATUS_ERROR is set

2) It can wake up txqueue while no slot was freed.

Signed-off-by: Eric Dumazet eduma...@google.com
Reported-by: Roland Stigge sti...@antcom.de
Tested-by: Roland Stigge sti...@antcom.de
Cc: Kevin Wells kevin.we...@nxp.com
Signed-off-by: David S. Miller da...@davemloft.net
Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/net/ethernet/nxp/lpc_eth.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -936,16 +936,16 @@ static void __lpc_handle_xmit(struct net
/* Update stats */
ndev-stats.tx_packets++;
ndev-stats.tx_bytes += skb-len;
-
-   /* Free buffer */
-   dev_kfree_skb_irq(skb);
}
+   dev_kfree_skb_irq(skb);
 
txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat-net_base));
}
 
-   if (netif_queue_stopped(ndev))
-   netif_wake_queue(ndev);
+   if (pldat-num_used_tx_buffs = ENET_TX_DESC/2) {
+   if (netif_queue_stopped(ndev))
+   netif_wake_queue(ndev);
+   }
 }
 
 static int __lpc_handle_recv(struct net_device *ndev, int budget)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/