net: bcmgenet: bcmgenet_init_tx_ring() cleanup
authorPetri Gynther <pgynther@google.com>
Mon, 23 Feb 2015 19:00:45 +0000 (11:00 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Feb 2015 16:39:04 +0000 (11:39 -0500)
1. Simplify function description
2. Rename function parameter write_ptr to start_ptr to better indicate use
3. Remove unnecessary local variable first_bd
4. Remove out-of-place comment "Unclassified traffic goes to ring 16"
5. Fix TDMA_WRITE_PTR register init

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c

index ff83c46bc38961561441814813f24d9b33da42ac..bc4c5b4eb00c0f8c44ec0ab5eee2f676e11dd612 100644 (file)
@@ -1680,17 +1680,14 @@ static int init_umac(struct bcmgenet_priv *priv)
        return 0;
 }
 
-/* Initialize all house-keeping variables for a TX ring, along
- * with corresponding hardware registers
- */
+/* Initialize a Tx ring along with corresponding hardware registers */
 static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
                                  unsigned int index, unsigned int size,
-                                 unsigned int write_ptr, unsigned int end_ptr)
+                                 unsigned int start_ptr, unsigned int end_ptr)
 {
        struct bcmgenet_tx_ring *ring = &priv->tx_rings[index];
        u32 words_per_bd = WORDS_PER_BD(priv);
        u32 flow_period_val = 0;
-       unsigned int first_bd;
 
        spin_lock_init(&ring->lock);
        ring->index = index;
@@ -1703,12 +1700,12 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
                ring->int_enable = bcmgenet_tx_ring_int_enable;
                ring->int_disable = bcmgenet_tx_ring_int_disable;
        }
-       ring->cbs = priv->tx_cbs + write_ptr;
+       ring->cbs = priv->tx_cbs + start_ptr;
        ring->size = size;
        ring->c_index = 0;
        ring->free_bds = size;
-       ring->write_ptr = write_ptr;
-       ring->cb_ptr = write_ptr;
+       ring->write_ptr = start_ptr;
+       ring->cb_ptr = start_ptr;
        ring->end_ptr = end_ptr - 1;
        ring->prod_index = 0;
 
@@ -1722,19 +1719,16 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
        /* Disable rate control for now */
        bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
                                  TDMA_FLOW_PERIOD);
-       /* Unclassified traffic goes to ring 16 */
        bcmgenet_tdma_ring_writel(priv, index,
                                  ((size << DMA_RING_SIZE_SHIFT) |
                                   RX_BUF_LENGTH), DMA_RING_BUF_SIZE);
 
-       first_bd = write_ptr;
-
        /* Set start and end address, read and write pointers */
-       bcmgenet_tdma_ring_writel(priv, index, first_bd * words_per_bd,
+       bcmgenet_tdma_ring_writel(priv, index, start_ptr * words_per_bd,
                                  DMA_START_ADDR);
-       bcmgenet_tdma_ring_writel(priv, index, first_bd * words_per_bd,
+       bcmgenet_tdma_ring_writel(priv, index, start_ptr * words_per_bd,
                                  TDMA_READ_PTR);
-       bcmgenet_tdma_ring_writel(priv, index, first_bd,
+       bcmgenet_tdma_ring_writel(priv, index, start_ptr * words_per_bd,
                                  TDMA_WRITE_PTR);
        bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1,
                                  DMA_END_ADDR);