From patchwork Thu Feb 25 09:01:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 387577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDAD6C433E0 for ; Thu, 25 Feb 2021 09:07:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BD5664F0E for ; Thu, 25 Feb 2021 09:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236078AbhBYJGK (ORCPT ); Thu, 25 Feb 2021 04:06:10 -0500 Received: from mail-vi1eur05on2054.outbound.protection.outlook.com ([40.107.21.54]:38956 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234513AbhBYJCU (ORCPT ); Thu, 25 Feb 2021 04:02:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lzNJYcwk28hycykV53kewljbrk18j3Zzr0l4GKySpeT9RvTwhAjGR4pwFjgENSWCsYssh8Yr67l+S/WcUA35svomH5OtPpU+M8PpgzAUuceCdIrUQBAH30AkA5CSKlPHDqeMPP3ZjkhRy+Fv1KJ8KFydIeTwqhO9vERVxfcJllRRBu+RrhAo8B1zLs6zqKjvqbYn6p6iKoKCQuDGhpKBXts2/BEhTCwDouArYND/gBEFB0KfisIveiwV4RCdEIyOdnvPGxT0tcwRGrgWlRsyc4uflqGBgUt3HCSvoKmTJLGNAX2YGRVIzMn+VekEmAPUv1xHusQDqPxer+uGMf9ing== 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-SenderADCheck; bh=HtJGaCcW5v0HrQsesDguxrkhWUbHUpnuuBm0g7E4itQ=; b=BdiuFC+8JiB/ZH4iDhMnyyjDKe6W1NLe0pk4jprhZJSM6XXoMgMbZle4rB41BSYK6XkS0h0yochnwlZsWZ5EnZDoPGBiCKe7cGa7oODFExRRJzq9jDeY/T6n1tMK1377I05/FT0nAr6rkODnVVFCPM0jmUF268PHIG++nXZbkaLsAyybHKl29u9v2hr+VaeDFBRuVg3F6TBF9hFh7/1Dzld89I4McCGh0uULa5kT5YaCrMdJrHpk7kpue0UBhENS2/ke1PnR5s3k00mKwG19C3QAmC+9j3JxB0sJ0Vilu8RP/XsgMVoQRh7EJ/1yPzYVzEIdFy7rTHBB9sDgGfbrCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HtJGaCcW5v0HrQsesDguxrkhWUbHUpnuuBm0g7E4itQ=; b=g8Qgcq6wEtfzLgZ14CCFRfDWjSP4iNJhcwEudD5WtiffBZk3jStTE9XFJkJkdLIYxhkbusCUYPYOR8zOQHIbmZJbKTAOuEeGNqmtBEwOtz0FmmRSYzWuRBo+qjlHVPpYnLuKDoFqo0DTFCTC97cJA9bxqePVt9ggbBtrds++jBU= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DBAPR04MB7430.eurprd04.prod.outlook.com (2603:10a6:10:1aa::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Thu, 25 Feb 2021 09:01:32 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978%4]) with mapi id 15.20.3846.045; Thu, 25 Feb 2021 09:01:32 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V5 net 1/5] net: stmmac: stop each tx channel independently Date: Thu, 25 Feb 2021 17:01:10 +0800 Message-Id: <20210225090114.17562-2-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225090114.17562-1-qiangqing.zhang@nxp.com> References: <20210225090114.17562-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 09:01:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fc0feba1-13a6-45f3-11b2-08d8d96bf1dc X-MS-TrafficTypeDiagnostic: DBAPR04MB7430: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qBOG0467/Sb+53smRF18c+W/rR9dDjBOXlu9AIagZMGD6zZhrF25VJ5mFWNi39tYITfpQ7eAdwjQEoZoFZ8Fa4Cpzwc47eYZRtKszciPjvYPzTP/S87w7mTqemCS9tpST0og4FikZVbdBtA9BQ3WlsWQXa5W+u0kktv9D4fMvsrCxwGsW4Y0t2IhzucIeS48DSaBZbZuJ5ORCS2o3e3IW0rzc1ylYQMRP8WDj3raWdjngglfjtIiQ0x/402hvr9Bh3ZAF8Sf3eTJWAkeNSNCTH3xWlFJymXOlEwliEIT0A8NTbs+1cNbCR4iwBf+yH8zycEBuEcdKHH8xIhPq52zAnxu4eMU7iNhlaitaojofoXlYxYB308jHcuIxZxjCva169ex+DujnIuYpHGVK9oMRiCEH+1H3H++nx3GqtnpW1n7fx6I38iTZsWtRZRCgudV29zQrUU6NWG7e5LqBT4BYXtLjHprAC7bYQeYD+se0yXfFJleVC1Sd8PcPetYw3lYMe+ZgKsYQBk4pj5MYk8aKZdPSCiEXU9QQ/VxrHtIp+qK0LX7oZIQnFUCRDcsAP5w8mEn6yXK58iFfFgvY8xAAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(346002)(366004)(376002)(69590400012)(2906002)(86362001)(186003)(4744005)(8676002)(66556008)(66476007)(83380400001)(8936002)(36756003)(66946007)(478600001)(2616005)(6666004)(6486002)(1076003)(6512007)(316002)(16526019)(6506007)(52116002)(4326008)(5660300002)(956004)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: R7a3Cidol2rVXfOFlttWZFXrILUmY/f7H6JlBYbbRxLSRnuUONYI43YV/NLRMjjdWR1YNTuH/ys8atui7Qc0FQflDQTB89kwVHEREBcVbzU2/h/xOOrfth8J7FdgakrkCRcMNjWF+kggt5+PrmTI/kUchcEtphr1FUK4t1X8reM3fPNu9Mi0xMquUggw7TvuhrBJTYyon/XR0WFwxBy2CNRYMGth+FVdEIWhAxECRWFj8Pf1DihJtPtW9Nt0fliNqEePDPN4Uqw0A+s/U3fiXe3Qq1Y+BE+p/NurBTe9vDyyLWkCk/GO3cnSoTpxPbeEpN7t1mxBFhvQ67PK876+8aG/Cf2iU7s4SNzxof1O4MVbJTWdkWJTOoXgZ6ruFzRwTxAzN8hjOJM4IsgL8vJTczZncKjidcLeyFUjljwgrnicJ86XzEI/k+VtGGuLAqUTKmqPVAxKSpDRnrdSvMYjg9rQ8UhfFPHvTK2JAcfJAo07a12MPjKfdZpZFLiZB8XpOT2UKxPmXDI1wrEkSTr49PKfI+DSSL+6wvtPVvxxqjyGI9KfHqUjYn5jvPS70XgvO+F5gptL06m6i5Hi1HMOT8JVTemajjzJ1KOHO7gPEiaMJsbpsZvsTDzgAX8ZtSe9gY+bdZLxr5XiXpQSZt7e3yhH3VonfPkKc8bWoAHw1jJe2nD6GMuIkzrB7IV9VB8OQVLlOOMAyHgNjxxbaWme0EMiA/6tpfHpknO45f+b0pl6lrzazvgFqP/jMUIMINWudfVfN7THislz3+cpLvEPTb1bKH9j/PRnGQA4Hp9ueg8nqRgRXzLMLb8zVcJSPgxUEqjyim88MJ7MhHIynAVEqzIv/oonYHfVL3cB7Qhug1uhhFlJKqDk4Ov7ypEaUBCdutD9XjrNW0bGrk3gzZ+oM1YDZchDra9h1m9bJvWaeNDmwTE68Xx5lohc9kD1INw+DYtl/4CWn5veibxezWjgCd+LN3/fVsgjT6vQUhA7GeubxGd0jKa9Qpr/HM/yrqOExTtpopRVsodN9QA+9x7+Q8++WanjMGlkuzFYk+rwM+H0d1AJwjAhBPGe/ss+Si6yStRxZ8JJoBH2eFew7IImBHIePvgS8/wPMhapatYSLcVSFMUtgEA74uJfEySuXoRlHqKv0ZnJke9eBH+gO9OH0A6f1IZ+/skot+DKYUGRrXYE1tRqGLbIHTpxAmShRmXwu9UEVLQl+orTffzAfL7hzd5H0fhyx73lraPViGrtkD/f84R/zxYgaRKGuBw+H0xv6F9GM9VFLZJbkB1pL4O9S2qb35RJ8GEdKXQ+vpQx01SpgIAAbI11ywGp56sh0fjx X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc0feba1-13a6-45f3-11b2-08d8d96bf1dc X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 09:01:31.9078 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Nk9P9Anb6wTxSyFcipD6sFp6+pD7v/FUSMqRq6GPxvWoBobyEgTNPIS3aRLlwodoRBA6z5ORdDfNDm/hrDxXXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7430 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If clear GMAC_CONFIG_TE bit, it would stop all tx channels, but users may only want to stop specific tx channel. Fixes: 48863ce5940f ("stmmac: add DMA support for GMAC 4.xx") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c index 0b4ee2dbb691..71e50751ef2d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c @@ -53,10 +53,6 @@ void dwmac4_dma_stop_tx(void __iomem *ioaddr, u32 chan) value &= ~DMA_CONTROL_ST; writel(value, ioaddr + DMA_CHAN_TX_CONTROL(chan)); - - value = readl(ioaddr + GMAC_CONFIG); - value &= ~GMAC_CONFIG_TE; - writel(value, ioaddr + GMAC_CONFIG); } void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan) From patchwork Thu Feb 25 09:01:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 388087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09255C433DB for ; Thu, 25 Feb 2021 09:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD7BD64E83 for ; Thu, 25 Feb 2021 09:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235754AbhBYJIC (ORCPT ); Thu, 25 Feb 2021 04:08:02 -0500 Received: from mail-eopbgr130088.outbound.protection.outlook.com ([40.107.13.88]:57269 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234634AbhBYJDC (ORCPT ); Thu, 25 Feb 2021 04:03:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eCMOe9mcfOgq/nU9ExCqkCYqXurlI+NHAhLEbw8gdJk7s1PYjeubi9TJUuv59SLupu6gWrcgF58DP/p+L7JZPbcAvAmqXCh4GYIVO0iMa9tFyhHewh1xGOKvz41OWBbdCuWXdL4IBNjIFi9K2NfB+phJOhds74+P6ODMey7SWqQWZA1QYwt626l8xzhz2KoG84H9eDPnT8XryqGCJn0qtpEG2VR0+9NwDV+7tWHKISgr5RhDDYY/+4MSxHFADDA5youEa8WId++9t34y0Tj9H1AFTqlC6L+hcGOOHfLDezX3urFgDD8hJxf3Rnpy81P0xJRJZosH/sHdMF+hCpOklw== 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-SenderADCheck; bh=hemv1yRn6VRH46tZ1jruZaVIT7iNVVj2zqe0lzSWxYY=; b=JOUE2LZKcRtz7QGLhHei+WlP79dhUvPZvVqcn0Eprqi4fbiNFG6MfSSZKzZ6AwIYcUFCfKd9nE8oTSN9ZvYlBp8ygvw1jnEqiU4aEo5aB4VlqQguLa0XZbi5Qq/+sQ5fqydDWEgOAOJ9oJa0SJQBpcR8Lb8PfHLMNO4BgC4mqggOSXAEAY/NVmvJqhx/PRKY5x9z/HCAzqXBhSkXQkEzB1MV1hchwoELOoEqxMvvI/sq7+1Aoa5tI1X/turIHEfM8Bum599WJLIM+QAbqqzp3IrPXRK8S3wXY6HYbVI4F2XGEaZ+lEZoCvr6iSuJbTT8HbVb6iM67mivCuqjOweTtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hemv1yRn6VRH46tZ1jruZaVIT7iNVVj2zqe0lzSWxYY=; b=PCWnX2cwGznnid9SpzH8DXxNfH5gmI8H26UDn/eYCxG1gFyizHgrHuiwx+UkhR6xYG0CM9LVR2p+Wd/BuhGFd8LE0D8ZGyWNgCwOhfb+1IBufe2hBEHl9nlQ5EDX9ggPEwOl19oVsdZSqEEI8I7LMfqyUcsXnq2xqiSrDAkAXzY= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DBAPR04MB7430.eurprd04.prod.outlook.com (2603:10a6:10:1aa::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.29; Thu, 25 Feb 2021 09:01:35 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978%4]) with mapi id 15.20.3846.045; Thu, 25 Feb 2021 09:01:35 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V5 net 2/5] net: stmmac: fix watchdog timeout during suspend/resume stress test Date: Thu, 25 Feb 2021 17:01:11 +0800 Message-Id: <20210225090114.17562-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225090114.17562-1-qiangqing.zhang@nxp.com> References: <20210225090114.17562-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 09:01:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f277a987-87c7-464e-e61e-08d8d96bf3d4 X-MS-TrafficTypeDiagnostic: DBAPR04MB7430: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2rgQa/AYuVCZUly8gHIDqi5KifaQ1aYr6doMfc7RakWdiwVHgSaZNA0vy3MdsIZYnwEVZkE/+c5svZf2z6KqftSh/woCmeYhciyiA9RQJrXC+0HwRhXjHRGRhEzJsBjffXllqchVLBlhDUjxMvwopq2NHftRnnox90cmc4cxy9uYnn22mSdn99Qq/6+tZJSj5hllmB5mvZbWsRlZOleseTa6jBFx92HBP0aAMfkEs6avnYUGOwGxhV2kbT7uaGZK62HeQJFXel6JHd9GjTHP/wdCzPk1wWyTXWbLMbA6pJYoBjF/U29Y5x//glXxdZ0ulik0pPJ/8EVXyTQ7J31SXnzaO5j2W8fKG0pMyh6MMVCfrY+nly3GNdET0D5IaJc2FUXbOnbtjWI1oXUQIdeYv+nKaUXK200jy1wVsFSBj1N92e6Unl7rm1z6sK4agHuwNpU/mryPpK4Nnw9R8lLG0xU/I45JbZ9pp1/3RYDJKJvvs+WUuvhrH8lNF/B7DNV/JF2g7NY+drQmdyW0vOnZQYy9S7ObQh56LNVwxNwzeg/yrcAcYYW5zpYU1MIMy3qXwEo5AOx6lvwZnyzEHzqA8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(346002)(366004)(376002)(69590400012)(2906002)(86362001)(186003)(8676002)(66556008)(66476007)(83380400001)(15650500001)(8936002)(36756003)(66946007)(478600001)(2616005)(6666004)(6486002)(1076003)(6512007)(316002)(16526019)(6506007)(52116002)(4326008)(5660300002)(956004)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RGdxw/LtAWtysLkQ10nvM1IGMnpnyaOXA0hOyiFS+sCEqqr/SrmVUkvT44CF2gmBX+yDCnkaf4vzzlrLZkH7GPzhwq1pKlqzRjjOFccK/HCoEDHA5Cqu2dujPPenqdsev+kjC8HcCVso4ldw9571MAT1Am7fgqF6TXIY33TonKM5MCS6lr8VBJ04Ghsf34fK0h+bpIS+o4KiHCPuJtv0WMi/tU2lPrOrn5v0Mw+blOXORqIbSZseCMHS4YLYv96tGsvJUFm4oCbJuu1hGPIEtw19XuSQiap6DTJiVa6KKv9eEwuU9P9cF270zevP+a+4sOSlAlTurnyDvTp3QmNWVrT4rF32W/fqasy9/gLCjcgIRZw+FGjmNER0DmNhbgZ0UqRiRFS1G858XCjh/YJGWNAILWkAzz72dIuwkWs5hVcUwtxGgan/3x7rEr2puAbKGRSoYNafkMrvpSlSy+7YSzLokwTTUnzR/UZPysnu4Z9cFoNRzAm1Rb0qX2po6xQcuqnh0/6Deem8Yn6f5cc6sJtsrS7h+QC1032LJpdd/062mwjhrZ7dQnK0+XQXt9PpjoAhoEJIub4eundA8Hs1x4oHjvDPtu44ztIuahbOxodALPNzl72n6JV25x363Gh5WSJdfVhIuKyWpDu8vwu6eEiNhbrVB0fQNzEUH2cVr8WKK2Ifff3QO78xjm6ciKvFDiYFRMihUCG4fA+XmhbRMgbSl8iRzzitMIGBvWYzNuBl/a43ydNw/X5dJ8pwp42+KT4kzkzYGON/r9oCRCtqpR1CeP4byuovWm40mV1gHt6TwIbBPz/XwKu1ywK1Pg4jpufKGI3TXp/WyLty03GY7ae1YUhwwZICmhMr+0STogHAMcLq0KMKRbEVKr/xIpNe/NdX06RwdhvCbiSyTi89SNZdsHQ9YSXJlg2Vs1s1elRhmnTgZ8wc/EXoY0bWxuT+fe28XMeEYACSoZ8YQhR2tb83jz7ioCDJwCekJ+wW2pFIfyC5enAmaUKVg5UXNXlFTE4ama9toqoGSpeFNqLTohhG4ZMbOwvkuz1LmnJYugd+0NF732yV8s/CWyxMd60uYcf/yyQlQ3ZR2UKSJrv8G7mS06afUY7hPnxjA9uE1QwXlR92b0TxNvGizeNwqhGaaDL31CWNB5cKl7QbsWIrRNvkNzee14waOSGwRcXva8ziUngwAccaWq4Qwljl19SgRMg1XTki2Aa/T3TeeoSki6vcO4asRVliVXdZ2L6yIHlf1IwxG6zczLg+CxkIPW3MZYfDlb6EAN8hln85Qn40QaCNeq+8wav8Db6xvFodB/OriyVKUnGnxK3ckio3C3In X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f277a987-87c7-464e-e61e-08d8d96bf3d4 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 09:01:35.1436 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JuL7ilwtieBFOup52XoWA03VUjJKbo5CCL8aaF4JURuUGRGnexEW3M7R32rdnwAUxVV7RrkecyKPIBWD5Hf1sA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7430 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org stmmac_xmit() call stmmac_tx_timer_arm() at the end to modify tx timer to do the transmission cleanup work. Imagine such a situation, stmmac enters suspend immediately after tx timer modified, it's expire callback stmmac_tx_clean() would not be invoked. This could affect BQL, since netdev_tx_sent_queue() has been called, but netdev_tx_completed_queue() have not been involved, as a result, dql_avail(&dev_queue->dql) finally always return a negative value. __dev_queue_xmit->__dev_xmit_skb->qdisc_run->__qdisc_run->qdisc_restart->dequeue_skb: if ((q->flags & TCQ_F_ONETXQUEUE) && netif_xmit_frozen_or_stopped(txq)) // __QUEUE_STATE_STACK_XOFF is set Net core will stop transmitting any more. Finillay, net watchdong would timeout. To fix this issue, we should call netdev_tx_reset_queue() in stmmac_resume(). Fixes: 54139cf3bb33 ("net: stmmac: adding multiple buffers for rx") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 26b971cd4da5..12ed337a239b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5257,6 +5257,8 @@ static void stmmac_reset_queues_param(struct stmmac_priv *priv) tx_q->cur_tx = 0; tx_q->dirty_tx = 0; tx_q->mss = 0; + + netdev_tx_reset_queue(netdev_get_tx_queue(priv->dev, queue)); } } From patchwork Thu Feb 25 09:01:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 388088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21EB3C433E9 for ; Thu, 25 Feb 2021 09:07:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C954964F13 for ; Thu, 25 Feb 2021 09:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234913AbhBYJGv (ORCPT ); Thu, 25 Feb 2021 04:06:51 -0500 Received: from mail-eopbgr80050.outbound.protection.outlook.com ([40.107.8.50]:43078 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234563AbhBYJCa (ORCPT ); Thu, 25 Feb 2021 04:02:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SqoCZXnQZbesjcKhDoDsDg0hnd5n4wWEAjb5iV8E1+aPU1cKjpXAep4b0UvRsjt2johVLlFUrqkPUvtBI903ZjoI54/qby6RRjltbpr47r2eBOBESdE3ZqSUFeXccqas4chJd+DzdUZL59aZdnLiQRKJuRY9P2dbXuD3DxcLrft8QRX04zdQpnKxVeARGpW17jHUobt+R3IH5gn5xR41LYeivUBnSrdhLhhNaTyK/uIsnaIYns77ly8nC6SrBckvyujnrNHEMUUdIBcB64YeHBf3TvGmzAIDeAK6WQzvLlj32WcOot5RkEtVfyEPdhlrL2voEtB4PwrLiV9ADaPy0g== 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-SenderADCheck; bh=/sJQW2wSH4ju9zcA7XOP3Miw6lj4B5QOUy8a8FzU9Tk=; b=V+tIBUTS8OTYTGP+8v7BQpBEFOWOfSiKzE+qjt7FnCSDdCw35qL46imnDEIEM/HETi0jisoR1X/S3TuZbUsK6fgYoH5rLkTzoUa408fSWwhM0+cRCAu+MpgE1/m4ZCKheRrDVkaNIU+ZTSNtHgHUlqCfesQgw3U+5NZypAXJesabdRG+MsawxOwQVyTLAw3bBSlK175liD8LB2F1+rN3Vw1cHVrq4DyfrecmtcxMnUwDgr+3XBZ8jucQTRtTzafLzmtjm8gUw+Ppr6Ysk+5rin6wT7ymOYD226oxPK4zJIp2QUG4Uu/V2Y3j+INlzC/QCvwg++oIcEQ6IzCTU4w02g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/sJQW2wSH4ju9zcA7XOP3Miw6lj4B5QOUy8a8FzU9Tk=; b=E4QQbszd2NPYEwkq+gNgPcECX/2p4pkwMZdPQnoNAQg+74S51GVTgGMl/mGEx1hoaxJtr86e953XBnHMHWPPP0hVjAXWyuVmxulIP9zF8jZlSLfhUJAwjzFPNgiiPTeDzEpBcLLf//oID14veA8yRB7cDj7DwzLIVilrrPsL1vA= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB6PR0401MB2504.eurprd04.prod.outlook.com (2603:10a6:4:36::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Thu, 25 Feb 2021 09:01:38 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978%4]) with mapi id 15.20.3846.045; Thu, 25 Feb 2021 09:01:38 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V5 net 3/5] net: stmmac: fix dma physical address of descriptor when display ring Date: Thu, 25 Feb 2021 17:01:12 +0800 Message-Id: <20210225090114.17562-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225090114.17562-1-qiangqing.zhang@nxp.com> References: <20210225090114.17562-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 09:01:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9faeac6f-0340-407d-963e-08d8d96bf5ba X-MS-TrafficTypeDiagnostic: DB6PR0401MB2504: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:164; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RsR2VD0NNMZ1CaxtLjJbzweZGF3Ara4qiGblZbUwrXPiAyYnJHcJp93vXZm+wdoz8IhA3N5vscfPHEyNlupyMvHhrJLqyaHHsYp3lN7xT72VBSWrOhAOFK4NoUJvrIt3cn4vqX1WzltmAmVKcclggkQzHBAoRV+F7D9uL5mL7k/PEVmqEfMmK25GhEYlSSbc3oyYHTB2/CPEaVIminpnRqrHln0L1a/J1QNVeZeOYMA24lucaRSGW6ds7bpqBno4P9aS4OVRGZBylny3Nufx0Skt+9XgHNpGDsSBGKLbCv7SfTl6CVERjlwyaGl07KKiDMFmbZ/p9Ecu8O4lqdcisy+rKg92cB5Ra7gHVw7aTBmGYVuxsWFIocCadKwwtReeKHTy6nw5gkVVIZ6Bt+oFLJ/55jghNPemRbbP3MvpsnV4spBPWdKpKFPkZoZWVG2eJ96ypFHAcOeZ7HvAilgEOFD8XcCFKL67WwKkpcrUMRUi0wtJcvWIk8ojV65ZqqPnbupZ12zb2uoWoSctXppB5EMy7Q3oh3mZ2uQS9xwRkshPBAV/JeIH0i/ih/xu6Ra00FTAIQUA4tvRz/vHYKUxCA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(376002)(136003)(396003)(366004)(6512007)(186003)(69590400012)(2906002)(4326008)(2616005)(6506007)(6486002)(478600001)(36756003)(16526019)(956004)(86362001)(5660300002)(6666004)(66946007)(52116002)(316002)(83380400001)(30864003)(8676002)(66476007)(26005)(66556008)(8936002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RosUMLSha1MCxJ2mJqe0cbIpPS7QzZcoI3VibPfiXHhqX1PSf5d+X6kJ9G5Y2XvPQ0yhDFogMwhrkXUNg4VTM55brpG4K6o0gpz0oHtKGiVYh6dhnkZmh+Wzt0PIqVo/dc9InZWJxwtkQ1dPteEJYeSZh6OIvgLBY0QP/YUKyvjIWS7sb1ppE9OMqj9W145mYgQnTqvK/LL+zJzABusZ3Zag0NgCcQUFgs7Ci0Y45gN+Ex0unKdTcBH1Puw43mZ0LEYuX/6d5Jv/5czVOgQDvo26lk88qVzZ7wvNqYpLfGSt7T5k/CgJfveZS9gl2E7K6vjV5sOi7gDHnfkY14C6QxOQD80wXQL8lzvdXMAl4YDP9CxXYiYWUXExOQ9qjB9RKJDPwrpYVOR9r/H4lFC4w13ENTMcpzd9q8pR1r8ua1F2AOX8dt5qxyq7T22Y6py3praTUtcUeRFdrcInvFlj69lBe/mOQ2UCoXaFLyW7JBhBDl9w0SXicAO2rx9cjanzxCcpBkUfenv/abp2UwZToDMU6FpwFLL3O82aPNCDDObSjDbLPSei2KqH3OXdTL86v1AzMHC49mLhRXT1UeoWpJnRe9sGpAKFS8dajRNaPD0jXIieOTgtSvGu/B4s7A1DbU6A+Ory+HthK/+AyUMf+9o8Rqzxhuv8TJycH9fyk3zmSUeVaZtebCjXOEwZVSDOpBbhtT0XO9r/ovCbhlISsCkiWBFpxy5FFF82b8pZYBjMJulpmCYQ/2peoWDZqWcTtfuDLPuIFrbEg4bgLbC7V9PgSKO5RWF90XkBC5iKTDAgTu54Z5quW45OnbM6RrpkRKS/Hiv4EIcztF65GBYOQkbcgKSvJ62+DYRrjivKf2DdNlZgiiObUx5tF9wH6F6Py8wFEjHFQEBQOg8p7O2VOin0I7vb/lYzk/3B1TOg3dI1m3Y4aw36bWou1ttV4CFs19agj+uVSoocAks66vHMuUq9XanQRJS2FLliTicMAzi/9HfhBVDiDfNknm8QWXe+tAG+nkBQvoklT2SPr5UOu3nJYQfwT1Z3itAqY9XO6gVoAaX6ycf0ZUAIDT8G9ruvoMKZ2ddyj8gbQ43x8ox/bxthWRenMjzekFQ9hkgMAIq+NeYB1e5mqCNI7a8F8AfbSoH4kHfVlfpQK6iIO5UtFY0gRIwlqnXHkozCpNTUSQxZQdSC51R+YfvTYFhOzD8yrEg+di3Y0BzE7ngwy4+u7+k5WCQwAG2+n5aZYkqEGaCY74CPjS9oLrQN0QkBYx+cZwinZT9yOYWTxou44WHLBD2LokBucEJT/0G/hX29LKidgDd9UrIWrVHb8JIVllS3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9faeac6f-0340-407d-963e-08d8d96bf5ba X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 09:01:38.4988 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i7GSV/afLBSgAMg94xneAdS9bYptrn27mhk+QopbxU4TMbYFztkxNa3eBW/YzVoLn6kFWGm8UOTe5OD7jnovkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2504 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Driver uses dma_alloc_coherent to allocate dma memory for descriptors, dma_alloc_coherent will return both the virtual address and physical address. AFAIK, virt_to_phys could not convert virtual address to physical address, for which memory is allocated by dma_alloc_coherent. dwmac4_display_ring() function is broken for various descriptor, it only support normal descriptor(struct dma_desc) now, this patch also extends to support all descriptor types. Signed-off-by: Joakim Zhang --- .../ethernet/stmicro/stmmac/dwmac4_descs.c | 50 +++++++++++++--- .../net/ethernet/stmicro/stmmac/enh_desc.c | 9 ++- drivers/net/ethernet/stmicro/stmmac/hwif.h | 3 +- .../net/ethernet/stmicro/stmmac/norm_desc.c | 9 ++- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 57 ++++++++++++------- 5 files changed, 94 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index c6540b003b43..e509b4eb95e0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@ -402,19 +402,53 @@ static void dwmac4_rd_set_tx_ic(struct dma_desc *p) p->des2 |= cpu_to_le32(TDES2_INTERRUPT_ON_COMPLETION); } -static void dwmac4_display_ring(void *head, unsigned int size, bool rx) +static void dwmac4_display_ring(void *head, unsigned int size, bool rx, + dma_addr_t dma_rx_phy, unsigned int desc_size) { - struct dma_desc *p = (struct dma_desc *)head; + dma_addr_t dma_addr; int i; pr_info("%s descriptor ring:\n", rx ? "RX" : "TX"); - for (i = 0; i < size; i++) { - pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", - i, (unsigned int)virt_to_phys(p), - le32_to_cpu(p->des0), le32_to_cpu(p->des1), - le32_to_cpu(p->des2), le32_to_cpu(p->des3)); - p++; + if (desc_size == sizeof(struct dma_desc)) { + struct dma_desc *p = (struct dma_desc *)head; + + for (i = 0; i < size; i++) { + dma_addr = dma_rx_phy + i * sizeof(*p); + pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, + le32_to_cpu(p->des0), le32_to_cpu(p->des1), + le32_to_cpu(p->des2), le32_to_cpu(p->des3)); + p++; + } + } else if (desc_size == sizeof(struct dma_extended_desc)) { + struct dma_extended_desc *extp = (struct dma_extended_desc *)head; + + for (i = 0; i < size; i++) { + dma_addr = dma_rx_phy + i * sizeof(*extp); + pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, + le32_to_cpu(extp->basic.des0), le32_to_cpu(extp->basic.des1), + le32_to_cpu(extp->basic.des2), le32_to_cpu(extp->basic.des3), + le32_to_cpu(extp->des4), le32_to_cpu(extp->des5), + le32_to_cpu(extp->des6), le32_to_cpu(extp->des7)); + extp++; + } + } else if (desc_size == sizeof(struct dma_edesc)) { + struct dma_edesc *ep = (struct dma_edesc *)head; + + for (i = 0; i < size; i++) { + dma_addr = dma_rx_phy + i * sizeof(*ep); + pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, + le32_to_cpu(ep->des4), le32_to_cpu(ep->des5), + le32_to_cpu(ep->des6), le32_to_cpu(ep->des7), + le32_to_cpu(ep->basic.des0), le32_to_cpu(ep->basic.des1), + le32_to_cpu(ep->basic.des2), le32_to_cpu(ep->basic.des3)); + ep++; + } + } else { + pr_err("unsupported descriptor!"); } } diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c index d02cec296f51..fcda214b07b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c @@ -417,19 +417,22 @@ static int enh_desc_get_rx_timestamp_status(void *desc, void *next_desc, } } -static void enh_desc_display_ring(void *head, unsigned int size, bool rx) +static void enh_desc_display_ring(void *head, unsigned int size, bool rx, + dma_addr_t dma_rx_phy, unsigned int desc_size) { struct dma_extended_desc *ep = (struct dma_extended_desc *)head; + dma_addr_t dma_addr; int i; pr_info("Extended %s descriptor ring:\n", rx ? "RX" : "TX"); for (i = 0; i < size; i++) { u64 x; + dma_addr = dma_rx_phy + i * sizeof(*ep); x = *(u64 *)ep; - pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", - i, (unsigned int)virt_to_phys(ep), + pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, (unsigned int)x, (unsigned int)(x >> 32), ep->basic.des2, ep->basic.des3); ep++; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index b40b2e0667bb..7417db31402f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -78,7 +78,8 @@ struct stmmac_desc_ops { /* get rx timestamp status */ int (*get_rx_timestamp_status)(void *desc, void *next_desc, u32 ats); /* Display ring */ - void (*display_ring)(void *head, unsigned int size, bool rx); + void (*display_ring)(void *head, unsigned int size, bool rx, + dma_addr_t dma_rx_phy, unsigned int desc_size); /* set MSS via context descriptor */ void (*set_mss)(struct dma_desc *p, unsigned int mss); /* get descriptor skbuff address */ diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c index f083360e4ba6..0ccec4f9db48 100644 --- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c +++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c @@ -269,19 +269,22 @@ static int ndesc_get_rx_timestamp_status(void *desc, void *next_desc, u32 ats) return 1; } -static void ndesc_display_ring(void *head, unsigned int size, bool rx) +static void ndesc_display_ring(void *head, unsigned int size, bool rx, + dma_addr_t dma_rx_phy, unsigned int desc_size) { struct dma_desc *p = (struct dma_desc *)head; + dma_addr_t dma_addr; int i; pr_info("%s descriptor ring:\n", rx ? "RX" : "TX"); for (i = 0; i < size; i++) { u64 x; + dma_addr = dma_rx_phy + i * sizeof(*p); x = *(u64 *)p; - pr_info("%03d [0x%x]: 0x%x 0x%x 0x%x 0x%x", - i, (unsigned int)virt_to_phys(p), + pr_info("%03d [%pad]: 0x%x 0x%x 0x%x 0x%x", + i, &dma_addr, (unsigned int)x, (unsigned int)(x >> 32), p->des2, p->des3); p++; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 12ed337a239b..071b6bb3b21f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1133,6 +1133,7 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) static void stmmac_display_rx_rings(struct stmmac_priv *priv) { u32 rx_cnt = priv->plat->rx_queues_to_use; + unsigned int desc_size; void *head_rx; u32 queue; @@ -1142,19 +1143,24 @@ static void stmmac_display_rx_rings(struct stmmac_priv *priv) pr_info("\tRX Queue %u rings\n", queue); - if (priv->extend_desc) + if (priv->extend_desc) { head_rx = (void *)rx_q->dma_erx; - else + desc_size = sizeof(struct dma_extended_desc); + } else { head_rx = (void *)rx_q->dma_rx; + desc_size = sizeof(struct dma_desc); + } /* Display RX ring */ - stmmac_display_ring(priv, head_rx, priv->dma_rx_size, true); + stmmac_display_ring(priv, head_rx, priv->dma_rx_size, true, + rx_q->dma_rx_phy, desc_size); } } static void stmmac_display_tx_rings(struct stmmac_priv *priv) { u32 tx_cnt = priv->plat->tx_queues_to_use; + unsigned int desc_size; void *head_tx; u32 queue; @@ -1164,14 +1170,19 @@ static void stmmac_display_tx_rings(struct stmmac_priv *priv) pr_info("\tTX Queue %d rings\n", queue); - if (priv->extend_desc) + if (priv->extend_desc) { head_tx = (void *)tx_q->dma_etx; - else if (tx_q->tbs & STMMAC_TBS_AVAIL) + desc_size = sizeof(struct dma_extended_desc); + } else if (tx_q->tbs & STMMAC_TBS_AVAIL) { head_tx = (void *)tx_q->dma_entx; - else + desc_size = sizeof(struct dma_edesc); + } else { head_tx = (void *)tx_q->dma_tx; + desc_size = sizeof(struct dma_desc); + } - stmmac_display_ring(priv, head_tx, priv->dma_tx_size, false); + stmmac_display_ring(priv, head_tx, priv->dma_tx_size, false, + tx_q->dma_tx_phy, desc_size); } } @@ -3736,18 +3747,23 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) unsigned int count = 0, error = 0, len = 0; int status = 0, coe = priv->hw->rx_csum; unsigned int next_entry = rx_q->cur_rx; + unsigned int desc_size; struct sk_buff *skb = NULL; if (netif_msg_rx_status(priv)) { void *rx_head; netdev_dbg(priv->dev, "%s: descriptor ring:\n", __func__); - if (priv->extend_desc) + if (priv->extend_desc) { rx_head = (void *)rx_q->dma_erx; - else + desc_size = sizeof(struct dma_extended_desc); + } else { rx_head = (void *)rx_q->dma_rx; + desc_size = sizeof(struct dma_desc); + } - stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true); + stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true, + rx_q->dma_rx_phy, desc_size); } while (count < limit) { unsigned int buf1_len = 0, buf2_len = 0; @@ -4315,24 +4331,27 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr) static struct dentry *stmmac_fs_dir; static void sysfs_display_ring(void *head, int size, int extend_desc, - struct seq_file *seq) + struct seq_file *seq, dma_addr_t dma_phy_addr) { int i; struct dma_extended_desc *ep = (struct dma_extended_desc *)head; struct dma_desc *p = (struct dma_desc *)head; + dma_addr_t dma_addr; for (i = 0; i < size; i++) { if (extend_desc) { - seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", - i, (unsigned int)virt_to_phys(ep), + dma_addr = dma_phy_addr + i * sizeof(*ep); + seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, le32_to_cpu(ep->basic.des0), le32_to_cpu(ep->basic.des1), le32_to_cpu(ep->basic.des2), le32_to_cpu(ep->basic.des3)); ep++; } else { - seq_printf(seq, "%d [0x%x]: 0x%x 0x%x 0x%x 0x%x\n", - i, (unsigned int)virt_to_phys(p), + dma_addr = dma_phy_addr + i * sizeof(*p); + seq_printf(seq, "%d [%pad]: 0x%x 0x%x 0x%x 0x%x\n", + i, &dma_addr, le32_to_cpu(p->des0), le32_to_cpu(p->des1), le32_to_cpu(p->des2), le32_to_cpu(p->des3)); p++; @@ -4360,11 +4379,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v) if (priv->extend_desc) { seq_printf(seq, "Extended descriptor ring:\n"); sysfs_display_ring((void *)rx_q->dma_erx, - priv->dma_rx_size, 1, seq); + priv->dma_rx_size, 1, seq, rx_q->dma_rx_phy); } else { seq_printf(seq, "Descriptor ring:\n"); sysfs_display_ring((void *)rx_q->dma_rx, - priv->dma_rx_size, 0, seq); + priv->dma_rx_size, 0, seq, rx_q->dma_rx_phy); } } @@ -4376,11 +4395,11 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v) if (priv->extend_desc) { seq_printf(seq, "Extended descriptor ring:\n"); sysfs_display_ring((void *)tx_q->dma_etx, - priv->dma_tx_size, 1, seq); + priv->dma_tx_size, 1, seq, tx_q->dma_tx_phy); } else if (!(tx_q->tbs & STMMAC_TBS_AVAIL)) { seq_printf(seq, "Descriptor ring:\n"); sysfs_display_ring((void *)tx_q->dma_tx, - priv->dma_tx_size, 0, seq); + priv->dma_tx_size, 0, seq, tx_q->dma_tx_phy); } } From patchwork Thu Feb 25 09:01:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 387576 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9308C433E0 for ; Thu, 25 Feb 2021 09:08:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C58E64E83 for ; Thu, 25 Feb 2021 09:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235387AbhBYJHg (ORCPT ); Thu, 25 Feb 2021 04:07:36 -0500 Received: from mail-eopbgr00064.outbound.protection.outlook.com ([40.107.0.64]:33865 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234567AbhBYJCb (ORCPT ); Thu, 25 Feb 2021 04:02:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D1BFysDNkhpR7ZDqEb446wOzVnV/D3aXsqOHEElhATNIXJPllp2rfEEPZ7AFIRREiiTDRafg1DXGtBkdmoPUhBw8Ws4jX+Lc+B6HD89EgB++bkANjUYjsGbyBGUVr7d07gU9lRk+zSDN1BX83fujpW2XYd9WDaVofPRIRh7ycHPPfq1D0DXc+pdRBjhRF42Nt7wP5NPHsTSRC9KQqb4dyoAbkxYXYcbpijhKg7vmxFFK/ho3YNG9VWHz0/kALkbIIOcchlPFAcpi/SCFvf6AW9TRglYMKgJHZCITtjRdkAymUfzqSnr/UIsNgy0QzZvdj9uSj9Ja9zRZNUOArKG9SA== 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-SenderADCheck; bh=5ktXabzYN9lsVz8M/CG/zFmo+LcpLpHAue15OZ2gEkw=; b=eAVC8f9QBT/AVlIg8W7oLLyROuwxHym72bOLL1gA4rVsE8QdyUBalIR/7r0K3wCYjlxK3HIRRZJ+nEPicMLeQeh5Pa5bdO42rdTY44djJKbM6TpX+36oSPdbB/a8njBtVxVFHDcd08mO4yB3Qi8QCp3cQoAbtAC1c9g/kgRQ8MYkpjbdIu329V6Rp+qKtNLPcVZ1Pr1PqRq2qLVc7T3rBmickyDBRr0Gx4EzbrGmfDHZS4O2gUjdOHJmBPcNUBFLGBR6rAFnDB/hYcOYKYAmRyrTKydoNL5KZBxOVnEY98oIK0jr/ettG6+aZHxlfF7Wp+LBI0biahur2gQqLy3r5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5ktXabzYN9lsVz8M/CG/zFmo+LcpLpHAue15OZ2gEkw=; b=ni9lZGF4ULdJR95Utm9ViWLpZqc552Y5TWrGXyRXVcAAgr19j3GqZkEXAz02QG0L+KIPSftHXd+VE8ZUamuooiAZZdwFjnvNhyiKh2KjT7ltWtOQWmEyeydMhB6nJAs4r5Hrv35uRzW5cjuoTBwgIaJx5xy9HH1Ax/nUGKHCA5M= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB8PR04MB6970.eurprd04.prod.outlook.com (2603:10a6:10:fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 25 Feb 2021 09:01:41 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978%4]) with mapi id 15.20.3846.045; Thu, 25 Feb 2021 09:01:41 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V5 net 4/5] net: stmmac: fix wrongly set buffer2 valid when sph unsupport Date: Thu, 25 Feb 2021 17:01:13 +0800 Message-Id: <20210225090114.17562-5-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225090114.17562-1-qiangqing.zhang@nxp.com> References: <20210225090114.17562-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 09:01:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6dd8b59d-6043-4507-6b77-08d8d96bf7cb X-MS-TrafficTypeDiagnostic: DB8PR04MB6970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qm9gF/XrhB8Px2NuZIsXQRKpYuLnNhejyIo3hi0+1rrMHUkgGRMpPsaXTHwL5uU8dqo7/gPzu0u3Z037mDty1viB0zRs7jky9IyA/Qqof0v9f0RTkkS48Gk232h6yF6Ae3Mmg+u/l8Qs/TbPn5mp9OirOe6i6MkRzE5XFeJ7iDhJQ0yCNwTIe74PMKX5vORKBqUhKdkSaXfY2xe4bmxPy7Z/aL0gfXdoFdlx4+amWXrPeOP/Jcil7dw89mo6T1CLHjcQ838KBj8uyEAgNv5Yb8wzF5dS4fVwlxxDcFzirTzCNO6iMcnz0dwx3Qi/DovDfvuU2Q7QgZd1hD8OnKc/t+OrN108hdKEuQbWnxrytLcIMZqqwmSe8MDnCubpY6VR/V5hJ/xmw7vJO7ZbNtU+h03BQ9C1GlQzyCyOISlSQxdODeSU5jPT5H5+eSzXudWW/kz3e3LS+jRytJT9vv3OqQLT1t0TK6zj2t0j1fF4j9Yj0sLF1qVcYIUCHE7841+5Aoc8RRXt9FOvmmSxtHpMvFCQV9oCKaJgEzfUxNsYjBlRRvlIuhAcpP1f8T6kUR/vwfI+u05x8K3fwg2XrEs/rA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(52116002)(36756003)(5660300002)(478600001)(83380400001)(6512007)(6486002)(1076003)(26005)(8936002)(86362001)(186003)(16526019)(6666004)(2906002)(956004)(69590400012)(316002)(66946007)(66556008)(2616005)(6506007)(4326008)(8676002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Htaj+H6yCZAK933fHbwgWMbVpZVh/Vo6RtXvIxLTUdeG9uDKTamt6W91jmVeBz6t6aC/yGkuGovOigv+oDpy5nMqs/rIWqc8xUEswX85XwTIrtmMginzQIdr0VsHwnXVyzrt44quPYAyT/YnTz2v2KMitPf6aeGSfZ14W6vfD97Ela35MwAEaINUvgCEHFWO2pboMehCMQJF79F1Xoa38XCvADp0uhzoCoVcRreTg6Tuaqfzh0h38nb7RH/QU7v+AsUPhy6cgWlen5oVclDfmPHusj3Yn9m798wwolSYD1lJDRmvWRdZ4OC97CmnwsS0guFQMAUT6g3xLVG0ZTG1KR+65dPXHj9YMs48u358+Z3l7YIW7TlsKxk794tplvKJa2Q9yx6s1QTzkQ1/TytlfFtfcMZjkazwUXFiW6tIdK/OldBkgCGeHnb3Ee9LuNk8tABrOzhmNU76+t2DdFw+G3HtHYlz+gr8Sz9sQRmN7dySWHwY9wMhxO6hwx9ap5px3zYdeutp94Qgtl2swvd2b4rsiSpTmc47Aoahvy2gtogJrOnPEOGdQm7+8QjOlXq2gnyMewnHBsSDbrL1z+m3TNiFjBR6LNktO3dF+YMFItaTKCAoMFH6Rph6n1PHGAOoQ3IF94kUCpZMiZ4Wxu+bnwneY/L5EDz7w2rK8NlUgMTFbfAyc/AQXxLpDw9wCmExhKzOa2paMlKHkBogWILVHjU22VNRupLgrNfw37R193HviFfiXaBMgoH8c3E3OyIOXzHy6dIJqjsq/SgqRc75G3yaTCp+dK5klEB0QeR1odpVVLX6DvJf7ulhvCDKVeMnNzwTO9aU9AB63dXNMf58rGqBcgbueyFtr6lXhhQo2vtKH2Acrta49vrfyvoD+W44NgJNQhY/LM65MPmUqke44F3kXzD3eBHn8Pm9ki2J+LQKmvPNAgFtLmlpzQoigFtvlVdZ0HCTbPyy+Gcn55TaZj4tyrcX1aGKpK046UOb/E1Ni2VQcjVnG7/0pNF/owt1H9OeK6LJ/++A3fmlvwK0ITfNHzNQeind9nHzSUtrfuX2xBKuLXoJkym14S2nelpqxdICxHe/vySmxcCeDQRjRDUwC35DkOeN9FjzGUcvLgdDg/Dlv/ENE9UIiXMtvOYNuLVDzPDrIvELldO7d5xGMt5vtBSBzolVTsnQSNVUqkRqG0ay9IQ5yrRcuQULubNmsZrzjszalfDL06qRXUiAksQCP7u7wHxnG8RqpmiLlYqMTaNevhg2z8ZwNvH6v5sHfBE/G/byk/y0r94IoEmWOzTKWycV4p7HznMm0/3u8upr0fSrCOdTa4Qjs2Foz/ly X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6dd8b59d-6043-4507-6b77-08d8d96bf7cb X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 09:01:41.7475 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uAaTe334tNH0VkyDfM4pt21uxEsFC0qz9eA5WFjxuuO5hR3nhkXc1T7ApyQVMsuwdEFe5NTKbvuTN2f3kKPWxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6970 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In current driver, buffer2 available only when hardware supports split header. Wrongly set buffer2 valid in stmmac_rx_refill when refill buffer address. You can see that desc3 is 0x81000000 after initialization, but turn out to be 0x83000000 after refill. Fixes: 67afd6d1cfdf ("net: stmmac: Add Split Header support and enable it in XGMAC cores") Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c | 9 +++++++-- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c index e509b4eb95e0..3d3d9038f522 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c @@ -533,10 +533,15 @@ static void dwmac4_get_rx_header_len(struct dma_desc *p, unsigned int *len) *len = le32_to_cpu(p->des2) & RDES2_HL; } -static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr) +static void dwmac4_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool buf2_valid) { p->des2 = cpu_to_le32(lower_32_bits(addr)); - p->des3 = cpu_to_le32(upper_32_bits(addr) | RDES3_BUFFER2_VALID_ADDR); + p->des3 = cpu_to_le32(upper_32_bits(addr)); + + if (buf2_valid) + p->des3 |= cpu_to_le32(RDES3_BUFFER2_VALID_ADDR); + else + p->des3 &= cpu_to_le32(~RDES3_BUFFER2_VALID_ADDR); } static void dwmac4_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c index 0aaf19ab5672..ccfb0102dde4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c @@ -292,7 +292,7 @@ static void dwxgmac2_get_rx_header_len(struct dma_desc *p, unsigned int *len) *len = le32_to_cpu(p->des2) & XGMAC_RDES2_HL; } -static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr) +static void dwxgmac2_set_sec_addr(struct dma_desc *p, dma_addr_t addr, bool is_valid) { p->des2 = cpu_to_le32(lower_32_bits(addr)); p->des3 = cpu_to_le32(upper_32_bits(addr)); diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 7417db31402f..979ac9fca23c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -92,7 +92,7 @@ struct stmmac_desc_ops { int (*get_rx_hash)(struct dma_desc *p, u32 *hash, enum pkt_hash_types *type); void (*get_rx_header_len)(struct dma_desc *p, unsigned int *len); - void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr); + void (*set_sec_addr)(struct dma_desc *p, dma_addr_t addr, bool buf2_valid); void (*set_sarc)(struct dma_desc *p, u32 sarc_type); void (*set_vlan_tag)(struct dma_desc *p, u16 tag, u16 inner_tag, u32 inner_type); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 071b6bb3b21f..6cf6ba59c07f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1314,9 +1314,10 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, return -ENOMEM; buf->sec_addr = page_pool_get_dma_addr(buf->sec_page); - stmmac_set_desc_sec_addr(priv, p, buf->sec_addr); + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); } else { buf->sec_page = NULL; + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); } buf->addr = page_pool_get_dma_addr(buf->page); @@ -3659,7 +3660,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) DMA_FROM_DEVICE); stmmac_set_desc_addr(priv, p, buf->addr); - stmmac_set_desc_sec_addr(priv, p, buf->sec_addr); + if (priv->sph) + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); + else + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); stmmac_refill_desc3(priv, rx_q, p); rx_q->rx_count_frames++; From patchwork Thu Feb 25 09:01:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 387575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73D0C433E0 for ; Thu, 25 Feb 2021 09:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90C1B64EDB for ; Thu, 25 Feb 2021 09:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236090AbhBYJI1 (ORCPT ); Thu, 25 Feb 2021 04:08:27 -0500 Received: from mail-eopbgr30043.outbound.protection.outlook.com ([40.107.3.43]:36993 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234713AbhBYJDG (ORCPT ); Thu, 25 Feb 2021 04:03:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYJTy18AXXXhcGYCeamxPFYzchHfS5adNstd4lrHDrsZVIM33uyZfkPv5UQ3U7TNolB4XLQ57+T4M5HAZInBwWiW0xcWdwds0u7uGU+UD5cIJ4g560vw3u0VJMp2q2lTzUXR4l0ri6Maixfbt+yCPLF1tIpi+Tt6xh3PqEU0uCHQgdUYSaVps3kM2PLUoG2NTmR+2zCJYcW+Tei65Zby5OLebhI5NI5D0IE0GtI08QlksbenHKkzLVxazPx5o6EDrYMArcqcMVEtCSVhCt4JqB7XCSNVFL+riC3FGDfRWgAQiZ+iHqQTHcUFnwxqLo5XmczEB9r9CfIwOxKUpTMcSw== 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-SenderADCheck; bh=eYoOYNfbVZd1GfYgY4ZUiQclcSa/RllzkBFFgdzh4Cs=; b=oXBzs2hdKaVcH3TAMil6Nfnb3FPciWyGkOiLbcLy3ZyrJ5Gzlv3Bxsez1LGUtrzV0+SsrxAJH70qzRmLcsKP/2Z10QB6dRpIJmZc/ZvMqhrTeUm0b9T6O8N9CIfkRjcJqTo6FhVr/qVfl5daUuKB0+4bJVbHpAFqYi1Qkc/d2uk5T9z7zxAHBxhlv4MUBvjCwtdiF1FJ4Br3p1tBct0QIHMlQdQEHFUBjkO0Al2TqMcSoOJBJZhw4dZnZMcDNLJXa4ylQDiMzD0N4DGFPAnr6LEhMO5fDDiC4XT0k2qzMgE75zKHalTzagX2QLvVTMmYWUM98CDCDhJ09e68M/WSwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eYoOYNfbVZd1GfYgY4ZUiQclcSa/RllzkBFFgdzh4Cs=; b=nyB2t0t4WF7MQ8yU7LEBIMJNUP4RGT9lh3U9hL5oOWduGEvwFqQD34bbID1+q1ssC5xWsVysl9v8viHtI/+TH4cEJ2FmjPiw5Esxi9ykaXzzweCXjQPpvE8+onZfxUppCfF4k2YEBGEBFAbaVkxRUpjkGk4VMEdTccnwc1yD4Xo= Authentication-Results: st.com; dkim=none (message not signed) header.d=none;st.com; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB8PR04MB6970.eurprd04.prod.outlook.com (2603:10a6:10:fa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 25 Feb 2021 09:01:45 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::7d13:2d65:d6f7:b978%4]) with mapi id 15.20.3846.045; Thu, 25 Feb 2021 09:01:45 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V5 net 5/5] net: stmmac: re-init rx buffers when mac resume back Date: Thu, 25 Feb 2021 17:01:14 +0800 Message-Id: <20210225090114.17562-6-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210225090114.17562-1-qiangqing.zhang@nxp.com> References: <20210225090114.17562-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by MA1PR0101CA0036.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Thu, 25 Feb 2021 09:01:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fa8c3d9c-9156-4ac8-04e6-08d8d96bf9b2 X-MS-TrafficTypeDiagnostic: DB8PR04MB6970: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 04aGvJ7krFPm6Ctj0SzNqJEi4zfGr8DZaJ9DiA0Zo/W0lDjiku8dQjIe4MlOXQeU0MSfnWxKDbl1BzmFBd6P8wHj1dZbROHQ7frcGhjQQJF/rr2vzh9jFnwGvqt/vm282PmLXybomt0bGbbHw4x/iaQNjpRjHpSF66XeIKLdf2p2E1NjG5G522DpaYULgHmbd8A3bK72appGFOW3cyLsQJdrsGZQUGqrQDoRIslpbr3Jf2wv8EyXlQsYQDw9tOgcejO7QBN7P4RIzpecuuq40UdG2GRubKg9+W5YF6CrLhn/rJh110+Z+DkArY9Qs+d1tZuAO9B35S8BRsxn07TajvX6rsV2H88XxtI5dQEJSZhymLlWwy+ho7RPJjre4jyNl62kJ797p4AnHgDnnG6hR9utgcbqyQx1VSfnqG8gKwHzvayFP99apyEco2wsnlGWFeDhk3JGLEkkBKZbWP9Cejyz9oSoyOW+L/OJ3hHK3WWc4kDNHoJsSUF0zcUFES+Q4ACzUmlOXz8ccwgrhuMaWCvD891O3DZ7Abi8W3l8Z3WdRlNMJzeofeVlLxvTP3Xbnv7D5Cv0Hj7xcjqmMvxR2g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(376002)(346002)(396003)(39860400002)(366004)(52116002)(36756003)(5660300002)(478600001)(83380400001)(6512007)(6486002)(1076003)(26005)(8936002)(86362001)(186003)(16526019)(6666004)(2906002)(956004)(69590400012)(316002)(66946007)(66556008)(2616005)(6506007)(4326008)(8676002)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yX3/4a6Ev6fU/bDXoumSZWHxzO6tdZaeSuXHraPTgYBzNSGFFA7/rSmdF32RDhCyH6qr6y29gsgPH98yYfGSgqH22VCgCzK9LC8OkyiINmY2FO58YeiFp5Q0keNN9my6AcobHf0ZFPgL+tEY6KRRZiRYRyO73jILmFb7of0oFOEg9YpxcufsnADxUxZ8pDtWAlJ7JtoltgUhEH/7rutzlXz6p1wmOj7zG/PqJ0zmgIEqSJtGe0yo0Ht6189DvF0uXNgvAWzGEi22fOkzDnuOH5R7LI4CQOw8UBNsZpg8O2q0A/bvjNGCGq3Kx02CUS8PxX9W3sxMBvCmUU/zUoePdBN7zMORojoN+gFYMzdkgXs+86RRUAhmbOci40On5adESvuUyTRrYbdzIDPsZtEa+fDmE9sdI9V05NDjREKfY2BwZwxNDU5SbF2L8Z2anju0tarZgPw03kzH/yHPTFCI9MMuHoaTl4M/S0ZLGCcqBdLbWn1d1VqOZCIwQuQJ7aCC6fWGrrQbH7viUfGipPeGS7Q3543in2u8RXKDmgsy+PDYqw2aixvHokpwYJPBfkL1DAxRZxe2pc55JVr9hvbQWav/CXjFXGKaVPdZ0PsUPJgZi+n+432N9lR8NA0ZACdOjNHOzvFbX98kAyq2GbyE2+efzOE66TBwEcD2jXoTQYfPK4FOotTT+d+QmMd9+09JaHjpMOHQvHyEYYhK7eCw7FZxCOh2P4uosUisC4xzYrmnryy4LdBmIiT7m4yA8pKcAlmJpF7thJMHfNLJyeRBX0LNWfvSlRNU95nzrzjIClMzUNi7nhDxjY5QHMNK9/zv6OiBg9q6LEPWIDnrS9PZczbORKvXcfqtK+sckxFIdKeqlpDTyVPYU8IrkAwYeIJ5iv9NwfPd62BTyt1mTdHNHC/tzsL6EBpWTlJGONtK7brPnxY3ue0xLguFSNBPd20zyIUbbVoxLf52iMfoXep+UzWc3bedzz4jQjEc+bD+iP/y1TGU6IdLnm5dnzxfKAvDsyjCAin1aZt5TDSo59hOXLV2jd87JMegY+IpT6zYo3jptudluqJnQY/1FMW5NqctFXh9ch1J50Wd5h+iZBWOgAjt1X3fLUnDy8cDZcbnbSqkCEOTBSpTrlvuHqukiovtwIzLy8Eu+utb+jn/f5MVYwOPpqE3Co3piVSxVAUk4VhdTctUIrdQF91qiY15eTOPaYcaN2ZtF9li7JxajzsTWJJt0C3g4xfhnAtlsGn/WhH6OrDaMHSLqgGyCXArni8TIU6z0B16UqBj+Chi+N/+MgfHOsjZ/JVsZaD4sLRgibk/TmI9a0ieziAIXfLVHxzI X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa8c3d9c-9156-4ac8-04e6-08d8d96bf9b2 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 09:01:45.0898 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ai6Svqx4JL7Ru+Nhukns8LTMFu1CkEaZTudjF2kZyjLhx1SZ2YBCI4x0JwhkqaQc1kzxOkxhwEuBtjmciFULHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6970 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org During suspend/resume stress test, we found descriptor write back by DMA could exhibit unusual behavior, e.g.: 003 [0xc4310030]: 0x0 0x40 0x0 0xb5010040 We can see that desc3 write back is 0xb5010040, it is still ownd by DMA, so application would not recycle this buffer. It will trigger fatal bus error when DMA try to use this descriptor again. To fix this issue, we should re-init all rx buffers when mac resume back. Signed-off-by: Joakim Zhang --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 84 ++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6cf6ba59c07f..0c97d1a5504e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1379,6 +1379,88 @@ static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i) } } +/** + * stmmac_reinit_rx_buffers - reinit the RX descriptor buffer. + * @priv: driver private structure + * Description: this function is called to re-allocate a receive buffer, perform + * the DMA mapping and init the descriptor. + */ +static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv) +{ + u32 rx_count = priv->plat->rx_queues_to_use; + u32 queue; + int i; + + for (queue = 0; queue < rx_count; queue++) { + struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; + + for (i = 0; i < priv->dma_rx_size; i++) { + struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; + + if (buf->page) { + page_pool_recycle_direct(rx_q->page_pool, buf->page); + buf->page = NULL; + } + + if (priv->sph && buf->sec_page) { + page_pool_recycle_direct(rx_q->page_pool, buf->sec_page); + buf->sec_page = NULL; + } + } + } + + for (queue = 0; queue < rx_count; queue++) { + struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; + + for (i = 0; i < priv->dma_rx_size; i++) { + struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; + struct dma_desc *p; + + if (priv->extend_desc) + p = &((rx_q->dma_erx + i)->basic); + else + p = rx_q->dma_rx + i; + + if (!buf->page) { + buf->page = page_pool_dev_alloc_pages(rx_q->page_pool); + if (!buf->page) + goto err_reinit_rx_buffers; + + buf->addr = page_pool_get_dma_addr(buf->page); + } + + if (priv->sph && !buf->sec_page) { + buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool); + if (!buf->sec_page) + goto err_reinit_rx_buffers; + + buf->sec_addr = page_pool_get_dma_addr(buf->sec_page); + } + + stmmac_set_desc_addr(priv, p, buf->addr); + if (priv->sph) + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); + else + stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); + if (priv->dma_buf_sz == BUF_SIZE_16KiB) + stmmac_init_desc3(priv, p); + } + } + + return; + +err_reinit_rx_buffers: + do { + while (--i >= 0) + stmmac_free_rx_buffer(priv, queue, i); + + if (queue == 0) + break; + + i = priv->dma_rx_size; + } while (queue-- > 0); +} + /** * init_dma_rx_desc_rings - init the RX descriptor rings * @dev: net device structure @@ -5343,7 +5425,7 @@ int stmmac_resume(struct device *dev) mutex_lock(&priv->lock); stmmac_reset_queues_param(priv); - + stmmac_reinit_rx_buffers(priv); stmmac_free_tx_skbufs(priv); stmmac_clear_descriptors(priv);