[PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer

Sascha Hauer sha at pengutronix.de
Tue Jan 9 22:42:47 PST 2024


On Mon, Jan 08, 2024 at 11:14:18AM +0100, Ahmad Fatoum wrote:
> 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 at pengutronix.de>
> ---
>  drivers/net/fsl-fman.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list