Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1490599lqm; Thu, 2 May 2024 17:33:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVosATEtMAuEYTD3/Qpwa0dpnv1W+1ZOCRHGv5oTKoO9qEbOOxXqGfl4HOx6xhvrxR0Erh78QSd8horiDxDjZ4VXZ88gs5d4fu/Siqk8w== X-Google-Smtp-Source: AGHT+IFAdTuTh284PnLwb/Kr70XJdxSlMvllys5UehS0UUq49t1xepgAbNGL7j5KLYemBmCwkiDd X-Received: by 2002:a05:6a20:d428:b0:1a7:427b:8216 with SMTP id il40-20020a056a20d42800b001a7427b8216mr1123943pzb.55.1714696386280; Thu, 02 May 2024 17:33:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714696386; cv=pass; d=google.com; s=arc-20160816; b=Qm8ULcr0qzHvZo+KEx5QO1RY6u4IqWlkjO2W1OCxNO80Mx5qUBR/38wgSJyFe8Gg0W AMEhbufk6+LnOsjySvYUm+KMhmX8UGGUTdP/4OKRPgUFvRyp8PR/49ujiPku0belWkzA 1e1xjmVMWCnPMYx2ygV5XK88zw/S7VLFdqSK8jvqTQLhUC5VmvTFT739a2eNax1GAIj0 Hv3c09VnCfQYHQgIyu5ywt+ObJFIeUMvYXxmnIvQoN/x4Zzj+Upq0nJWCy5ZoQfUvkKw nzfxmFcFK1v762kJfTa0DHvZOldm6sVjcrS66KR1oOeLzZPQfBK5FTnbIKtSo5NRTu6S GSAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:to :from:date; bh=BKwua5KM+C5sVk+BUByFODV+a/CSgWYcDBQk4pj7Big=; fh=xXgg1UL4/JfMIN+5W7QMVK6ZHaQPWmswZKxwEKSX3ss=; b=fffaQ8DT3/+x7nRHWJKCpUEFysV82Im0LO+h0HJqpga9yjGIXw2awQo5emGT/7nvjL e15MZgdoJJEkPlKgAgeFfDGgjY9XJ5PbaO+MyxYgG64NBt/uGFok9zSTydhl72u5F+5e RPSaYwVPXSoskCkU8Vo3qo5ofV8xkOavScTfFhdTZA7Q/kD6FJ1rVzvgbxb63h1nonrn pvt20VTbmAmYYcuIeyfu+m3VMoS2WOp9Eqw054CaLx5skv2HPj1d/dvtdwE15a+Abb2o n1E64/wfRTofhjorQM8Rtx4CTOfxPY1ItuuAO6yOhtxzdkpgSXu/8U/rcPx74Cfcv8Av y4uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-167105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167105-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k12-20020a17090a62cc00b002b27c52ded8si1979161pjs.51.2024.05.02.17.33.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 17:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-167105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-167105-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-167105-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E6C762853A3 for ; Fri, 3 May 2024 00:33:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AD3ABE6C; Fri, 3 May 2024 00:32:54 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 536F88BEF; Fri, 3 May 2024 00:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714696373; cv=none; b=GtIQFkqZAbFDJa9+1c7uOU9lofq+4WnNY0mo+sOPVf2Pvh6R8KlLMlV+HicqB0UAnDppysVD7RB3nYcKvyrT47kRtzq372hfKJFe6VMUExIO5YPJ+wQcty5lDEEqsm8z6G2HJuOcCsMkJAX1LEPwROID4sEZCkukF2T+n/v6Z30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714696373; c=relaxed/simple; bh=SdCVeQJiT79EaxLVKjj2UoRsmDFDMTaLPUOwkaQzVCY=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NGvANPvyKhZ0J9cNPB5JMexrsSpqBrhqq0ab2OzSCodRkub5Ccn47k8xVZvIsUbroaHLz2hp6zZbjtWEDiaok42Ot31HNvY12FTPkywfM107AJw/4vzpUmdzu7MK4S4XsJVFX6LTtzYQwSQa0yFNkbVMVdXnEqqNojG3TfTvosw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.97.1) (envelope-from ) id 1s2gqz-000000005JV-39Cy; Fri, 03 May 2024 00:32:45 +0000 Date: Fri, 3 May 2024 01:32:42 +0100 From: Daniel Golle To: Felix Fietkau , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net 2/2] net: ethernet: mediatek: use QDMA instead of ADMAv2 on MT7981 and MT7986 Message-ID: <7815c0e3300563ec1d5a15d2080931461c5b2a9a.1714696206.git.daniel@makrotopia.org> References: <5f5d8880a9ec6339688828d6f33bc95e99c16d81.1714696206.git.daniel@makrotopia.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f5d8880a9ec6339688828d6f33bc95e99c16d81.1714696206.git.daniel@makrotopia.org> ADMA is plagued by RX hangs which can't easily detected and happen upon receival of a corrupted package. Use QDMA just like on netsys v1 which is also still present and usable, and doesn't suffer from that problem. Fixes: 197c9e9b17b11 ("net: ethernet: mtk_eth_soc: introduce support for mt7986 chipset") Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Signed-off-by: Daniel Golle --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 46 ++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 3eefb735ce19..d7d73295f0dc 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -110,16 +110,16 @@ static const struct mtk_reg_map mt7986_reg_map = { .tx_irq_mask = 0x461c, .tx_irq_status = 0x4618, .pdma = { - .rx_ptr = 0x6100, - .rx_cnt_cfg = 0x6104, - .pcrx_ptr = 0x6108, - .glo_cfg = 0x6204, - .rst_idx = 0x6208, - .delay_irq = 0x620c, - .irq_status = 0x6220, - .irq_mask = 0x6228, - .adma_rx_dbg0 = 0x6238, - .int_grp = 0x6250, + .rx_ptr = 0x4100, + .rx_cnt_cfg = 0x4104, + .pcrx_ptr = 0x4108, + .glo_cfg = 0x4204, + .rst_idx = 0x4208, + .delay_irq = 0x420c, + .irq_status = 0x4220, + .irq_mask = 0x4228, + .adma_rx_dbg0 = 0x4238, + .int_grp = 0x4250, }, .qdma = { .qtx_cfg = 0x4400, @@ -1107,7 +1107,7 @@ static bool mtk_rx_get_desc(struct mtk_eth *eth, struct mtk_rx_dma_v2 *rxd, rxd->rxd1 = READ_ONCE(dma_rxd->rxd1); rxd->rxd3 = READ_ONCE(dma_rxd->rxd3); rxd->rxd4 = READ_ONCE(dma_rxd->rxd4); - if (mtk_is_netsys_v2_or_greater(eth)) { + if (mtk_is_netsys_v3_or_greater(eth)) { rxd->rxd5 = READ_ONCE(dma_rxd->rxd5); rxd->rxd6 = READ_ONCE(dma_rxd->rxd6); } @@ -2028,7 +2028,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, break; /* find out which mac the packet come from. values start at 1 */ - if (mtk_is_netsys_v2_or_greater(eth)) { + if (mtk_is_netsys_v3_or_greater(eth)) { u32 val = RX_DMA_GET_SPORT_V2(trxd.rxd5); switch (val) { @@ -2140,7 +2140,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb->dev = netdev; bytes += skb->len; - if (mtk_is_netsys_v2_or_greater(eth)) { + if (mtk_is_netsys_v3_or_greater(eth)) { reason = FIELD_GET(MTK_RXD5_PPE_CPU_REASON, trxd.rxd5); hash = trxd.rxd5 & MTK_RXD5_FOE_ENTRY; if (hash != MTK_RXD5_FOE_ENTRY) @@ -2690,7 +2690,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) rxd->rxd3 = 0; rxd->rxd4 = 0; - if (mtk_is_netsys_v2_or_greater(eth)) { + if (mtk_is_netsys_v3_or_greater(eth)) { rxd->rxd5 = 0; rxd->rxd6 = 0; rxd->rxd7 = 0; @@ -3893,7 +3893,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset) else mtk_hw_reset(eth); - if (mtk_is_netsys_v2_or_greater(eth)) { + if (mtk_is_netsys_v3_or_greater(eth)) { /* Set FE to PDMAv2 if necessary */ val = mtk_r32(eth, MTK_FE_GLO_MISC); mtk_w32(eth, val | BIT(4), MTK_FE_GLO_MISC); @@ -5169,11 +5169,11 @@ static const struct mtk_soc_data mt7981_data = { .dma_len_offset = 8, }, .rx = { - .desc_size = sizeof(struct mtk_rx_dma_v2), - .irq_done_mask = MTK_RX_DONE_INT_V2, + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, - .dma_len_offset = 8, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, }, }; @@ -5195,11 +5195,11 @@ static const struct mtk_soc_data mt7986_data = { .dma_len_offset = 8, }, .rx = { - .desc_size = sizeof(struct mtk_rx_dma_v2), - .irq_done_mask = MTK_RX_DONE_INT_V2, + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, - .dma_len_offset = 8, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, }, }; -- 2.45.0