[net v2] net: ethernet: mtk_eth_soc: handle dma buffer size soc specific
Bc-bocun Chen (陳柏村)
bc-bocun.chen at mediatek.com
Tue May 28 22:36:06 PDT 2024
On Mon, 2024-05-27 at 16:21 +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w at public-files.de>
>
> The mainline MTK ethernet driver suffers long time from rarly but
> annoying tx queue timeouts. We think that this is caused by fixed
> dma sizes hardcoded for all SoCs.
>
> Use the dma-size implementation from SDK in a per SoC manner.
>
> Fixes: 656e705243fd ("net-next: mediatek: add support for MT7623
> ethernet")
> Suggested-by: Daniel Golle <daniel at makrotopia.org>
> Signed-off-by: Frank Wunderlich <frank-w at public-files.de>
> ---
> sorry for multiple posting in first version
>
> based on SDK:
>
https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/fac194d6253d339e15c651c052b532a449a04d6e
>
> v2:
> - fix unused variable 'addr' in 32bit build
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 105 +++++++++++++----
> --
> drivers/net/ethernet/mediatek/mtk_eth_soc.h | 9 +-
> 2 files changed, 78 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index cae46290a7ae..f1ff1be73926 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
..............
> @@ -5176,6 +5201,8 @@ static const struct mtk_soc_data mt7981_data =
> {
> .desc_size = sizeof(struct mtk_tx_dma_v2),
> .dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
> .dma_len_offset = 8,
> + .dma_size = MTK_DMA_SIZE(4K),
> + .fq_dma_size = MTK_DMA_SIZE(2K),
> },
> .rx = {
> .desc_size = sizeof(struct mtk_rx_dma),
> @@ -5183,6 +5210,7 @@ static const struct mtk_soc_data mt7981_data =
> {
> .dma_l4_valid = RX_DMA_L4_VALID_V2,
> .dma_max_len = MTK_TX_DMA_BUF_LEN,
> .dma_len_offset = 16,
> + .dma_size = MTK_DMA_SIZE(1K),
> },
> };
>
> @@ -5202,6 +5230,8 @@ static const struct mtk_soc_data mt7986_data =
> {
> .desc_size = sizeof(struct mtk_tx_dma_v2),
> .dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
> .dma_len_offset = 8,
> + .dma_size = MTK_DMA_SIZE(4K),
> + .fq_dma_size = MTK_DMA_SIZE(2K),
> },
> .rx = {
> .desc_size = sizeof(struct mtk_rx_dma),
> @@ -5209,6 +5239,7 @@ static const struct mtk_soc_data mt7986_data =
> {
> .dma_l4_valid = RX_DMA_L4_VALID_V2,
> .dma_max_len = MTK_TX_DMA_BUF_LEN,
> .dma_len_offset = 16,
> + .dma_size = MTK_DMA_SIZE(1K),
> },
> };
>
> @@ -5228,6 +5259,8 @@ static const struct mtk_soc_data mt7988_data =
> {
> .desc_size = sizeof(struct mtk_tx_dma_v2),
> .dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
> .dma_len_offset = 8,
> + .dma_size = MTK_DMA_SIZE(4K),
> + .fq_dma_size = MTK_DMA_SIZE(4K),
> },
> .rx = {
> .desc_size = sizeof(struct mtk_rx_dma_v2),
> @@ -5235,6 +5268,7 @@ static const struct mtk_soc_data mt7988_data =
> {
> .dma_l4_valid = RX_DMA_L4_VALID_V2,
> .dma_max_len = MTK_TX_DMA_BUF_LEN_V2,
> .dma_len_offset = 8,
> + .dma_size = MTK_DMA_SIZE(1K),
> },
> };
..............
Thank you for assisting in upstreaming this patch from the mainline MTK
driver.
Currently, the RSS feature has not been upstreamed. It is recommanded
to use 2048 DMADs for both TX and RX Rings on the MT7981/86/88.
More information about the linux-arm-kernel
mailing list