mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer
@ 2024-01-08 10:14 Ahmad Fatoum
  2024-01-08 10:14 ` [PATCH master 2/2] net: fsl-fman: fix CONFIG_DMA_API_DEBUG warnings Ahmad Fatoum
  2024-01-10  6:42 ` [PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-01-08 10:14 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The receive buffer needs to be cacheline aligned for cache maintenance
to avoid invalidating unrelated malloc memory. This was so far not the
case due to malloc's minimum alignment of 8-byte (with TLSF), so switch
to dma_alloc instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/net/fsl-fman.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/fsl-fman.c b/drivers/net/fsl-fman.c
index ff32fa8fc753..baafe027c079 100644
--- a/drivers/net/fsl-fman.c
+++ b/drivers/net/fsl-fman.c
@@ -620,9 +620,7 @@ static int fm_eth_rx_port_parameter_init(struct fm_eth *fm_eth)
 			* RX_BD_RING_SIZE);
 
 	/* alloc Rx buffer from main memory */
-	rx_buf_pool = malloc(MAX_RXBUF_LEN * RX_BD_RING_SIZE);
-	if (!rx_buf_pool)
-		return -ENOMEM;
+	rx_buf_pool = dma_alloc(MAX_RXBUF_LEN * RX_BD_RING_SIZE);
 
 	memset(rx_buf_pool, 0, MAX_RXBUF_LEN * RX_BD_RING_SIZE);
 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-10  6:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 10:14 [PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer Ahmad Fatoum
2024-01-08 10:14 ` [PATCH master 2/2] net: fsl-fman: fix CONFIG_DMA_API_DEBUG warnings Ahmad Fatoum
2024-01-10  6:42 ` [PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox