Subject: Re: [PATCH v2 1/1] net: macb: Shorten max_tx_len to 4KiB - 56 on mpfs

From: Simon Horman <[email-masked]>
Date: Tue, 18 Apr 2023 16:28:25 +0200

On Mon, Apr 17, 2023 at 03:00:41PM +0100, [email-masked] wrote:
> From: Daire McNamara <[email-masked]>
> 
> On mpfs, with SRAM configured for 4 queues, setting max_tx_len
> to GEM_TX_MAX_LEN=0x3f0 results multiple AMBA errors.
> Setting max_tx_len to (4KiB - 56) removes those errors.
> 
> The details are described in erratum 1686 by Cadence
> 
> The max jumbo frame size is also reduced for mpfs to (4KiB - 56).
> 
> Signed-off-by: Daire McNamara <[email-masked]>

...

>  static const struct macb_config sama7g5_gem_config = {
> @@ -4986,8 +4985,17 @@ static int macb_probe(struct platform_device *pdev)
>  	bp->tx_clk = tx_clk;
>  	bp->rx_clk = rx_clk;
>  	bp->tsu_clk = tsu_clk;
> -	if (macb_config)
> +	if (macb_config) {
> +		if (hw_is_gem(bp->regs, bp->native_io)) {
> +			if (macb_config->max_tx_length)
> +				bp->max_tx_length = macb_config->max_tx_length;
> +			else
> +				bp->max_tx_length = GEM_MAX_TX_LEN;
> +		} else {
> +			bp->max_tx_length = MACB_MAX_TX_LEN;
> +		}

Hi Daire,

no need to refresh the patch on my account.
But can the above be simplified as:

               if (macb_is_gem(bp) && hw_is_gem(bp->regs, bp->native_io))
                       bp->max_tx_length = macb_config->max_tx_length;
               else
                       bp->max_tx_length = MACB_MAX_TX_LEN;

>  		bp->jumbo_max_len = macb_config->jumbo_max_len;
> +	}
>  
>  	bp->wol = 0;
>  	if (of_property_read_bool(np, "magic-packet"))
> -- 
> 2.25.1
>