Skip to contentSkip to conversation

net: ethernet: cpsw: fix usage of cpdma_check_free_tx_desc()

PATCH Applied Daniel Mack 4 participants 4 messages Mar 12, 2013 – Mar 13, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: cpsw: fix usage of cpdma_check_free_tx_desc()

Commit fae50823d0 ("net: ethernet: davinci_cpdma: Add boundary for rx and tx descriptors") introduced a function to check the current allocation state of tx packets. The return value is taken into account to stop the netqork queue on the adapter in case there are no free slots.

However, cpdma_check_free_tx_desc() returns 'true' if there is room in the bitmap, not 'false', so the usage of the function is wrong.

---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +1 -1
index 01ffbc4..75c4855 100644
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
 	/* If there is no more tx desc left free then we need to
 	 * tell the kernel to stop sending us tx frames.
 	 */
-	if (unlikely(cpdma_check_free_tx_desc(priv->txch)))
+	if (unlikely(!cpdma_check_free_tx_desc(priv->txch)))
 		netif_stop_queue(ndev);
 
 	return NETDEV_TX_OK;
Signature · 1 line
1.8.1.4
Tested-by Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines · Daniel Mack

Commit fae50823d0 ("net: ethernet: davinci_cpdma: Add boundary for rx and tx descriptors") introduced a function to check the current allocation state of tx packets. The return value is taken into account to stop the netqork queue on the adapter in case there are no free slots.

However, cpdma_check_free_tx_desc() returns 'true' if there is room in the bitmap, not 'false', so the usage of the function is wrong.

---
  drivers/net/ethernet/ti/cpsw.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index 01ffbc4..75c4855 100644

drivers/net/ethernet/ti/cpsw.c static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, · line 911

Quoted 8 lines
drivers/net/ethernet/ti/cpsw.c +1 -1
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
  	/* If there is no more tx desc left free then we need to
  	 * tell the kernel to stop sending us tx frames.
  	 */
-	if (unlikely(cpdma_check_free_tx_desc(priv->txch)))
+	if (unlikely(!cpdma_check_free_tx_desc(priv->txch)))
  		netif_stop_queue(ndev);
 
  	return NETDEV_TX_OK;

Regards
Mugunthan V N

Tested-by
#2 lore raw
Quoted 33 lines · Mugunthan V N
Quoted 22 lines · Daniel Mack

Commit fae50823d0 ("net: ethernet: davinci_cpdma: Add boundary for rx and tx descriptors") introduced a function to check the current allocation state of tx packets. The return value is taken into account to stop the netqork queue on the adapter in case there are no free slots.

However, cpdma_check_free_tx_desc() returns 'true' if there is room in the bitmap, not 'false', so the usage of the function is wrong.

---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index 01ffbc4..75c4855 100644

drivers/net/ethernet/ti/cpsw.c static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, · line 910

Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +1 -1
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
 	/* If there is no more tx desc left free then we need to
 	 * tell the kernel to stop sending us tx frames.
 	 */
-	if (unlikely(cpdma_check_free_tx_desc(priv->txch)))
+	if (unlikely(!cpdma_check_free_tx_desc(priv->txch)))
 		netif_stop_queue(ndev);
 	return NETDEV_TX_OK;
Quoted 2 lines

Regards
Mugunthan V N

This restores throughput to the level of 3.7.0

maintainer Applied
#3 lore raw

From: Andreas Fenkart <[email protected]>
Date: Tue, 12 Mar 2013 21:20:27 +0100

Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack
Quoted 13 lines

Commit fae50823d0 ("net: ethernet: davinci_cpdma: Add boundary for rx and tx descriptors") introduced a function to check the current allocation state of tx packets. The return value is taken into account to stop the netqork queue on the adapter in case there are no free slots.

However, cpdma_check_free_tx_desc() returns 'true' if there is room in the bitmap, not 'false', so the usage of the function is wrong.

...

Quoted 2 lines
Quoted 2 lines

...

Quoted 3 lines

This restores throughput to the level of 3.7.0

Applied.