Message ID | 20190826071811.6788-1-sr@denx.de |
---|---|
State | Accepted |
Commit | 5ccd657b6d6cdf2378b98f6b71a2a5a22d8f4d50 |
Delegated to: | Joe Hershberger |
Headers | show |
Series | [U-Boot] net: macb: Fix rx buffer cache handling | expand |
On Mon, Aug 26, 2019 at 3:18 PM Stefan Roese <sr@denx.de> wrote: > > 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. > > Signed-off-by: Stefan Roese <sr@denx.de> > Fixes: c6d07bf440bc ("net/macb: increase RX buffer size for GEM") > Cc: Ramon Fried <rfried.dev@gmail.com> > Cc: Eugen Hristev <eugen.hristev@microchip.com> > Cc: Anup Patel <anup.patel@wdc.com> > Cc: Bin Meng <bmeng.cn@gmail.com> > Cc: Joe Hershberger <joe.hershberger@ni.com> > --- > drivers/net/macb.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
On Mon, Aug 26, 2019 at 2:18 AM Stefan Roese <sr@denx.de> wrote: > > 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. > > Signed-off-by: Stefan Roese <sr@denx.de> > Fixes: c6d07bf440bc ("net/macb: increase RX buffer size for GEM") > Cc: Ramon Fried <rfried.dev@gmail.com> > Cc: Eugen Hristev <eugen.hristev@microchip.com> > Cc: Anup Patel <anup.patel@wdc.com> > Cc: Bin Meng <bmeng.cn@gmail.com> > Cc: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Hi Stefan, https://patchwork.ozlabs.org/patch/1152998/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git Thanks! -Joe
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index c99cf663a4..a6d7b8ae8d 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -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)
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. Signed-off-by: Stefan Roese <sr@denx.de> Fixes: c6d07bf440bc ("net/macb: increase RX buffer size for GEM") Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Eugen Hristev <eugen.hristev@microchip.com> Cc: Anup Patel <anup.patel@wdc.com> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com> --- drivers/net/macb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)