提交 4f8b2d7d 编写于 作者: P Petri Gynther 提交者: David S. Miller

net: bcmgenet: bcmgenet_init_tx_ring() cleanup

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: NPetri Gynther <pgynther@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8ca40c14
...@@ -1680,17 +1680,14 @@ static int init_umac(struct bcmgenet_priv *priv) ...@@ -1680,17 +1680,14 @@ static int init_umac(struct bcmgenet_priv *priv)
return 0; return 0;
} }
/* Initialize all house-keeping variables for a TX ring, along /* Initialize a Tx ring along with corresponding hardware registers */
* with corresponding hardware registers
*/
static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
unsigned int index, unsigned int size, 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]; struct bcmgenet_tx_ring *ring = &priv->tx_rings[index];
u32 words_per_bd = WORDS_PER_BD(priv); u32 words_per_bd = WORDS_PER_BD(priv);
u32 flow_period_val = 0; u32 flow_period_val = 0;
unsigned int first_bd;
spin_lock_init(&ring->lock); spin_lock_init(&ring->lock);
ring->index = index; ring->index = index;
...@@ -1703,12 +1700,12 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, ...@@ -1703,12 +1700,12 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
ring->int_enable = bcmgenet_tx_ring_int_enable; ring->int_enable = bcmgenet_tx_ring_int_enable;
ring->int_disable = bcmgenet_tx_ring_int_disable; 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->size = size;
ring->c_index = 0; ring->c_index = 0;
ring->free_bds = size; ring->free_bds = size;
ring->write_ptr = write_ptr; ring->write_ptr = start_ptr;
ring->cb_ptr = write_ptr; ring->cb_ptr = start_ptr;
ring->end_ptr = end_ptr - 1; ring->end_ptr = end_ptr - 1;
ring->prod_index = 0; ring->prod_index = 0;
...@@ -1722,19 +1719,16 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, ...@@ -1722,19 +1719,16 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
/* Disable rate control for now */ /* Disable rate control for now */
bcmgenet_tdma_ring_writel(priv, index, flow_period_val, bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
TDMA_FLOW_PERIOD); TDMA_FLOW_PERIOD);
/* Unclassified traffic goes to ring 16 */
bcmgenet_tdma_ring_writel(priv, index, bcmgenet_tdma_ring_writel(priv, index,
((size << DMA_RING_SIZE_SHIFT) | ((size << DMA_RING_SIZE_SHIFT) |
RX_BUF_LENGTH), DMA_RING_BUF_SIZE); RX_BUF_LENGTH), DMA_RING_BUF_SIZE);
first_bd = write_ptr;
/* Set start and end address, read and write pointers */ /* 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); 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); 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); TDMA_WRITE_PTR);
bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1, bcmgenet_tdma_ring_writel(priv, index, end_ptr * words_per_bd - 1,
DMA_END_ADDR); DMA_END_ADDR);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册