mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master 1/2] net: fsl-fman: fix alignment of RX buffer
Date: Wed, 10 Jan 2024 07:42:47 +0100	[thread overview]
Message-ID: <20240110064247.GI1318922@pengutronix.de> (raw)
In-Reply-To: <20240108101419.1290778-1-a.fatoum@pengutronix.de>

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



      parent reply	other threads:[~2024-01-10  6:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240110064247.GI1318922@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox