From patchwork Wed Dec 2 08:59:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11945237 X-Patchwork-Delegate: kuba@kernel.org 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 46E2DC64E8A for ; Wed, 2 Dec 2020 09:01:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0786221E9 for ; Wed, 2 Dec 2020 09:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388008AbgLBJAn (ORCPT ); Wed, 2 Dec 2020 04:00:43 -0500 Received: from mail-eopbgr50065.outbound.protection.outlook.com ([40.107.5.65]:54606 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387643AbgLBJAn (ORCPT ); Wed, 2 Dec 2020 04:00:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3TS53VAoPlDiqbYvCm+ZdLYyMYIc2d7ZUXJ+62SUZGQ84KbjhJiadxcPR+eTtrD3IoPjKVlzAqhU0TAa3IxAItz7gRbY738k6C/dNe9KL9GKA7Q0SAqQ+3e/GmYXDAHT5eWAfvZJFC71ee8k3pLIZ4K6rYa7nvxwCz70ayhFB0GRsYwJRmd/m2pHOUL6wDWM7teLi3bN7KqyPWYj5C7hVtnXGv9CjnOnIlKSv3ggRa5iytXCHQ+GwALga2XkW28N6lqUUaWIXRv9ulEE7gjO22QXLb9Z/znpDKO3sSulwAhJaxIaSIK+DTTBrft3G53i99tu5picapBaJMo1+aNrg== 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=i3fvrFeNCKOZe1LfevmI8lb66EX3HQ/9xsBhU0yn488=; b=gJBMKowFaHBEHkdzRngBXkM8TEVgFY0/uY5Qmv2vHcNuN4U16AuUkmjwR26eBGs5nP8w/tO8HhmRgaVvqPp6CeA2IE3u+0BkIBnGZ8siFHE94DOvg1bEs0Iki423RELQad6aKwqkwZugzImUYaeF9Ai2E+fh8m4tnpuKtoqdKkLiWZ4037/IjVYMhZpwlTiXGen0gI7kuD3E/ashmaeJN4F0zX4++PuSJ0KwFNHPCH5aI1SeFFyaPOPClUsod/94waHKQnZCfhWi8wa8xv7i5pc6cP1x0ZUXAtsTSLCpK2fa37Te+nqlYL7p3XEVFGV6gBxTtrSVtfj3yN/ajbC2Og== 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=i3fvrFeNCKOZe1LfevmI8lb66EX3HQ/9xsBhU0yn488=; b=MduFhEO/biaXp3b5Hturksmh96tPKRjD6eqYzJsGKiQsyRt3fwQygIOY0Aolk+pjdDkEFfqY2rNceuCcFIfjZi8C48iBriC6EtfCxM3wm6Lg/vgWofqKDhcf7/TW8ZDItiQB7HYUpGBJncEu4jHUM+UrJCWWzeWxh6XYuIvuKz4= 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 DB7PR04MB4107.eurprd04.prod.outlook.com (2603:10a6:5:1e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.22; Wed, 2 Dec 2020 08:59:52 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.017; Wed, 2 Dec 2020 08:59:52 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 1/4] net: stmmac: dwmac4_lib: increase the timeout for dma reset Date: Wed, 2 Dec 2020 16:59:46 +0800 Message-Id: <20201202085949.3279-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202085949.3279-1-qiangqing.zhang@nxp.com> References: <20201202085949.3279-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) 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 SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Wed, 2 Dec 2020 08:59:49 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 78b91c14-5514-4036-6a59-08d896a0a14a X-MS-TrafficTypeDiagnostic: DB7PR04MB4107: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I+eXJ8J1HLxvsfMm6IkFbad3HlRmL6/aGal38VPnld8JDP2OffujgVSng9sixmc5p6zJyddld73scjoCZ29i87euupNmr5JJQK8duOSTX4gE73TZq8jXHee/a/vvI9upox/Up7oXexOl69EUqnPPcOeo0eOW7Vm8nxyddfsOwrWFDSwU2CKOS6QH6Xw9TZ9l4Y3MUeMvIXqK0rA2jkeDehRz9D3oUDARD8q19G1Ob5m81ZQdn364q2nXfDpHO1Fnuh/6JDSVkM9AyUEFlGE1u3aARb/Hy0LHtwr4bYucesDOedExqVafW2I3pRqgAXUVwWmTx6C4PYbxhKwyk5mFfMliNI8QiuCileH8pTDCYQ7by9wxefsSPZN3kSPBz6Eq 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)(366004)(396003)(346002)(376002)(136003)(39860400002)(2616005)(8676002)(956004)(316002)(66556008)(6512007)(36756003)(66476007)(5660300002)(4326008)(66946007)(2906002)(6666004)(69590400008)(478600001)(16526019)(52116002)(8936002)(4744005)(1076003)(26005)(6506007)(86362001)(83380400001)(186003)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: aLbJ9FngWUa95Tpw505wwxDcJyso/p36JnHebW18eOea3ZvMi7zxi4Ox1b1TvjSp9UY9NYQnuTgu7QcKfupxn77C0OctMZpcwwE2egEjiE+9gDW0CGyUmng6jZDYjm7oSjIeWJhFOQPuidVNiy3k2dUYfNBH+JFKhGTEofWFkG3ISQlLfv+gvWtiIpbnD4ehvcRdoqlVFfLmSvrtYh+OtGEfuDb2+7qveUrYoE/QpdG5HGOC1pHXl75G7Hltcq525Yi17nGoM0XrPMMVZFB87Xfi/xHAuNBnXt/uRQB/Z4kaomN7W8W7d51uuSW5J3i4L3NTOD45wQcsIYnoKJqAey1tKrcdzAxXUhlNbOUdKzkyiY+aXaZJKCoOSx8Z7g1wGkteaB42C/rheX+Mk6NvdUzaZqME82iS6xllAkX+dTMjx84xTz9w5AMpZXzwSsPGygMCOlJJWlSk3Sgy8Hw49VUyuVUlgpYt2gddI2/7jVh67w7Ns9SWwG0wiKh3dTNRNXGdKZ9SXKUse7g67cKJQtqL93j4o4YgfzqOGp3pjPh+YKau64lAwlMqals/gMQcBKx5rZLKGd/wKcfm67acmS4FFf0WiXofixjKvgrN5k5XExwDvtLauyNsVpM7vZNLtWIsdEnztk5vgZQIZ/TWSaTdvgVVpfvo9acm4D5v+EzfCkaFy/L4FD7/xZzbfhYFdU62rQRVIy4FqaYXxxdzwCMcrumxe5KuvFgLurB4nch0JGcFyrwSJfcRIa33pcwzEs3LZpRIOzg/fch+zHRtjUiBkO8Wb+q2c878/tmkg66UMufi3Mdhl6RJJ0dwkbG9M70tzz0lFVCdD425vc2vFpaWI4LfDdTdWaL8QxtJQAfp1BDydMkLzaWxjvVm23L8TiUUZCkoisoDvoaJ2DjLk+7+0bZIc7LzpCrMR5fksLRQ3yDZK4O4eUmbCw1+kJ3P/ghH7PrnLyRFJStp8SVz4V9KV3+0zdraG9MwSC3KBJLBm8hVlkNJGzw+clUeV/lK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78b91c14-5514-4036-6a59-08d896a0a14a X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2020 08:59:52.0914 (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: LbGb6d5sJHdAhJ1i7MsBHFr5JH08WvgzPu/UojpJ/lbvE522ExOIgRZ8Yjcb1rXoYRlKTuG35DFt4rg8+KU+gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fugang Duan Current timeout value is not enough for gmac5 dma reset on imx8mp platform, increase the timeout range. Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c index 6e30d7eb4983..0b4ee2dbb691 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c @@ -22,7 +22,7 @@ int dwmac4_dma_reset(void __iomem *ioaddr) return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, !(value & DMA_BUS_MODE_SFT_RESET), - 10000, 100000); + 10000, 1000000); } void dwmac4_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan) From patchwork Wed Dec 2 08:59:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11945239 X-Patchwork-Delegate: kuba@kernel.org 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 729CBC64E7C for ; Wed, 2 Dec 2020 09:01:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B1D8221FB for ; Wed, 2 Dec 2020 09:01:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388020AbgLBJA5 (ORCPT ); Wed, 2 Dec 2020 04:00:57 -0500 Received: from mail-eopbgr40057.outbound.protection.outlook.com ([40.107.4.57]:12974 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387643AbgLBJA5 (ORCPT ); Wed, 2 Dec 2020 04:00:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFquU3OxDVp3nsxbdRIPQtrZZ2uLCbmAsZ+8xT2NN4CnMCLqepK/ZCLxvpK1WtVkrU1UWzk/+1Yl8otBzqaSW9PjclBSMOO7ntbe7vvU6373TW93TlFnQ7n2jWTrQiXDy5VoRXFmY9gaN+L9iDdpf5V4nN0f+6T6D1xdZNbNI+C3xGiY4cVkkeShIg+0lp4RImu8tMp+yBWU7xFEqLu20ir0MeTDHW2Uebsj7Rjz1m7hhQkjksKq2ePsQX4AyFy7ciLDRDy/3srQ2BTHv7BcbqPsJzhwSXAmWrJSXP8coJKMizdRMzxgRUQhsfPl91RGede2GySqctqKg+zsmS5G4Q== 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=MHVPaPOKsxm4Rs1f7SwXefW0i6EUYty5XizTL3WcRLk=; b=Fvlju2OxPy/4Ju8jfxd1y9k2DwsymPme75llsEDGQl6W3nmlV01cGMg5EjRMjSqPXVFfsMOpvMgWA/CVZWNl5qcXtVCPBZYZNT8uE2prhcY09BPcG9c2PZHbI2GRv7n37Cx1J31tLDaQ3yfNtiqpRmKd6LLa2wHDXcZQX0UfESgRw393nV/2x6YPmxS4VYwcmxg6ZzGn0jxEiM8+cs6sQQiutDaqDclRCUYcRO3boOeE0fdNWh1sSJurnW/zyKDIxFx0Dr5FyQC7vf61op0Y286GiD0DETOJcZmEg47wyZZ6cD7FVuaLH5KGOJXbNhSZBCXCo1QTsYd207s6Kyvx9g== 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=MHVPaPOKsxm4Rs1f7SwXefW0i6EUYty5XizTL3WcRLk=; b=QsL0c9NI/AHBC6q8YCQiXgZLzCpO8BqtQcsjDeId9oDpdYga42QUUUjxHfEs4QxMBoPjf62hyJ/pV7WNxf9PTimuaqgSe2SGBEZ1IiOy68LkA3cuogPI9vJVQ0TMYuE5AUVpXB4j8nSG06EnF50vwpZdS4eNJUZjMGKknD3tqSw= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Wed, 2 Dec 2020 08:59:54 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.017; Wed, 2 Dec 2020 08:59:54 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 2/4] net: stmmac: start phylink instance before stmmac_hw_setup() Date: Wed, 2 Dec 2020 16:59:47 +0800 Message-Id: <20201202085949.3279-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202085949.3279-1-qiangqing.zhang@nxp.com> References: <20201202085949.3279-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) 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 SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Wed, 2 Dec 2020 08:59:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7b072972-c157-435d-2f53-08d896a0a2ff X-MS-TrafficTypeDiagnostic: DBAPR04MB7432: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rnGT9oy3RnP2wvEVuWY1nnxVLdtE86s01FZw50h14N7ZAaLh7HOcDFTDdTjv4kkgCax1SeC+6f4FDPe8YhYQt34cCDnrrbcpJMk5hkTCBaQdgJjBNyHc1f9XNxUFctYbasZtPqnUNizkgIzQYPOWLAqGqJ3arLuAcGCkX2mPCshfcyKT80tAzPSydaS647zRhQPgQ+S409F3CYGaiDeH+49Qu5QRU7eFHdnkYkDueJouHL0X4jnRr5rYkzNSIwvo4Ie1dbiQBqXVtOf3iqvxmdohnY4ixswxIK97FJtzfWVB7mOcQW5AULk1wVaZAQ86Kpw7Qh7xE0kehRHP0siQBL7IlRXThGuRX3721ZTdC1jWuotIRaXsi85A6bjURpjx 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)(366004)(396003)(39860400002)(346002)(8936002)(16526019)(186003)(8676002)(26005)(6506007)(5660300002)(36756003)(83380400001)(52116002)(478600001)(316002)(86362001)(69590400008)(1076003)(956004)(6512007)(66946007)(4326008)(66556008)(66476007)(2616005)(6666004)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: QmQjT/ldj8WxercHRHxC2fj19mwTxPgBNVFq/WPGQdBmWGdhi55pYBfTAFpFMkfNwvJHoRyofPVj5i5Qd7PoSUC8yK5ubGNJz8A1NO/FSJL6F8qhwW2m1iJxw639PL3PQtmAO9kVS7eDGglqLOAK03p6yVnaDDfy13ASQBBTYNUN9cBN5YZwP8pdv3x6KmVzvylj/6QlWEHyceZJfgpOq0wC2CvSclk8EkqAx4EzUzaxUcd2Z5e1ZlM5D5N5s1ITzlsR79uVAJCuM6uNbwBwbfpxX4H5SZGNFfQmtwf55D4OCcgn+ljsd+SyY0Tmw4qdAOLuM7XiVQ4lOUJZMzS8bimSmztE0usYWcqGAqS9MX0wMwVn2DUei2ypjVPw7gI5Y7e1OMQJzroJoH663mPBlHgEzgbVx91BsP0ZpJR0AWeLlqtN0l9c9go1/h5Wzaa4RXM5AlkDGGK6XIg68Ijr8FMUutUkEImsEttBGQDVSkePFzRVoUAxiKGECP3Suj/2mJs4/+6V3yopyuILJRFAOgkobnklqo0E6ese+G6Il7Iy34S7xj/9ejnWxEhc1hwuz8fsAKTVpT2vTg7pt2K2Qvchhvub8MuuM2QuHdhhIsWg9HmR9KiQzNNml+SOftZhqcJcBlqVUPCEP4kFWCp4WnzPlOmn2EzvYhC2RzPk91jwJ5SPTV9AxBW8MW5bSjzFN214hSYevbbZ+LVx63Oz1JxK47k9zYWpGzHGlVHESzCu127Pw5pM4SBYZ33fpHdaQsTRgBpo8HG9NjEWg4h5kOZ3hrisknaAwOR1OUjuyld4r888Ziync5wxdT+YlOljGsB2zBdJ9yHX4KXI3cd0p4aUlOMRHRSdedyknmSl4KlZmu/G6iqVfypzuis94EEPqzqdx6xqvk4bu63PrsdtFY9cT2AyYnZ/a94k0EaJQdUJEFWLeT7srGQrvpegKz+XZcCb5sJvzhjqRkczlmh3mg8Hb+czHMNr/k9gzwfTVmK5f7nhspAsDGiPffrJBfZG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b072972-c157-435d-2f53-08d896a0a2ff X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2020 08:59:54.8811 (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: SqQiylMkmsYx9iKiGvyBZ0ja/fStWjaqSaCxt8OBRigE5YN2IrnsewDMrFIdVFSrYTu+MPkpUUgTQ/G8LQparw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fugang Duan Start phylink instance and resume back the PHY to supply RX clock to MAC before MAC layer initialization by calling .stmmac_hw_setup(), since DMA reset depends on the RX clock, otherwise DMA reset cost maximum timeout value then finally timeout. Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8c1ac75901ce..107761ef456a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5277,6 +5277,14 @@ int stmmac_resume(struct device *dev) return ret; } + if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { + rtnl_lock(); + phylink_start(priv->phylink); + /* We may have called phylink_speed_down before */ + phylink_speed_up(priv->phylink); + rtnl_unlock(); + } + rtnl_lock(); mutex_lock(&priv->lock); @@ -5295,14 +5303,6 @@ int stmmac_resume(struct device *dev) mutex_unlock(&priv->lock); rtnl_unlock(); - if (!device_may_wakeup(priv->device) || !priv->plat->pmt) { - rtnl_lock(); - phylink_start(priv->phylink); - /* We may have called phylink_speed_down before */ - phylink_speed_up(priv->phylink); - rtnl_unlock(); - } - phylink_mac_change(priv->phylink, true); netif_device_attach(ndev); From patchwork Wed Dec 2 08:59:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11945243 X-Patchwork-Delegate: kuba@kernel.org 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 8F6A3C64E7C for ; Wed, 2 Dec 2020 09:01:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DBB5221FB for ; Wed, 2 Dec 2020 09:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728806AbgLBJBV (ORCPT ); Wed, 2 Dec 2020 04:01:21 -0500 Received: from mail-eopbgr40057.outbound.protection.outlook.com ([40.107.4.57]:12974 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727006AbgLBJBV (ORCPT ); Wed, 2 Dec 2020 04:01:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTRme0VWSbY2p2TyBSH2ed18tOaseDIFdl06WV972h6nOOSs2L40ZGkrLjYkv2TMeCnKhf1+Cx7hRIAVboLhzM4Dl9uTEduhJFTeu5R1Nsju83nYg2ipUqLfLUirqVEWGkcLAkepG2DUu8whJIHPGTyqiTS8Tbtb+w+Ydn6cR8sv7lptSqwaIm46H6itJ7c1Mw47FHPW8zQu+orOoghVssJL4u61a1ySQEHf3ZwyKENkd2yn8yNSBWlu5ZjnnYsY3rI7FoHo+zoSAppgorRdXxcs8T6yZfdNEF9t4pcpNeebyESAcVDQNbrHpFcH+Y0xrO5L6orfp4aeYtEcXtbsKg== 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=AgXZvkH0zdmI5ZvDMbgNj4G0j7qXe3zpFaLJywjHaAU=; b=oStXdMrl7vvMbO9VSTJk4yC//TnwJe17pQIWl5/KUJwBk7bPZps+BpGQ6lS+y8f7qi9gPgl7y5OxchyjWQ5JWtM+1bSGijSwDN0e4szXmwOzd2xY6YkuuhkVzAW0AHLJMOpewnPrhJLRZvNH7PfK7xpPiIZFTrUnz8ckwLUO5uY0JwbOuOIwl5Tf+kKgWskCzNsFxI0Lh7Utg0P0NOHOre+yBNt5/SlAhqADtxL21aLKj2ZQK49S4grQYt7tG9HQyUtG6B7d/McBtc+atVKffXZG0LJmTLCNnMbGCNSYzs8hBGWKzkCbf8MXTGuNrIO9w3WxMExEFyK0xaGOAFBvOg== 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=AgXZvkH0zdmI5ZvDMbgNj4G0j7qXe3zpFaLJywjHaAU=; b=Prq+a0AOmkbphacN2RtGblsv5SvWxfX/suIdXSstwctR6wwt4YNeuC1SPCIP9fIEVJEm4oUAk7SL7KjGIqdBStgIzK2T+JTstNaZRd0AB9JcinBv6JkOZ/67mLxuONbmWHhjnpAexAQ6lGEigq/zcLvSqGiuuEqv5wb75a6oqiI= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Wed, 2 Dec 2020 08:59:57 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.017; Wed, 2 Dec 2020 08:59:57 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 3/4] net: ethernet: stmmac: free tx skb buffer in stmmac_resume() Date: Wed, 2 Dec 2020 16:59:48 +0800 Message-Id: <20201202085949.3279-5-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202085949.3279-1-qiangqing.zhang@nxp.com> References: <20201202085949.3279-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) 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 SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Wed, 2 Dec 2020 08:59:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cd39bf5c-6e3f-44cc-1acb-08d896a0a4a8 X-MS-TrafficTypeDiagnostic: DBAPR04MB7432: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: psFcxKlQDedFoj3Xt/qIoF57AN1Bwi74b/YbfKUilS4HFiaBEHtW47tc2X/wJ/AdRny4rOMOPkFRJIS6fWxbIGnb2N2ykN2TXWcoeFx/FF2VwwWkvIgoc5YzV0HDqCbLVUMehtxjqIiV/AXXrPb7Cn3OeIfnW8++SUg/rqfOyVY2qaBXA+cLR5zbaomRDUZEtdsspulrGoKS17PlhhewucS4MQA/K6AsKxJXkxeiLnOW6A5GtvD+RFN0yrrbHj8Y3Bfs/XzNsUy6ODIboBzW/Ar1RFaUguEfBXg4+fmuEi/7pEvJzlgyiPQge1wbwrIq1RFiHR87Vyxnmnr5jSRqBeT1d8CBtrn3MkU1prgdfYHnfNhQqn8FSKkjS1CXRNFP 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)(366004)(396003)(39860400002)(346002)(8936002)(16526019)(186003)(8676002)(26005)(6506007)(5660300002)(36756003)(83380400001)(52116002)(478600001)(316002)(86362001)(45080400002)(69590400008)(1076003)(956004)(6512007)(66946007)(4326008)(66556008)(66476007)(2616005)(6666004)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: //NYpU+xYaQfai5Ggs8CAr7/4vqcDNbaOUyoKwcWcR6fUbOW+6r23V4SS63A4OqRcMBpA91tXJhIKShmOKU/YsS8F8BZi7vQZCNcXsRHV85qbGcmCwqABGqbn6StPUrAdsCyxHixCIjc/j8qlnHLfRO4L9UO9rMqWW69R7N0fbsa2hJDEfjEPin9UgrcwENWclc9SuUqUba3Hf87aJy6aCVH49faO/VCaIYEYeLxf1wIzEvMy+FAum6Z4e6cn7rA4kR4qpVHls1IPevqEktCkaoJiOoYJWpyd98TzMdWqv6PrSDGCRrmsi1ZsSR9lqjChV5x5cmgAqmQaTLLyFe8OHvQKZuVA4elZond86gMsi8wXl0ZeCf3pRMguUSAKyz2YDilcyYTAAFEv1NztwkmuBJtLoPL9D/9vPSB7v5jU2sfvX+c9ZNlMGoOnhmFolrHfZxxxHFaTRsrQSwJWNRU8Ea/adAgjYh+utVsMSgHprd2fE5E0Xs6JIQtLW8/TbtAPB1ppBIAni0bQ6AxKb76oIyIhuR6nOvLYWnZRffwVfNxYDD+bxSPSR6oVyntxCYJD85kQtBwklpnryIRvzKpGtZBW06j6Ngd/HKv6lvQ8Aj77g4L8mtATPVQpV5MV6CI2fzlZAb8pAP1NMs6HCWL/7VECuGTBzhA1jCNe/0bDyqh0/nRPUI4LeMYTdK7K0tpJxZZ9o7r9+3Wwo3p07SVGByXpX3bxvbgN2Y6pbRHmRSOGJ+BieGo0pAeg1CGmXCb/bv5MBbJXVMccOprkrlu3V/ucYAxAt1pQLCQYzfN/I0fusCL8puPr9wPw2YA4d5wk5eLYhNNWywdSEcs7Pz9O8QPeedcveC0wVdyUJSdYYTXEDpmEipqFzQho5hTXWdWav/QF5qXp9mmDJtoCdGLjdv6ryU4thZPU2RjfA0n5E2Z5/iy804OTJmE4xTmY3ERczpeodROtdxF7+84zq2wpglZ7LINyDcG5sI9B6lhga3XMuNH8Xh/0aNJSc3LVBMG X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd39bf5c-6e3f-44cc-1acb-08d896a0a4a8 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2020 08:59:57.6330 (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: JUFlRyCEYAIgFbcGPvylF9YubYcthfbYNhbyRX0Mb+XCPWV8lgv++JyT8tgOZcnN5oadUnmUDCla4nCv3Uc3OA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fugang Duan When do suspend/resume test, there have WARN_ON() log dump from stmmac_xmit() funciton, the code logic: entry = tx_q->cur_tx; first_entry = entry; WARN_ON(tx_q->tx_skbuff[first_entry]); In normal case, tx_q->tx_skbuff[txq->cur_tx] should be NULL because the skb should be handled and freed in stmmac_tx_clean(). But stmmac_resume() reset queue parameters like below, skb buffers may not be freed. tx_q->cur_tx = 0; tx_q->dirty_tx = 0; So free tx skb buffer in stmmac_resume() to avoid warning and memory leak. log: [ 46.139824] ------------[ cut here ]------------ [ 46.144453] WARNING: CPU: 0 PID: 0 at drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3235 stmmac_xmit+0x7a0/0x9d0 [ 46.154969] Modules linked in: crct10dif_ce vvcam(O) flexcan can_dev [ 46.161328] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 5.4.24-2.1.0+g2ad925d15481 #1 [ 46.170369] Hardware name: NXP i.MX8MPlus EVK board (DT) [ 46.175677] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 46.180465] pc : stmmac_xmit+0x7a0/0x9d0 [ 46.184387] lr : dev_hard_start_xmit+0x94/0x158 [ 46.188913] sp : ffff800010003cc0 [ 46.192224] x29: ffff800010003cc0 x28: ffff000177e2a100 [ 46.197533] x27: ffff000176ef0840 x26: ffff000176ef0090 [ 46.202842] x25: 0000000000000000 x24: 0000000000000000 [ 46.208151] x23: 0000000000000003 x22: ffff8000119ddd30 [ 46.213460] x21: ffff00017636f000 x20: ffff000176ef0cc0 [ 46.218769] x19: 0000000000000003 x18: 0000000000000000 [ 46.224078] x17: 0000000000000000 x16: 0000000000000000 [ 46.229386] x15: 0000000000000079 x14: 0000000000000000 [ 46.234695] x13: 0000000000000003 x12: 0000000000000003 [ 46.240003] x11: 0000000000000010 x10: 0000000000000010 [ 46.245312] x9 : ffff00017002b140 x8 : 0000000000000000 [ 46.250621] x7 : ffff00017636f000 x6 : 0000000000000010 [ 46.255930] x5 : 0000000000000001 x4 : ffff000176ef0000 [ 46.261238] x3 : 0000000000000003 x2 : 00000000ffffffff [ 46.266547] x1 : ffff000177e2a000 x0 : 0000000000000000 [ 46.271856] Call trace: [ 46.274302] stmmac_xmit+0x7a0/0x9d0 [ 46.277874] dev_hard_start_xmit+0x94/0x158 [ 46.282056] sch_direct_xmit+0x11c/0x338 [ 46.285976] __qdisc_run+0x118/0x5f0 [ 46.289549] net_tx_action+0x110/0x198 [ 46.293297] __do_softirq+0x120/0x23c [ 46.296958] irq_exit+0xb8/0xd8 [ 46.300098] __handle_domain_irq+0x64/0xb8 [ 46.304191] gic_handle_irq+0x5c/0x148 [ 46.307936] el1_irq+0xb8/0x180 [ 46.311076] cpuidle_enter_state+0x84/0x360 [ 46.315256] cpuidle_enter+0x34/0x48 [ 46.318829] call_cpuidle+0x18/0x38 [ 46.322314] do_idle+0x1e0/0x280 [ 46.325539] cpu_startup_entry+0x24/0x40 [ 46.329460] rest_init+0xd4/0xe0 [ 46.332687] arch_call_rest_init+0xc/0x14 [ 46.336695] start_kernel+0x420/0x44c [ 46.340353] ---[ end trace bc1ee695123cbacd ]--- Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 107761ef456a..53c5d77eba57 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1557,6 +1557,19 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue) stmmac_free_tx_buffer(priv, queue, i); } +/** + * stmmac_free_tx_skbufs - free TX skb buffers + * @priv: private structure + */ +static void stmmac_free_tx_skbufs(struct stmmac_priv *priv) +{ + u32 tx_queue_cnt = priv->plat->tx_queues_to_use; + u32 queue; + + for (queue = 0; queue < tx_queue_cnt; queue++) + dma_free_tx_skbufs(priv, queue); +} + /** * free_dma_rx_desc_resources - free RX dma desc resources * @priv: private structure @@ -5290,6 +5303,7 @@ int stmmac_resume(struct device *dev) stmmac_reset_queues_param(priv); + stmmac_free_tx_skbufs(priv); stmmac_clear_descriptors(priv); stmmac_hw_setup(ndev, false); From patchwork Wed Dec 2 08:59:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 11945245 X-Patchwork-Delegate: kuba@kernel.org 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 1EF40C64E8A for ; Wed, 2 Dec 2020 09:01:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF9C222202 for ; Wed, 2 Dec 2020 09:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388021AbgLBJBh (ORCPT ); Wed, 2 Dec 2020 04:01:37 -0500 Received: from mail-eopbgr40064.outbound.protection.outlook.com ([40.107.4.64]:18035 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729107AbgLBJBg (ORCPT ); Wed, 2 Dec 2020 04:01:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nhroqEtV4o1YMrrK9vDHTf5qiJtJYC99o58r42C5Ae/MjOjuhdM0urfVMM5znHhIz8klfj88U2YqOzM1c/q+Kv9MFq/+WiNuTKagWdpNkCbqgtH58mTXQ0f6dQf+FLzcLMdo0BPVdejiMnz6TphWlJ/zRuGgSACD8D+/pSLZv7tEPkiA3+ygxCYcnbkOtEqBRh58U1WaGDzOap+iOGR9dXO6nFYw2OwgiCX0L+r8B5T9fb/Vdv8l2NGabfBrpSi7dB8VkJxBnBpVCOhSLbgSoSi+/YgWosIXpme+xZbFI6ro/pHAa3UE8vM5N0NawvHdySD3Wmx0mA/LC965kAKzNQ== 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=4e1MiSYCpjkHL0sgIQFQoTplRyIZAJGiDeOpcuXLHNM=; b=Q87ir1OmCnBqQpSA/rp8ETjiuVmiTU4xoTdDMomQkUzDrzbVsEFNFx5Lk758kN3eYp5mF4PRZYHS6un7uKHWYucvtKnAde6TEPHFpbTlCnjsO9iPGpBdhiqqy3TASxD6VpIm0KTqIBSeKSVxG9iq4JD6h7wVwgw1aa8E8nVEvVynlQdcUXS9/f5B84q+nv25BiB98j8Relhi7Crz7izOoQ9FS5eSr0LJloTKNb+UwwLEwWbhG+IbMl8wdhXF1mF89id5ptR5l0vhOkYcMX7WTjUyHolnFtg5xDK52eopVpvRbMkQZekNMrE17cmkbIkdluk0xaQr7+INuV7YhqzkAQ== 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=4e1MiSYCpjkHL0sgIQFQoTplRyIZAJGiDeOpcuXLHNM=; b=frg9IJHiBHBlSVgW31i1YaPCIfojLJ8W4WOZplXbNwXwAfSkQj66D2AAMJm50LqEI1SHkHA4brlzsJ7KvYGQ10VaJ+RH6zbYr5xSSvWf/ySqZz5zDFMCEWPaGPikID6ajD7vlAMD54Scai2hsN4YczDRMHwl0qHkJ1Yt9O3836Y= 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 DBAPR04MB7432.eurprd04.prod.outlook.com (2603:10a6:10:1a9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Wed, 2 Dec 2020 09:00:00 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::b83c:2edc:17e8:2666%4]) with mapi id 15.20.3632.017; Wed, 2 Dec 2020 09:00:00 +0000 From: Joakim Zhang To: peppe.cavallaro@st.com, alexandre.torgue@st.com, joabreu@synopsys.com Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH 4/4] net: ethernet: stmmac: delete the eee_ctrl_timer after napi disabled Date: Wed, 2 Dec 2020 16:59:49 +0800 Message-Id: <20201202085949.3279-6-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202085949.3279-1-qiangqing.zhang@nxp.com> References: <20201202085949.3279-1-qiangqing.zhang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) 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 SG2PR04CA0132.apcprd04.prod.outlook.com (2603:1096:3:16::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17 via Frontend Transport; Wed, 2 Dec 2020 08:59:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 20d1f2e0-b9e8-4e7f-540f-08d896a0a651 X-MS-TrafficTypeDiagnostic: DBAPR04MB7432: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EXNWZx+VXKLue2MwSIOUjq4pD1HT7wD7Fq9HCXYCN/50G3xDfy9g56tnYDWhXf+AhfSFJkvhUl0nPINwv8odXiTuHutwom3CrNdHOn9Y4axDf+B5qT5a1SR48QFDDyB9e0o9cG4mb1USv0Vfzx3arGaRBQwqyOeXrrRZuWL0qChir7delUimbe4bJCnmxQS5HjgggJd4U3Y9rk2dc7U+/vi8XxuG2uMKZm2c8WNKwCesQ0zq2+RuGIkrbfxlDtwG4nv3rkHN9myPRMD5jtsMdQpj6XR48vkcbEL1nm0ELUWfKtnVV8750mH3rO1GMIKt5XzsVqpZJh4JUyVzKHRy4AjV/uWxD1m3uSk+y9/5X0BDp3Yw4VKlC+vd+l8Tcz/V 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)(366004)(396003)(39860400002)(346002)(8936002)(16526019)(186003)(8676002)(26005)(6506007)(5660300002)(36756003)(83380400001)(52116002)(478600001)(316002)(86362001)(69590400008)(1076003)(956004)(6512007)(66946007)(4326008)(66556008)(66476007)(2616005)(6666004)(2906002)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: LMHc/JRvLCY0s8I3GohdWb00pAn+L9nySkSyVCCVjEcVXCEL6QgvCO5XNUi/ys6VSc9fNIYxJJ0w/1Cw5Oaj29e4J7NjLHnc05PaiobXz6zLuAczyHbl1NvTXtQ1wU14Tio5MdSD4FWdeZd/1giSq+yRcpf/SWiY31kclAEuyXdtV5+LaaOh3lGLaigcOZiCDWOVrl0zVtLWSq9tjMe0HvUaLLkdSNjWL1ft4p1cqM3u57tzpNBF+HkLTmUJG+ScRFuKAolA1f/kZLnYXoVcbQAIWpIbknTwrVCrHz96pAcDxnf17sGG8s2w/WqS4RYTn/rBZIHSSG01puK0B4JaA9ehuQJUgWe1T841jVChMTNFKY+Rw6KG/Sz/fRHoMgahowpyIJgL0QTp1W35JxOxCG0GZgpl/MoKc2rU9BwK5kT6Ox/HEyiZwyse6MFkVxWywZgVybDBDT+c1Rrc/GBmg4GhFlS7Fz/CW55dI4oQjqtLS111sIE3m613YbLlDZnT4w+BnkGozzpCdyxFfmYutcFClyRXtGVWbGSsDnfWjuo6lIRQDMm52/fiUXxdxNPa/sbJ3PTtNUGeTAyOyxWrL4QHcbzuY0N5cQpmHU1supXK/xAZTsbzWOB2BUQZoXkxxGU/WG0k/WbKm0DjBD89fK9XNJl4rlE3EX0htFuYfnpOPBGlSDF9sT0Fy5SxzOhMmLjYqRRohdYnp6Ns9y6myYHKsdljI8kFqh3mAejMHV6G6i4lQsq04LYI89F+Bf8gN0QlzGbxZwt5atyTkQmlL6g6ULPrtceqrRL11edE/8JFnGksRCA/KWbF1nuCRrzkmHScd7+OyN96qZWrfa6jKYqsQ6kQeGleqaU6JQFG702WT2ggqTHByPAYXcryejubkiKMH/ogHnCaPm9xtrz6Dhe2LzQvI3/XBYbVq8aRnIifaFH/ee52HsRfqdX2Y7vEXBNwJvm1fZ1jf6ajbmSagMxaPSqG8BRm77jE6ylCOmSrikCeOVtd+IlGzgVw8Ave X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20d1f2e0-b9e8-4e7f-540f-08d896a0a651 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2020 09:00:00.4267 (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: ddVLPKcZMQMntwrkHg5CNWAcTry93YKW7jVlzPQu3LALPifiydjQsAd/nVFnKJIHPVVjjrJat3n39dAs2iSUBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7432 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Fugang Duan There have chance to re-enable the eee_ctrl_timer and fire the timer in napi callback after delete the timer in .stmmac_release(), which introduces to access eee registers in the timer function after clocks are disabled then causes system hang. Found this issue when do suspend/resume and reboot stress test. It is safe to delete the timer after napi disabled and disable lpi mode. Signed-off-by: Fugang Duan Signed-off-by: Joakim Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 53c5d77eba57..03c6995d276a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2938,9 +2938,6 @@ static int stmmac_release(struct net_device *dev) struct stmmac_priv *priv = netdev_priv(dev); u32 chan; - if (priv->eee_enabled) - del_timer_sync(&priv->eee_ctrl_timer); - if (device_may_wakeup(priv->device)) phylink_speed_down(priv->phylink, false); /* Stop and disconnect the PHY */ @@ -2959,6 +2956,11 @@ static int stmmac_release(struct net_device *dev) if (priv->lpi_irq > 0) free_irq(priv->lpi_irq, dev); + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA and clear the descriptors */ stmmac_stop_all_dma(priv); @@ -5185,6 +5187,11 @@ int stmmac_suspend(struct device *dev) for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) hrtimer_cancel(&priv->tx_queue[chan].txtimer); + if (priv->eee_enabled) { + priv->tx_path_in_lpi_mode = false; + del_timer_sync(&priv->eee_ctrl_timer); + } + /* Stop TX/RX DMA */ stmmac_stop_all_dma(priv);