net: macb: Fix rx buffer cache handling
PATCH 1/1 net: macb: Fix rx buffer cache handling
With commit c6d07bf440bc ("net/macb: increase RX buffer size for GEM") ethernet support does not work any more with d-cache enabled on the AT91SAM. The reason is, that MACB_RX_BUFFER_SIZE was changed from 4096 to 128 but this change was not refected in the rx_buffer flush and invalidate functions, as these also use this macro.
This patch now fixes this by calculating the rx buffer size correctly again in those functions. With this change, ethernet works again reliably on my AT91SAM board.
--- drivers/net/macb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/macb.c +4 -2
@@ -296,13 +296,15 @@ static inline void macb_flush_ring_desc(struct macb_device *macb, bool rx)static inline void macb_flush_rx_buffer (struct macb_device *macb) {flush_dcache_range (macb->rx_buffer_dma, macb->rx_buffer_dma + -ALIGN (MACB_RX_BUFFER_SIZE ,PKTALIGN )); +ALIGN (macb->rx_buffer_size *MACB_RX_RING_SIZE , +PKTALIGN )); }static inline void macb_invalidate_rx_buffer (struct macb_device *macb) {invalidate_dcache_range (macb->rx_buffer_dma, macb->rx_buffer_dma + -ALIGN (MACB_RX_BUFFER_SIZE ,PKTALIGN )); +ALIGN (macb->rx_buffer_size *MACB_RX_RING_SIZE , +PKTALIGN )); }#if defined(CONFIG_CMD_NET )
Signature · 1 line
2.23.0
PATCH 1/1 net: macb: Fix rx buffer cache handling
Quoted 18 lines · Stefan Roese
With commit
c6d07bf440bc("net/macb: increase RX buffer size for GEM") ethernet support does not work any more with d-cache enabled on the AT91SAM. The reason is, thatMACB_RX_BUFFER_SIZEwas changed from 4096 to 128 but this change was not refected in therx_bufferflush and invalidate functions, as these also use this macro.This patch now fixes this by calculating the rx buffer size correctly again in those functions. With this change, ethernet works again reliably on my AT91SAM board.
Signed-off-by Stefan Roese <[email protected]>Fixes c6d07bf440bc ("net/macb: increase RX buffer size for GEM")Cc Ramon Fried <[email protected]>Cc Eugen Hristev <[email protected]>Cc Anup Patel <[email protected]>Cc Bin Meng <[email protected]>Cc Joe Hershberger <[email protected]>
Quoted 4 lines
--- drivers/net/macb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
PATCH 1/1 net: macb: Fix rx buffer cache handling
In reply to Stefan RoeseQuoted 11 lines · Stefan Roese
With commit
c6d07bf440bc("net/macb: increase RX buffer size for GEM") ethernet support does not work any more with d-cache enabled on the AT91SAM. The reason is, thatMACB_RX_BUFFER_SIZEwas changed from 4096 to 128 but this change was not refected in therx_bufferflush and invalidate functions, as these also use this macro.This patch now fixes this by calculating the rx buffer size correctly again in those functions. With this change, ethernet works again reliably on my AT91SAM board.
Quoted 7 lines
Signed-off-by Stefan Roese <[email protected]>Fixes c6d07bf440bc ("net/macb: increase RX buffer size for GEM")Cc Ramon Fried <[email protected]>Cc Eugen Hristev <[email protected]>Cc Anup Patel <[email protected]>Cc Bin Meng <[email protected]>Cc Joe Hershberger <[email protected]>
Hi Stefan,
https://patchwork.ozlabs.org/patch/1152998/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git
Thanks!
-Joe