Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp476100rdb; Fri, 26 Jan 2024 01:02:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcShOQuDq4XTTRX+BPDB03cciTTy6gme9/o9uApjfg88MCwidOPGS6JgNGH1A2NTK+OwIF X-Received: by 2002:a05:620a:3786:b0:783:85fc:e17d with SMTP id pi6-20020a05620a378600b0078385fce17dmr933198qkn.52.1706259736758; Fri, 26 Jan 2024 01:02:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706259736; cv=pass; d=google.com; s=arc-20160816; b=sAk4uq1jI8auA49dSLdsqZr0ODMv7i40L/lnYl3HHUxnhGkt8Sk7PNCtVBiwpDk0Iu 8pYsoI64iaK4einvvx5ob+B8r8kVvHhbporBwC+ob0pZ9sdVpp4UXeF7CHp9dqbrjbru TIZPFIkH5nEw+IMnawMfzZolL/cD4pdjvk20VqBVZN5znjSpBbqVSBkyYLnfNpiOykrk rSNh5DH5nztT5en3+1SY3xcOC8Zdzu6aYpsvMr8726HFfawzgUqyixgpKHuEpP9Hv5m5 ZTKChY9aDGNugtjBhLhCcAi0I4n9x8BVjKzvAwNuSwO8QyKfdwBQ0Im2vxoc4hXEWszS +Mqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=sIHoB0tO6UnT+9FCYFnrGjYBTfQtZYcWxPgffZVZp6I=; fh=lNbqm66A/wpozhFc+nLwOwrPosFlY20hAnN9jlxMS5I=; b=hmnAROevomGKi+tDQOIylb0heFY65bv7Jc1z0ipEpM9hXw1kCat561BDwAUWrytj67 NzVN0gHXRLMLKwiQKokpeNAOaosze+w2apvhr2qha4MTzIL4AHvRB5A04Czt5bBzGg8e OMkbWNkNGfSWdE+DCccp7utff2PhxawFccRbBeQm7HXx06BIE1FCwFsn7jQ5ocZnOKt5 UucsQOaauF7lqcvXp8FMNjhTQfZ1tLVWVKYCjnpfZ36tXByY8diK6K87lw2JGop8eV1C TaOhadXyVrQRGqmGfHbcRh/K4lWjVKlybmNDo8sAaKeMxlXmJV2edImFOEI/3e4JZ4UL AYPg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RqQ2AlIB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b21-20020a05620a119500b00783d7d4f221si249173qkk.634.2024.01.26.01.02.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 01:02:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RqQ2AlIB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-39709-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39709-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id EC1131C25A3C for ; Fri, 26 Jan 2024 09:01:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6498959B7D; Fri, 26 Jan 2024 07:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RqQ2AlIB" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA16759178; Fri, 26 Jan 2024 07:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706254791; cv=none; b=YhegbTBQAdT3uylY2/bq+rzXOK3ACAmhl7FjrMBnqI2rROeqFKb8/Ia9sqf1bYB9T+U3tt5LQNOYZrNyVnL/cyfUCCYLmR3fhLinwMGj/spFNC8et98fUv4VPfMthmFKbfKRmUj7RpOld6qbR5e5Sy4H6LjzMl91PEiPi07xbWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706254791; c=relaxed/simple; bh=/5nfxaGJlWyx/ZQwtNE2vSIVj6OswyRL9cg0CrI3JNA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=RXFo3DzTtcQeT9URk8tESXd82Q1+NMUV0NfYA4tcp7fvoOU4o0XTmVFtRnm2bhKkL7sSjj+hJumecRs+vlxJ3jcoqR9q+E6if2C857IpZVrQVFCe5rBGT62+JUTGbK0MtAJYgfyFu3m3RgxlUFS9zCdCHB+yCgb90zMlDqZko38= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RqQ2AlIB; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d70a98c189so451025ad.1; Thu, 25 Jan 2024 23:39:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706254789; x=1706859589; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sIHoB0tO6UnT+9FCYFnrGjYBTfQtZYcWxPgffZVZp6I=; b=RqQ2AlIBmTlEUKIs2ot5Gzyc+2tuOSzNngNAowUL8ZSY8YjFMn716lWlianjMQae0Q GxAfMBgfDplDw6Otn62MBvXbglRhDbN8yQKAEaaND6mTXuud0ex2J3JwioFMMAD5f1bJ vBpgNdo4eIvsmExgWIbmzPeP7ELoY1tI7uoQF8pnM3gaz2PmxN5VMeCunn9tJfDGGBob jr7yt4/LBAhSfJNpJQGf+zOFpWNgKt3oxTEihDRaclRztLcdBgSAc6IkfLyyXepjvK8n OF0ZVk7HFuN3xJ2Opb7KniqChBqf4P83ZohNdC2dPbRsr+XweYm1NpUDZM8mVJeZnG2z jt8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706254789; x=1706859589; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sIHoB0tO6UnT+9FCYFnrGjYBTfQtZYcWxPgffZVZp6I=; b=cMKEy8C6OccHVcXUf7Yt+bUTuSkoQNxcvzDjr9l8ogDq1SaCveZofLNtdQ45DJwMsI AFnI6OhFyxk2vv5KuvhAdafGdWXxBUDtkETF/v5lXcbD35ITGFmmgyscwW9Wa32WuvhJ qKOx8EJKMac2TXMtWh5PuD2bIYxX+o1MZVFfkACsTeWOhT4BKBl49ZB/EBghR/E5pDCg QFkoKXrOguRTRJHWU10LTwOrC1D3d/JfWduSkiLc/B/9dIgSsV3Y6j2WJ3+DLfr7E+cN zv/fSGgzK9U3IG4tEXg79LjCVziIuh6Jl9EadS1np7AVSocNj8XJrx8HfmljuRYy+smF hROQ== X-Gm-Message-State: AOJu0YxOCd2764EFbKIzfrulXdI1Qr9UtVDlecokpG4dkzlhyYVSUK6E dH8c5jtxB71gLyOtGnhkkHWUbJp3tbyuRbiNGq5dWwYrGZY9dWa7 X-Received: by 2002:a05:6a20:1594:b0:19c:7690:12ec with SMTP id h20-20020a056a20159400b0019c769012ecmr885727pzj.5.1706254789065; Thu, 25 Jan 2024 23:39:49 -0800 (PST) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id sw12-20020a17090b2c8c00b0029105d49b2dsm605619pjb.20.2024.01.25.23.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 23:39:48 -0800 (PST) From: Furong Xu <0x1207@gmail.com> To: "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto , Simon Horman Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net v2] net: stmmac: xgmac: fix handling of DPP safety error for DMA channels Date: Fri, 26 Jan 2024 15:39:28 +0800 Message-Id: <20240126073928.1070729-1-0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 56e58d6c8a56 ("net: stmmac: Implement Safety Features in XGMAC core") checks and reports safety errors, but leaves the Data Path Parity Errors for each channel in DMA unhandled at all, lead to a storm of interrupt. Fix it by checking and clearing the DMA_DPP_Interrupt_Status register. Fixes: 56e58d6c8a56 ("net: stmmac: Implement Safety Features in XGMAC core") Signed-off-by: Furong Xu <0x1207@gmail.com> --- Changes in v2: - explicit enable Data Path Parity Protection - add new counters to stmmac_safety_stats - add detailed log --- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 + .../ethernet/stmicro/stmmac/dwxgmac2_core.c | 58 ++++++++++++++++++- 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 721c1f8e892f..b4f60ab078d6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -216,6 +216,7 @@ struct stmmac_safety_stats { unsigned long mac_errors[32]; unsigned long mtl_errors[32]; unsigned long dma_errors[32]; + unsigned long dma_dpp_errors[32]; }; /* Number of fields in Safety Stats */ diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 207ff1799f2c..5c67a3f89f08 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -303,6 +303,8 @@ #define XGMAC_RXCEIE BIT(4) #define XGMAC_TXCEIE BIT(0) #define XGMAC_MTL_ECC_INT_STATUS 0x000010cc +#define XGMAC_MTL_DPP_CONTROL 0x000010e0 +#define XGMAC_DDPP_DISABLE BIT(0) #define XGMAC_MTL_TXQ_OPMODE(x) (0x00001100 + (0x80 * (x))) #define XGMAC_TQS GENMASK(25, 16) #define XGMAC_TQS_SHIFT 16 @@ -385,6 +387,7 @@ #define XGMAC_DCEIE BIT(1) #define XGMAC_TCEIE BIT(0) #define XGMAC_DMA_ECC_INT_STATUS 0x0000306c +#define XGMAC_DMA_DPP_INT_STATUS 0x00003074 #define XGMAC_DMA_CH_CONTROL(x) (0x00003100 + (0x80 * (x))) #define XGMAC_SPH BIT(24) #define XGMAC_PBLx8 BIT(16) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index eb48211d9b0e..bcd7daba53af 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -830,6 +830,43 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= { { false, "UNKNOWN", "Unknown Error" }, /* 31 */ }; +static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error"; +static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error"; +static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = { + { true, "TDPES0", dpp_tx_err }, + { true, "TDPES1", dpp_tx_err }, + { true, "TDPES2", dpp_tx_err }, + { true, "TDPES3", dpp_tx_err }, + { true, "TDPES4", dpp_tx_err }, + { true, "TDPES5", dpp_tx_err }, + { true, "TDPES6", dpp_tx_err }, + { true, "TDPES7", dpp_tx_err }, + { true, "TDPES8", dpp_tx_err }, + { true, "TDPES9", dpp_tx_err }, + { true, "TDPES10", dpp_tx_err }, + { true, "TDPES11", dpp_tx_err }, + { true, "TDPES12", dpp_tx_err }, + { true, "TDPES13", dpp_tx_err }, + { true, "TDPES14", dpp_tx_err }, + { true, "TDPES15", dpp_tx_err }, + { true, "RDPES0", dpp_rx_err }, + { true, "RDPES1", dpp_rx_err }, + { true, "RDPES2", dpp_rx_err }, + { true, "RDPES3", dpp_rx_err }, + { true, "RDPES4", dpp_rx_err }, + { true, "RDPES5", dpp_rx_err }, + { true, "RDPES6", dpp_rx_err }, + { true, "RDPES7", dpp_rx_err }, + { true, "RDPES8", dpp_rx_err }, + { true, "RDPES9", dpp_rx_err }, + { true, "RDPES10", dpp_rx_err }, + { true, "RDPES11", dpp_rx_err }, + { true, "RDPES12", dpp_rx_err }, + { true, "RDPES13", dpp_rx_err }, + { true, "RDPES14", dpp_rx_err }, + { true, "RDPES15", dpp_rx_err }, +}; + static void dwxgmac3_handle_dma_err(struct net_device *ndev, void __iomem *ioaddr, bool correctable, struct stmmac_safety_stats *stats) @@ -841,6 +878,13 @@ static void dwxgmac3_handle_dma_err(struct net_device *ndev, dwxgmac3_log_error(ndev, value, correctable, "DMA", dwxgmac3_dma_errors, STAT_OFF(dma_errors), stats); + + value = readl(ioaddr + XGMAC_DMA_DPP_INT_STATUS); + writel(value, ioaddr + XGMAC_DMA_DPP_INT_STATUS); + + dwxgmac3_log_error(ndev, value, false, "DMA_DPP", + dwxgmac3_dma_dpp_errors, + STAT_OFF(dma_dpp_errors), stats); } static int @@ -881,6 +925,12 @@ dwxgmac3_safety_feat_config(void __iomem *ioaddr, unsigned int asp, value |= XGMAC_TMOUTEN; /* FSM Timeout Feature */ writel(value, ioaddr + XGMAC_MAC_FSM_CONTROL); + /* 5. Enable Data Path Parity Protection */ + value = readl(ioaddr + XGMAC_MTL_DPP_CONTROL); + /* already enabled by default, explicit enable it again */ + value &= ~XGMAC_DDPP_DISABLE; + writel(value, ioaddr + XGMAC_MTL_DPP_CONTROL); + return 0; } @@ -914,7 +964,12 @@ static int dwxgmac3_safety_feat_irq_status(struct net_device *ndev, ret |= !corr; } - err = dma & (XGMAC_DEUIS | XGMAC_DECIS); + /* DMA_DPP_Interrupt_Status is indicated by MCSIS bit in + * DMA_Safety_Interrupt_Status, so we handle DMA Data Path + * Parity Errors here + */ + err = (dma & (XGMAC_DEUIS | XGMAC_DECIS)) || + (dma & XGMAC_MCSIS); corr = dma & XGMAC_DECIS; if (err) { dwxgmac3_handle_dma_err(ndev, ioaddr, corr, stats); @@ -930,6 +985,7 @@ static const struct dwxgmac3_error { { dwxgmac3_mac_errors }, { dwxgmac3_mtl_errors }, { dwxgmac3_dma_errors }, + { dwxgmac3_dma_dpp_errors }, }; static int dwxgmac3_safety_feat_dump(struct stmmac_safety_stats *stats, -- 2.34.1