Skip to content

Commit

Permalink
net: broadcom: bcm4908_enet: reset DMA rings sw indexes properly
Browse files Browse the repository at this point in the history
[ Upstream commit ddeacc4 ]

Resetting software indexes in bcm4908_dma_alloc_buf_descs() is not
enough as it's called during device probe only. Driver resets DMA on
every .ndo_open callback and it's required to reset indexes then.

This fixes inconsistent rings state and stalled traffic after interface
down & up sequence.

Fixes: 4feffea ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Rafał Miłecki authored and gregkh committed Jul 14, 2021
1 parent d20d69c commit 73b9467
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/broadcom/bcm4908_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,6 @@ static int bcm4908_dma_alloc_buf_descs(struct bcm4908_enet *enet,
if (!ring->slots)
goto err_free_buf_descs;

ring->read_idx = 0;
ring->write_idx = 0;

return 0;

err_free_buf_descs:
Expand Down Expand Up @@ -295,6 +292,9 @@ static void bcm4908_enet_dma_ring_init(struct bcm4908_enet *enet,

enet_write(enet, ring->st_ram_block + ENET_DMA_CH_STATE_RAM_BASE_DESC_PTR,
(uint32_t)ring->dma_addr);

ring->read_idx = 0;
ring->write_idx = 0;
}

static void bcm4908_enet_dma_uninit(struct bcm4908_enet *enet)
Expand Down

0 comments on commit 73b9467

Please sign in to comment.