Browse Source

Merge branch 'bcmgenet_xmit_more'

Florian Fainelli says:

====================
net: bcmgenet: xmit_more support

This patch series adds xmit_more support to the GENET driver by allowing
the deferal of the producer index write to the TDMA engine.

Changes in v2:

- move the netif_tx_stop_queue check *before* updating the producer index
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 10 years ago
parent
commit
2801be4a0e
1 changed files with 8 additions and 15 deletions
  1. 8 15
      drivers/net/ethernet/broadcom/genet/bcmgenet.c

+ 8 - 15
drivers/net/ethernet/broadcom/genet/bcmgenet.c

@@ -1130,11 +1130,6 @@ static int bcmgenet_xmit_single(struct net_device *dev,
 
 
 	dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, length_status);
 	dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, length_status);
 
 
-	/* Decrement total BD count and advance our write pointer */
-	ring->free_bds -= 1;
-	ring->prod_index += 1;
-	ring->prod_index &= DMA_P_INDEX_MASK;
-
 	return 0;
 	return 0;
 }
 }
 
 
@@ -1173,11 +1168,6 @@ static int bcmgenet_xmit_frag(struct net_device *dev,
 		    (frag->size << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
 		    (frag->size << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
 		    (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT));
 		    (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT));
 
 
-
-	ring->free_bds -= 1;
-	ring->prod_index += 1;
-	ring->prod_index &= DMA_P_INDEX_MASK;
-
 	return 0;
 	return 0;
 }
 }
 
 
@@ -1321,15 +1311,18 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 
 
 	skb_tx_timestamp(skb);
 	skb_tx_timestamp(skb);
 
 
-	/* we kept a software copy of how much we should advance the TDMA
-	 * producer index, now write it down to the hardware
-	 */
-	bcmgenet_tdma_ring_writel(priv, ring->index,
-				  ring->prod_index, TDMA_PROD_INDEX);
+	/* Decrement total BD count and advance our write pointer */
+	ring->free_bds -= nr_frags + 1;
+	ring->prod_index += nr_frags + 1;
+	ring->prod_index &= DMA_P_INDEX_MASK;
 
 
 	if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
 	if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
 		netif_tx_stop_queue(txq);
 		netif_tx_stop_queue(txq);
 
 
+	if (!skb->xmit_more || netif_xmit_stopped(txq))
+		/* Packets are ready, update producer index */
+		bcmgenet_tdma_ring_writel(priv, ring->index,
+					  ring->prod_index, TDMA_PROD_INDEX);
 out:
 out:
 	spin_unlock_irqrestore(&ring->lock, flags);
 	spin_unlock_irqrestore(&ring->lock, flags);