From patchwork Mon Apr 8 01:29:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 13620471 X-Patchwork-Delegate: kuba@kernel.org Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2106.outbound.protection.partner.outlook.cn [139.219.17.106]) (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 773B64685; Mon, 8 Apr 2024 01:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=139.219.17.106 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712540783; cv=fail; b=G+MHKIN4P0KyoGLx+dmnTVLpt1rlAPBWDP1YgVd4QzmpyGOxtnc6v8ezLD5NP+WC5jHIIV6CtzfeeuEqOFPT+Bb5trfRIsxfR3PvXnihCnrH0kSrbLLupT6c4wbjIXy01f7Bcl4jHQXS6XBgyRQTnJH27rCa+J5o07ZBAxEx9tU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712540783; c=relaxed/simple; bh=JQxhhyRt8yD4RwyZ0R7BN2i2rF8WZQgn99xp5tlDhew=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LxnDpIPyEOquxid3j6h6E2eCERtkGIu8fpbu+bgbXDZiNwMIJmEcMPERbj7+y7gJwUt1J2NW6HA3cki5wfrli3twio3jaCBQGiWKPvl89k0Zfu0WFdcJmuOfH2AwzPuHr8e3nKKZLqKsuNdJrQebiILrJBeFDy3ogExdKLqMOA4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com; spf=pass smtp.mailfrom=starfivetech.com; arc=fail smtp.client-ip=139.219.17.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=llCK7Nx4rpXB7hHnYkRQt6CQyCHfzUlkvBHpkQmQRuwgxRwKtgDfCb48Uf5uCRbVOlb6P+aoKYEB3Woc9K6ST43rqWkmX13zQe8sdMU85RTHzWttvrkPdeQeaYVCONj+kzwn3ZxHMtsj4UgkVKQP7rVDac+V/xn5ROpYAL7tyi16GcowWWTnkPg+hN+XfmKphyqQZF65OquBGlqT9E/iyMemdtnXv317xaZ7MZaULKaGr2+iyMjtQS2r6cz3hfhFebV/SG8MTLKSxJVlyQTpQ/UrNjIJra1OxtTeLFnn6DPo07kZC51E5LXmJFX/M/Eal6ivwtj/NPxhHS8y8JWjCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2QX0SfnClk7LRWZIRU9iyQDvzeg5wiOTW+vSlPOWGvs=; b=C5S7Q2jAjlWqjuokBcRS7m4l9pZ+ALDbZIBMSK1b0C7Cq89xyvDW56bzerZpv/VyIHuj3fbAiShnx2d40zc6+QjnaOctMZZjQbVMUdr5xpfPJX45Ckd/EhKnun+AIzhW7eErvveufjU4kxVBn3QLhoPJVK/vriCgPN+/U03lQmeVIxS4Fy8vlbqn4QQJoOHGOkCxpqnBTWX4ihf/b6v1RXHXHsmkgVnglfkAxJtwEFdE1/fcfcLTXDd6HYQrUVgwzLf2Hxtny34YzInz+svLX7LYudnvnyTV9dsrcqNlooNtJN7jOnHgLjum+JsXtl/mCdi8LI44o2vsuhxyIp7Plw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) by SHXPR01MB0605.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Mon, 8 Apr 2024 01:30:16 +0000 Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::a137:b8e5:8a0e:ca9f]) by SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::a137:b8e5:8a0e:ca9f%4]) with mapi id 15.20.7409.053; Mon, 8 Apr 2024 01:30:16 +0000 From: Minda Chen To: Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] net: stmmac: mmc_core: Add GMAC LPI statistics Date: Mon, 8 Apr 2024 09:29:42 +0800 Message-Id: <20240408012943.66508-2-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240408012943.66508-1-minda.chen@starfivetech.com> References: <20240408012943.66508-1-minda.chen@starfivetech.com> X-ClientProxiedBy: ZQ0PR01CA0012.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:5::6) To SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SHXPR01MB0863:EE_|SHXPR01MB0605:EE_ X-MS-Office365-Filtering-Correlation-Id: d924d458-a657-4fb8-ff29-08dc576b71c3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S2Q/iSEaUVp2sdOviLvzC7Z/x6tyh1b+FlvJI3JVk4cH2oe4eSQ/+xuDlmZgXlOIYQ0M3mhHePWLKhmrWhovl+cL4LrqvAuWzndu5yE4+8U+rWZFp5QhwR9UaBVBH3P6pL57aJFcHIDm2yq0jYJw+BqfklDOmcUkSSRwfx0lPPs9fYJLCzvrCaHehxvAp/8YBhFRN4SN4m6mAA9IfrzKwyD/Ea5U5HGRMz2NTUYqgnUo8+pXrLOV/MuWlEL5Rpgt8OjeGeF2z+xwHzChWqNywwLW+AWQ+1p6yK1kLAI3cx16/Pisw7Vui/CuYZ9Dr2LoMWQ0IPr0UIjsfurq0fQmvyJSAkenlsbb9vtKMUZ7yBWW6V5TDvLVKTW7ZWM1WASkrhUCQmeUml+EgX3ZjyJ7ggT5jxd9TXuzUgtt65Y0yxyzsiSIWfONHi0m+Jq6lYnnV5+CSvBdZzvJdYE1GDTJkyY1HMlrzzk5tMLKsj1zBix7lu0P+xzB+MjUJ97G/aujfbgm98Uze/y9fVH95pVOLJPkbGPeoYgXqF9uPaR4sMfp1nI3YlTD0eV3kH+rhcYr4zpIlHtHhBSBsflHp5VEOyzXzTFGXsMbs7I6kkby+/gcxjwABtldpOsDbl49F3/G X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(366007)(41320700004)(7416005)(52116005)(1800799015)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MJUaj0hQtLPYrfFxoWasN40NbM5vVLA0JrGsMsBco2lqR5X9IDXFLeH3CvahjJp13k4S0dRnlMRlahY8WEu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cs3YKA+iQdCLNUtvis8ruhDo9/hFlioE2AZJIPLuVibOPsShuKt861v69elPeenxm7sbYBSCN0siD3xUKZDe4E7+HVM2aW4jmoAPS/rFlDEJsM+RWet5AAl+cgfCow6JQKPl3mH2mwLTC3K9a+b9jVhHdjDiLUljRmfeyF2SpKXzryDrB0M+Yw/rssf77FravNk845BIgoeUkMaS5en674HLzPmBG/CYLz8xWf3UpywzQUcvj/+Cr7Pqm9g3Yrr6QmeowelsIw9L4UrSHExKcV1SiinFPtOaPdOHx4p2TZJns8s3B8uR+IWriB/QS2qzp1vkVb1+4gp8BiMR8KDG4jWR/QsflNMGM473YukGmT8XMMGHCNieJmBzfH0Q3+ZNJ7Du3fsyoITknShF/FJCqE6rX0M8Do1OdPbW68OyvnOLeRHIvfYQktKfGNvlgzEmIHXsqQ== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: d924d458-a657-4fb8-ff29-08dc576b71c3 X-MS-Exchange-CrossTenant-AuthSource: SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2024 01:30:16.6256 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bIVk/FFw3CZQJfSM0XvOTT9LPGFcXL0P6nUdul99jA7SYO3Cg0WUof/C5UTNj9OFxF7uDMDa7nMGNAnwWsBo9Z8A0bz1p8YQsJGcIiB5v3w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0605 X-Patchwork-Delegate: kuba@kernel.org XGMAC MMC has already added LPI statistics. GMAC MMC lack of these statistics. Add register definition and reading the LPI statistics from registers. Signed-off-by: Minda Chen Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c index 7eb477faa75a..b0db5f4e8fe8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c @@ -79,6 +79,12 @@ #define MMC_RX_FIFO_OVERFLOW 0xd4 #define MMC_RX_VLAN_FRAMES_GB 0xd8 #define MMC_RX_WATCHDOG_ERROR 0xdc + +#define MMC_TX_LPI_USEC 0xec +#define MMC_TX_LPI_TRAN 0xf0 +#define MMC_RX_LPI_USEC 0xf4 +#define MMC_RX_LPI_TRAN 0xf8 + /* IPC*/ #define MMC_RX_IPC_INTR_MASK 0x100 #define MMC_RX_IPC_INTR 0x108 @@ -283,6 +289,8 @@ static void dwmac_mmc_read(void __iomem *mmcaddr, struct stmmac_counters *mmc) mmc->mmc_tx_excessdef += readl(mmcaddr + MMC_TX_EXCESSDEF); mmc->mmc_tx_pause_frame += readl(mmcaddr + MMC_TX_PAUSE_FRAME); mmc->mmc_tx_vlan_frame_g += readl(mmcaddr + MMC_TX_VLAN_FRAME_G); + mmc->mmc_tx_lpi_usec += readl(mmcaddr + MMC_TX_LPI_USEC); + mmc->mmc_tx_lpi_tran += readl(mmcaddr + MMC_TX_LPI_TRAN); /* MMC RX counter registers */ mmc->mmc_rx_framecount_gb += readl(mmcaddr + MMC_RX_FRAMECOUNT_GB); @@ -316,6 +324,9 @@ static void dwmac_mmc_read(void __iomem *mmcaddr, struct stmmac_counters *mmc) mmc->mmc_rx_fifo_overflow += readl(mmcaddr + MMC_RX_FIFO_OVERFLOW); mmc->mmc_rx_vlan_frames_gb += readl(mmcaddr + MMC_RX_VLAN_FRAMES_GB); mmc->mmc_rx_watchdog_error += readl(mmcaddr + MMC_RX_WATCHDOG_ERROR); + mmc->mmc_rx_lpi_usec += readl(mmcaddr + MMC_RX_LPI_USEC); + mmc->mmc_rx_lpi_tran += readl(mmcaddr + MMC_RX_LPI_TRAN); + /* IPv4 */ mmc->mmc_rx_ipv4_gd += readl(mmcaddr + MMC_RX_IPV4_GD); mmc->mmc_rx_ipv4_hderr += readl(mmcaddr + MMC_RX_IPV4_HDERR);