]> rtime.felk.cvut.cz Git - zynq/linux.git/commit
net: macb: fix the RX queue reset in macb_rx()
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Thu, 8 Mar 2018 12:45:54 +0000 (18:15 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 9 Mar 2018 08:09:58 +0000 (09:09 +0100)
commit5bc393ad47804deee9583a0549059fe78e7866d0
tree28cdb94e74e5bc59d4c453fd75a41d6a6b44ba2e
parentfc337bde9d95acf7be78eb3bc994d8a0984d5917
net: macb: fix the RX queue reset in macb_rx()

On macb only (not gem), when a RX queue corruption was detected from
macb_rx(), the RX queue was reset: during this process the RX ring
buffer descriptor was initialized by macb_init_rx_ring() but we forgot
to also set bp->rx_tail to 0.

Indeed, when processing the received frames, bp->rx_tail provides the
macb driver with the index in the RX ring buffer of the next buffer to
process. So when the whole ring buffer is reset we must also reset
bp->rx_tail so the driver is synchronized again with the hardware.

Since macb_init_rx_ring() is called from many locations, currently from
macb_rx() and macb_init_rings(), we'd rather add the "bp->rx_tail = 0;"
line inside macb_init_rx_ring() than add the very same line after each
call of this function.

Without this fix, the rx queue is not reset properly to recover from
queue corruption and connection drop may occur.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Fixes: 9ba723b081a2 ("net: macb: remove BUG_ON() and reset the queue to handle RX errors")
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/ethernet/cadence/macb_main.c