All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Golle <daniel@makrotopia.org>
To: Chad Monroe <chad@monroe.io>, Felix Fietkau <nbd@nbd.name>,
	Bc-Bocun Chen <bc-bocun.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net] net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM
Date: Sat, 26 Apr 2025 02:36:22 +0100	[thread overview]
Message-ID: <aAw4lsGc_5HwBeiK@makrotopia.org> (raw)
In-Reply-To: <995df78417d6f117062d1d7ef63228426b97a26e.1745630570.git.daniel@makrotopia.org>

On Sat, Apr 26, 2025 at 02:25:23AM +0100, Daniel Golle wrote:
> From: Chad Monroe <chad@monroe.io>
> 
> If the mtk_poll_rx() function detects the MTK_RESETTING flag, it will
> jump to release_desc and refill the high word of the SDP on the 4GB RFB.
> Subsequently, mtk_rx_clean will process an incorrect SDP, leading to a
> panic.
> 
> Add patch from Mediatek SDK to resolve this.
> 
> Fixes: 2d75891ebc09 ("net: ethernet: mtk_eth_soc: support 36-bit DMA addressing on MT7988")
> Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/11857ce2f90bf065b5e53211d182622d999a4542

The above link has to be replaced by
Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/71f47ea785699c6aa3b922d66c2bdc1a43da25b1

> Signed-off-by: Chad Monroe <chad@monroe.io>
> ---
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 47807b202310..7bac5ccfb79c 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2252,14 +2252,17 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
>  		ring->data[idx] = new_data;
>  		rxd->rxd1 = (unsigned int)dma_addr;
>  release_desc:
> +		if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
> +			if (unlikely(dma_addr == DMA_MAPPING_ERROR))
> +				addr64 = FIELD_GET(RX_DMA_ADDR64_MASK, rxd->rxd2);
> +			else
> +				addr64 = RX_DMA_PREP_ADDR64(dma_addr);
> +		}
> +
>  		if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
>  			rxd->rxd2 = RX_DMA_LSO;
>  		else
> -			rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size);
> -
> -		if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) &&
> -		    likely(dma_addr != DMA_MAPPING_ERROR))
> -			rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr);
> +			rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size) | addr64;
>  
>  		ring->calc_idx = idx;
>  		done++;
> -- 
> 2.49.0
> 
> 


      reply	other threads:[~2025-04-26  1:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-26  1:25 [PATCH net] net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM Daniel Golle
2025-04-26  1:36 ` Daniel Golle [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=aAw4lsGc_5HwBeiK@makrotopia.org \
    --to=daniel@makrotopia.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bc-bocun.chen@mediatek.com \
    --cc=chad@monroe.io \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.