From patchwork Wed Jan 12 17:36:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711741 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45401C433EF for ; Wed, 12 Jan 2022 17:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241566AbiALRi0 (ORCPT ); Wed, 12 Jan 2022 12:38:26 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:3752 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240518AbiALRiW (ORCPT ); Wed, 12 Jan 2022 12:38:22 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CGT6xY010893; Wed, 12 Jan 2022 12:37:56 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2050.outbound.protection.outlook.com [104.47.61.50]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj2j2g1at-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:37:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W4EDMorJalyh2lBmx4YE+SSwzIWLNPZ/ckiv7tQ/AAn76Qmc94tTGpQOT2GhiKguu1gX7GI8kTPLoNZ27L/bTcs9lBaXLowOXZRWJ5oYeKo3aizfdRz6FOO2/bijO4j+ySeWP1aNPXerg1eMO1lp8PE1qldEtBYqawBeJL7FsDnmtWX8GR8xG8Q0CrczraTL9rQwjXQXKJk7CBgi7r7NBZ0QGFESbUKCCfAaFMCB2sJ17drEemhUJI1lcydqFwYuDDtHli+aQPWNbCHJg3Hp6ANuugJdL9WVYi07vJWfD/ZWnpdv0MeSclsNdABxUekBCneJb7eFwOD4zrywiVBnbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TYbWVMZqFSpi6EISAGFgudiLlZEKwZLXENRjQIX62Sw=; b=XiS8f+S6ZdprdVUjJ4e0dTc2k2B/hBSv2RNG/jVXvVkgPuM1z9u1OIHjgwMv4lIRVIX64SyH74kbc5WTYlLGqNs63LCK4oNobD4b5GGKcAP4wTHiyQv2xHKyMbdRGr9384ZfeKm/x0CRIG8/wJXFpQVRpjd8Hz3u6dk8gwg6yuwb8XsWrLLZfZXnhLMrnX0ppZCuSEIEcriRNGfBf8t6GwDctKIiPdQvEeHo/BGSkp9xvzyslIgUuXv5COOn2dAuBD7fI4h6m5itfok3rgU4yuxlT3KEL73iuFNm4iQ4YNcSCjo6sVNeX/wkvzigIoMHST9KbMgOzyREnG6LbiHTwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TYbWVMZqFSpi6EISAGFgudiLlZEKwZLXENRjQIX62Sw=; b=xvDULi/qzDo7iTSDNLnJIBW5qDWERZZ+LNhi7HOPdZRqBYe/8B4jnjX5bagbJJZXvjaTSd1gr0Hng8XKlCqex0Hd6fxXg3Gd9w6cKhoUDdcS8CVGHU5sV3giuL/QgERAb1g0qQ9csu3PnrBPpqY6fjiLdUkdXGSIIJ6vvNL8ACo= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB5789.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 17:37:54 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:37:54 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 1/9] net: axienet: increase reset timeout Date: Wed, 12 Jan 2022 11:36:52 -0600 Message-Id: <20220112173700.873002-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c16744f-7885-4638-3a05-08d9d5f243af X-MS-TrafficTypeDiagnostic: YT2PR01MB5789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:644; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bU/muN6lhMdEFUaKW32Hdh/Bb8VkoOisDCuxxGObGZfAPmHYItwMJAf5BNCC6Pp8937PTyZbxfOFbG0WYBLQeXJottApoQF2KHR3GeH02lZpVT6kdLufIZsm2e59j5jetmRSoEDrUknMGHEN/tqtoijKAa0coNOL7KrFIkk0GMqowg/MFNgGIJxaqbkhC8t515rXziwikIQDhUxbUKtx+hwh7wbEEc+9A7Knzb1njq6dWNONh5BSkoMsDiFioCfr05jhJeJS6Hhvlk+WPxTddDUu3UDVo7EBHDK3gzVbEkY5S0EEdfPMbS9aW7DGGnGE1M7NONEpp+Dzmh0MrgXRCG9rUqAmgeanPwDYWJceIwYJLM+1MYnbhxxPqe1yiLshW5MQVesMQkPyIQB4MDejEbtHYq3nt5GdE46SrpWGQTmdZuYaRSwg2pwh6Q4Wgx7TQNVmU9+yWgmzNpXqjnGfwWKTVxL2c0YNtPoNoQ86VOsTI/hqHsGQQjPmC/R1hR2khY4jWTrPmMwAvnJFq+4SFYvzespCgPdH8HAfTDv7u5OEqN/xzTFu3Lk+feyMj3megOols4N/1gNVMnZdL2KMTWw7nY10sP6KXjtgGEmFpaD0fzqBihq6uU8m9KDVJVj0jWakaf984FO/5PywhxDq7+nN6cB46tm6noOXAHlt5VUJxI62H5tyYAepwADHpIQIlvF0ioUCz+tLSlml/G6clA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(38100700002)(66556008)(66476007)(5660300002)(38350700002)(44832011)(86362001)(316002)(83380400001)(36756003)(2906002)(2616005)(6506007)(8676002)(186003)(6512007)(1076003)(6916009)(4326008)(508600001)(107886003)(8936002)(52116002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uI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cpr6ZcNW2mB5lzvtOyC3fHpYqXH/Mn3UaJzNMVKhidyTF2h0m8lC1zDClvTLk5brx2wV8NauzD/ihc3Yr3z47Viuvmf0iadlo73KybQOR0qecL64v/dmvNdd1e+hX90vsy2P2dZL/jZJcUnbkiXGvtXvxKqDnzkMN4i0F56V1V0dWxbHpdvy/ohYqq2s8pNuqqXrzjmFYr6knnCcFzh24n8rP6oiceMCo1RC5KGLkxC13W+R/PwoGKSno4+63O6hcVQS2kTvVowwjDVSZfp6X6Zhb4BhLBgodfXZHS/R3U6t+KhthdJqTv2c3spSDLtK3Hvf2o8nis72yLGXgMQtMOO2KLYQWX8Fg8Ob4IAU56vczB5DQndMgg5lKqwHZ5dMLMLE5xDzRIbS+N/Sf+rgAUOQ11DXUFUN4Jwdxz0hPV2GF+URP3DDOHvpDgztbvKhibVll6WL6rq4vCnTv72x17JdHtw1YJK17MFS1Q84l/aI7OqFf27IfdRyAcvlyqu4nPhsj7jtL3zIbKjSo2wSabE1ytAP2TdA5/EhJmr81L0U+inT1hSqDm9lHtbeTO7pgqT5lo+p/gn6+CdB4amrulgHd+XYEKPl7IYNTcYgHBIzwX36MtWE7AhWo= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c16744f-7885-4638-3a05-08d9d5f243af X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:37:54.8056 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: IuPBx4f6AtkxI6qq2B7ncqqYh4253kYOyK680a08jIHfVRA435oCNBpGdCzyJwFtqdPd2JJyFQrqt7hcVwD9hXwgiz+zwdfkQa9jLdZ5+6o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB5789 X-Proofpoint-GUID: uiAKm1FaDGWqYTKn1TisO4-xNnvwm49C X-Proofpoint-ORIG-GUID: uiAKm1FaDGWqYTKn1TisO4-xNnvwm49C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The previous timeout of 1ms was too short to handle some cases where the core is reset just after the input clocks were started, which will be introduced in an upcoming patch. Increase the timeout to 50ms. Also simplify the reset timeout checking to use read_poll_timeout. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn --- .../net/ethernet/xilinx/xilinx_axienet_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 90144ac7aee8..f950342f6467 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -496,7 +496,8 @@ static void axienet_setoptions(struct net_device *ndev, u32 options) static int __axienet_device_reset(struct axienet_local *lp) { - u32 timeout; + u32 value; + int ret; /* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset * process of Axi DMA takes a while to complete as all pending @@ -506,15 +507,13 @@ static int __axienet_device_reset(struct axienet_local *lp) * they both reset the entire DMA core, so only one needs to be used. */ axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, XAXIDMA_CR_RESET_MASK); - timeout = DELAY_OF_ONE_MILLISEC; - while (axienet_dma_in32(lp, XAXIDMA_TX_CR_OFFSET) & - XAXIDMA_CR_RESET_MASK) { - udelay(1); - if (--timeout == 0) { - netdev_err(lp->ndev, "%s: DMA reset timeout!\n", - __func__); - return -ETIMEDOUT; - } + ret = read_poll_timeout(axienet_dma_in32, value, + !(value & XAXIDMA_CR_RESET_MASK), + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAXIDMA_TX_CR_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: DMA reset timeout!\n", __func__); + return ret; } return 0; From patchwork Wed Jan 12 17:36:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711742 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E028C433F5 for ; Wed, 12 Jan 2022 17:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241684AbiALRi3 (ORCPT ); Wed, 12 Jan 2022 12:38:29 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:6309 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240545AbiALRiX (ORCPT ); Wed, 12 Jan 2022 12:38:23 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CGTfCs011851; Wed, 12 Jan 2022 12:37:57 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2058.outbound.protection.outlook.com [104.47.61.58]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj2j2g1au-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:37:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=noKYD8pso7qyK7ODS03EVwyoCLwxwvB/ufuVQojvD46sT44sB3ujuMUo/68ssNB3lcd3aSmf2P6mnySmUxWPqwfQrP7dU5R6FdnUu5Y8OBS1gXGSKD1fuQQP028b1RKUpGR53Ze/AbcgIFcl7HA8wvV350Dtmfn7Q0CHjaSBxvxDXQKC5cx7xm5jFHROKqpKQfBwj9Y67ZZ2+jnmZnZ5h+BI+lUvhvuVsYd2xyfAld1Y97r76UxEmyGWx5QmckcpzV15g9qdYgsItO6s5w8eR+53/MnuER2Agv1HT9SwQutcZmkEeE+j06tfDdYLEayPN7JKCB/QBA+sYei8fZyKDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UvvdgNfndhGbQgF/mjpBGV6NrF31vEvz+1qAA7Mq0aU=; b=hxVfdqZ791ykMkrSnrAhB1CbMTJM+KTCSLjBVhxbBubv4UUVhcQ3GPO1i2Br6+2uk5gqlJ4Z7mm3lcsmCa5N4JduICztdocX8L/NT8le2UjVQo5xMGx3Kll73BOhhliF5nnJ3kQ13ZQdM1vfkPKP0oo6Ugnw4aVh7uILADgCC/3vBt0aycLJT9+EfiCw0dVgfejsmtxHj6sv4zi4TqZ+ZN/e/mXmMuqVToIPfHZite242gWctzsLIKgvWtN6fLDvWRZn/0o4S3cPN0fpNlEdsv9UCT7kDzpVgOhCX50p6CwFzXFVeK33N6gTx5GhxWsQlyWh7C1+QFhP4l+J4a9B6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UvvdgNfndhGbQgF/mjpBGV6NrF31vEvz+1qAA7Mq0aU=; b=XTfeSEUN0di1bP2fQvrPflUy2yogjp4pyz/CJnziOaP/riJXsvZY5xA8qKnPyO+kGjaQ9mxVUDVEEYhm+Dj2zCasBKfGvTi2bNcEgNaotYsNc2jNJfVODqVuf56wBoGW3rUvd7CN9WpJAdGYQZy+ziyqms5qAWPLacZqr/joYq4= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB5789.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 17:37:56 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:37:56 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 2/9] net: axienet: Wait for PhyRstCmplt after core reset Date: Wed, 12 Jan 2022 11:36:53 -0600 Message-Id: <20220112173700.873002-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f76000e5-47c4-4efc-368f-08d9d5f244a7 X-MS-TrafficTypeDiagnostic: YT2PR01MB5789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gtpRKDn3eybnjNIu9MWJrLxqIHOxHomDdRI3GEomrZauoZuhgge9qnl7eFeiOSnrZntKzqR+M/jTLuPOapsmDGvDpwnu/40KRVjlbxPQLTxgAPGl+Hb1CmsijyRa8bv6YSKEfTjt/WcbneWR5KDedGRd4FAZZ+Xm4NS3Thh4skvhQlwCrfPA/rTvBrEJeCbuR/GP4XO+D0gqiEIFBnGrjuIyOQGbf1Gh2zxK6gJOqJ22dGbnhgU93JI+cdbA+1UDF+Y7r/266bu6F2GHFy2lh9xjJLPW5BmhpBtK14bBa4gN3ZlbslKnMfjVUvcUuBQ0GqNioVBcM/+0liF9+fgTfu4RGpkdcF3lN9Hs3O8+8z3rcV/Z5uHD0n7CtLbz9DaUFklRk5pVZCnsWiUZL0qd/xZ/nUPGDRopmkmaUNvAfAhSKRFWsdgHuacguVu4ifT1MjxQu4+x6fAHjlhRlV7x4o17lB3A0bmYrBs4kESfqT4k+LpeH7nc5pCxm/Xj2adiUg+A4uG367iQ1NNemHQDbPTqemODCf3b/0GRIN3ZTTpDD1EsaPBzLHM546X4dh1hYBE0/xJrxAY/J0Pf9qtItdGEfj1P4yxUgdFpdMIkMETBkBik9R+VjTITonEdVMKFDjJtrEzbIGqvmc+SYrY7aiItRmUVU4MwJA48d2ToClFdbqcDV8RMJ3wrFBWsTqs/FiyDUYZnX4sMdpjaR5lzVw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(38100700002)(66556008)(66476007)(5660300002)(38350700002)(44832011)(86362001)(316002)(36756003)(6666004)(2906002)(2616005)(6506007)(8676002)(186003)(6512007)(1076003)(6916009)(4326008)(508600001)(107886003)(8936002)(52116002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qT1Z82QWrE0VyuSnC7Fhj1H2yGgOhlNl8+mGQUeA8EzyBWLLpdBLTupTAR1MhIlgTeEjeo6g3qN6x0UdKuDaqdV6EZfq3SNkD2abQ7xTL76PyzTcFCi0A+z5rG9S4wslX3c9Qr5P+osu2yLaMXs719r7wZzWCrSaLoZ+pTkhhbUV+5qeEO8L3WkH94WanF8z19YBAnxKnUTl21ZLXjrFhfR1W0nunJ6nX9FZWGnlNsMHgbXhwudFoKbJ58Mj3OJ+QTyHXnI7S0/fmcFdTR5yFpxha5RdrlVzqD+RKvR/Fvm2kKxAzqWuP+ly78cyV+8+aMYXz1/KVB8Mq8TSYh8n47KWuWEZKhet3cDXbtcK54hRZpb/1zXpjWOx1NGfwxx1sdkg5aTX/XK8+lNlqdVPhnUtpQPSv02ccCDzHiX0UksuqhsDZwBlWB7zt5FmgO4iV6lRl197LqJpgfYyfBB5rpRz5SUxaLeAX8muvvptfZm/Y5tfr8xOjulJaxq1/yJ0bFHz34Ymo2gLspeFJqQd1couVGMrm3j/ihsYOFDDlXQnecY1quC85Sx2K4rrsJLfWTuWcPKJbYY7VVFBySxO9/P+BL+s1CfuI1e2AvezR/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riginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: f76000e5-47c4-4efc-368f-08d9d5f244a7 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:37:56.1184 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RTQ9sIUO8WygmPVSzOtMXaCyzF+fJzdKPFsiOJhwiFxy6nbtXIhMLmLXif3ZHZh/SL5W1L+OXgWj+wqWItjLIUEjnJpTjYphrTBcvy7l8eI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB5789 X-Proofpoint-GUID: DpA0gRcPSQStpIy5ZMkT7b2yrG6OhOJ7 X-Proofpoint-ORIG-GUID: DpA0gRcPSQStpIy5ZMkT7b2yrG6OhOJ7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When resetting the device, wait for the PhyRstCmplt bit to be set in the interrupt status register before continuing initialization, to ensure that the core is actually ready. The MgtRdy bit could also be waited for, but unfortunately when using 7-series devices, the bit does not appear to work as documented (it seems to behave as some sort of link state indication and not just an indication the transceiver is ready) so it can't really be relied on. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index f950342f6467..f425a8404a9b 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -516,6 +516,16 @@ static int __axienet_device_reset(struct axienet_local *lp) return ret; } + /* Wait for PhyRstCmplt bit to be set, indicating the PHY reset has finished */ + ret = read_poll_timeout(axienet_ior, value, + value & XAE_INT_PHYRSTCMPLT_MASK, + DELAY_OF_ONE_MILLISEC, 50000, false, lp, + XAE_IS_OFFSET); + if (ret) { + dev_err(lp->dev, "%s: timeout waiting for PhyRstCmplt\n", __func__); + return ret; + } + return 0; } From patchwork Wed Jan 12 17:36:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711739 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBD80C433F5 for ; Wed, 12 Jan 2022 17:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241141AbiALRiW (ORCPT ); Wed, 12 Jan 2022 12:38:22 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:52557 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238250AbiALRiS (ORCPT ); Wed, 12 Jan 2022 12:38:18 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CGT6xZ010893; Wed, 12 Jan 2022 12:37:58 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2050.outbound.protection.outlook.com [104.47.61.50]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj2j2g1av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:37:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j6TeKvFhX5HO1q6YhA1mXVrd0TAds/8W6TE0w57azSsbE8/ITI8lJjHmVEq9PZ4IjMdlsGSmCAySjXnR5zjnXdAWTYqJ0+8uCfPqQ2cWgiPScrXgr1o6guJQulPFoEzdk/Pis2nhS29K4msTAtADkLxVNqKk5OmodTxqwQdYcd2RWpc8jzpx9S0wVQuDYsDjH76eK+6jopyLl6F9jVLcmm0nDYntc7ZDJrpX8xwUSXx7HITdsP905flG6N0yX0JaPZ/XhyNGJOQD+VL6NbJfKD+P/a/Qgo5y6hM4T99z5+kiRu3EHdOvKFNt3IV2f9pupDfPlEwOqNrr2J+ywbW6oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z3dMQGQgmqY6i5JsM9S5Mxn4i/H77WfgCoxjpWZxTMc=; b=nmp+qd/kbrfwakFz4v+CM1YvHjK2SyA7CcCDy84A/LzgwG6E6CYmhbGovCwxRZxli8aZcstXMG3WwgslCCUrwJwMkbc77Bh+iArPwlP0kVEeRxKIYyc8wJtZkSYBnnhrD0l9Vdiwdaw6wBPWRnu2d6rLDCD6r7HizjOClrTc5ch9ellmi6ed/j7AF0NdtzkcAnedzg9G4nkaPZkD6uO9FD8iAmw04odbwYJHUrXmh7PR2FGiIq4/mu/KgneZ5IdNyfvNC5kM3W1EJo1S21CTrZseB4/Ff1Bi3jLuBDSgoqrR4ifF3w0EpjE6U7cIJpM8N8I9K0O1fAlaFv9lNXS0LA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z3dMQGQgmqY6i5JsM9S5Mxn4i/H77WfgCoxjpWZxTMc=; b=zfne/pnwJE2wUkyToWJkPRGwpL1utO6eTfW5ZFQy4fb7CbS7Qwas51j/BzOyaTayhrclNZbg8/PsubzVSWszsybgPNwBW74Hj8a2IliNmiRXW4qO7WPJhK0G8Il8Cj+kunZdt+4knDCYqR6UHVWVHCIDmh0/ifIZqaWQrmr3fc4= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB5789.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 17:37:57 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:37:57 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 3/9] net: axienet: reset core on initialization prior to MDIO access Date: Wed, 12 Jan 2022 11:36:54 -0600 Message-Id: <20220112173700.873002-4-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1c2b12c8-e3da-4742-77fa-08d9d5f2456d X-MS-TrafficTypeDiagnostic: YT2PR01MB5789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JMS5Sm7HUAodhLKcveoCtyQtV0q4gK9bPJ5r6BWIlp3x+06wS5RuVP8O7P0ONFQ40F7n+09uLLEjxkf+cZ7EOWCqVFU5dCLLgnjqaLtfiAQhpz21osonDzUaP1O2GS/R5eHkCltCP+Vo3n12vZv0uqvFxICzueTGIBJNZQehLpCGcThiLBmlbvwdnHypk93yCX5g/5jD4rzLf+GhHYZXbIQM002uJAn+uFzzWDAmDueP40RNu3C5gzG9IoOhRPOGV7CDmHUaC7flYAL3pTn4mfhov0dibIVdpwrVBygnKxjxIe8ZED7zQCnTdaDDuY1mifZ7Jdho+O65Sq78FIPJpSmqTnDwHGjOFg8ywpdSJmQseNTNjmVRcp6ZpkJaN5Rfv9JwhN5CzVbDOBZn3AjyoBPJSiyzHfs69JPE8AP8glq9WbvHQB1/uxtjKbFtt0vpalj0EgQRsWeMdIuEuijrIBbcHRsNqc/ayQ5qMPUhwhhD0cJ0bzTfRJPkyYZLb8yCXTJVnSxTroNWI+zdR+a3J7jpFIdomqRB2LjTKMf/2QTJx7MNvfTvgm2yhkzrfs6ryoI/B4CfY5gMurmaFzeBDy87WbXhipuHjCt6vUUlglXAckwyW1YlCoYCT5mOAC7se5a2yZEkf3WisQw9gK/roboD7EPTLmpjKbQR+Abrp1CaontSITFAgb4S0TtMXBiTesFvgvtN8IQndX4Ixzs/mQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(38100700002)(66556008)(66476007)(5660300002)(38350700002)(44832011)(86362001)(316002)(83380400001)(36756003)(6666004)(2906002)(2616005)(6506007)(8676002)(186003)(6512007)(1076003)(6916009)(4326008)(508600001)(107886003)(8936002)(52116002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GERs7Xp9R4QLgVEgvysJSICAlVH71XiQWw3NnXEnQiuXiARETAwangqNoOrlsfJb+s73fLjcf7LcP+ENWVEbc8mVNgSazM4HlJ5ReHPzo9RN8KjAZE5IL5tzLO/macTYyq1aomqpfP4yIQ2NhwjH9D7edR4+qJpZKtLqo4MqJkb44l4p4NZd4BLEvk+nDFqzsWSRJFqDCqhuCbYJdaZGKUtV29pEj56PT6mhipKeA6n2XXFXSArdRoRZ1Nyxdcf9pu1PcDtfFK+huemP1a7v+vp+xrVZHk0NqiA1MTAtzbIyef4Hik9Owwy6Hnj7LaGK3Y3AOV4I2SB5ZQCCA5/lHzxId+MVfYziTEvv8pUgVNfuwfJVb9bhPmvc9yc1R1BB2TJY6UkRQcYRrrdQCwv6kL/TTxz8+tWo173zELqPu7hTZaUTkk/LWWcvT49EVN69RSYPgC14SFAKi0e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5aD2tkku1euQYSiOUJSnJgGf854QaYcCsXOFnX8byoQ9mfSJIOpqp9P8doD/OFfOn5iKrF9paojXjxGMFMIkrKwodpH49vZB5CrzzyacmbINdrn/yyeRfuVXal071Jv5s8bqU2mTV/K8kvhd3h86DMQlb9Qdyd1A= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c2b12c8-e3da-4742-77fa-08d9d5f2456d X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:37:57.4659 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oX6UeHp7GNBbpDtQ79x7pb/o8FGRvf5nYuoT+2VMlpze0ZTvqBwjQ1zUmZ0q4a3gI54/HAi1RZLumUuxVWgZQW6SK61RHt2pezD9ji8iHVI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB5789 X-Proofpoint-GUID: D3RHLHVFxfa3iW4LtEqW_OUg832yskmY X-Proofpoint-ORIG-GUID: D3RHLHVFxfa3iW4LtEqW_OUg832yskmY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In some cases where the Xilinx Ethernet core was used in 1000Base-X or SGMII modes, which use the internal PCS/PMA PHY, and the MGT transceiver clock source for the PCS was not running at the time the FPGA logic was loaded, the core would come up in a state where the PCS could not be found on the MDIO bus. To fix this, the Ethernet core (including the PCS) should be reset after enabling the clocks, prior to attempting to access the PCS using of_mdio_find_device. Fixes: 1a02556086fc (net: axienet: Properly handle PCS/PMA PHY for 1000BaseX mode) Signed-off-by: Robert Hancock Reviewed-by: Andrew Lunn --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index f425a8404a9b..f4ae035bed35 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2055,6 +2055,11 @@ static int axienet_probe(struct platform_device *pdev) lp->coalesce_count_rx = XAXIDMA_DFT_RX_THRESHOLD; lp->coalesce_count_tx = XAXIDMA_DFT_TX_THRESHOLD; + /* Reset core now that clocks are enabled, prior to accessing MDIO */ + ret = __axienet_device_reset(lp); + if (ret) + goto cleanup_clk; + lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (lp->phy_node) { ret = axienet_mdio_setup(lp); From patchwork Wed Jan 12 17:36:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711743 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D95C433FE for ; Wed, 12 Jan 2022 17:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240838AbiALRia (ORCPT ); Wed, 12 Jan 2022 12:38:30 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:11731 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240793AbiALRiY (ORCPT ); Wed, 12 Jan 2022 12:38:24 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CE6ssh020480; Wed, 12 Jan 2022 12:38:00 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2053.outbound.protection.outlook.com [104.47.60.53]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj0fcg53m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YZOWluWWVNxLQvgCtUbJIU0coxNP1USJWTHLXojNN9AvaONvEIXeNmOCqM5R1/+Rfh9a7iP+mUle+npFpA16AmcbAe/LctJCrze2o6235CI5zlkuaU84im5V7AnA4PuvJXAkcGflNdfGw6jrY17UxX5NZLJAC2A8ew6r5SMnNsEu3W+ATaawAszczJYPnThpmqfmd5bSgmWnKqHFA6rmwkqUcK8kxX2iHNv17M7xKER56t79KknFtfm84dzlIhBY2HUyRf7OTOgt5As0mNf3Z1L/TaMNGZf3gu2vBwn35zx1i+3sX73ce3L2WuSZCkxFRqrtASB5zXGubOzQm6PamA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tPp8Tc5o958at93hIiyc4I29AVhusfEQyWU5KGxFcNg=; b=A1aZkzxZFWdDkoAH0+FpkJnVymj7DHCLo+LS63pwmqXvfOszkmyI5jFlmVoHrblr4AzT79iwojd6PXQ9mHeHaqDcUDNUVB6wH+3x1vB2bDCp0xqROzxKNoTNAQmXfTXqZfivMiattwSqIgbSfjJsr9tdgaAxcLv3c4OV50iM3jydiL8cczTDAKT3jB1itNSK0o3/1sPpwoKWmaJx5jNgx4axMN+dw230USND2xJ9xfcfdE4rnKnZhC3uky96FvH5F8l0hd23NTxSmxce3njC3hrENP8smQD6RA/LuUWkuGUf2uFOz7J29iRm8ANnUo0rN18z0sjnoa8SvXjmSodcCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tPp8Tc5o958at93hIiyc4I29AVhusfEQyWU5KGxFcNg=; b=BvbwNmxlNli7J0X8EPw+iWWbDKXLKkhkKN4RqrinxrUqM+zcLdbLPHHppdt/i5KUvG9vYW5o7wLWmbQ0S3vZ6XUhllr+SPnuAvv603Hzf6lskv2F9X1sp7KZdOuIhumfNqeBNQf6jX5xErRcL+qSod0p6c1qq6fhkm5DChtinnc= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB5789.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 17:37:58 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:37:58 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 4/9] net: axienet: add missing memory barriers Date: Wed, 12 Jan 2022 11:36:55 -0600 Message-Id: <20220112173700.873002-5-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a574dfa5-533c-4977-c21c-08d9d5f2462e X-MS-TrafficTypeDiagnostic: YT2PR01MB5789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ND4y1aIVp1yUATY0XjgAMEH88GVV9uUhsPNQgmqvf/zUVwN9y/YPMbQ/oVFeu3pNI4hLNXEoYG4gMXFP+B9jvc5k3gMM21C0byeJQEMxdHxm6pSZdBYfLlgwylOG6v4XPUz2sVuLnrmP6X35jrbplNwzf4O+fSUOhabyQRrHSC97rBDidEB3B/7XK0gH6/6/74S1RhdBAo66Z7/FwloSS1Ze0G3TTAeyQQ5cPHmuA1q4q77a+IJRtg+TDnHtybjH85CdfrlDUSoZl8QrrcfwRW0ajACTtduZKAMRGkfRMc6oM6gznxtceSbcMTWR7gCGqtV83Uj6GaiMH34c4vVWmZ6Lxx2pUd1JAOb/zpxuE8W3/sONr10buFeZ5GV+qh5CBcM9PhWLn4Y7uMI7UzQHDzc//I3b+JH/PiicErcoFjNt+MDMp+PVmG7cXjF526VUEsLucHIVFxkdwhPXYdPsECK+C7ZGkYxusPlYKaSz9KkTZfaS+xiHlcmEdjBG0uzJixFAayTQ/SItjjBCbLVxmerLwbMS+pI6gHRmnmoE5qadRAd1h2O8piWZbxhLmChAYdGZNxUS9o1aqUc0Nl8WSllJYMSN006B+LGKbfFjaoUBWioKVWyMOP5DQb3YqqI8rTJcSURJkh15MLj95p9QoyeNiiyGfXdlw4CligciJQUNRK2bvhyIgVwrtSX9V1Ce/pgB8RieSS4NBpI3kmGO+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(38100700002)(66556008)(66476007)(5660300002)(38350700002)(44832011)(86362001)(316002)(83380400001)(36756003)(6666004)(2906002)(2616005)(6506007)(8676002)(186003)(6512007)(1076003)(6916009)(4326008)(508600001)(107886003)(8936002)(52116002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cHUgQVzFHLhY0HGlX+fg1gGSojJ5qj7DkZYJ4+0W+g9AVOso/hK2gPpvTgH7cbZeiSC2bsv2ZP1Fhb5C5Nu6XJ3p3zKxBDmz+4HCpccgPGwqGXf+QqBnKe7MgL5zzVL/GobRjlUZnKqrM/pQC99xU2MqrHXBL+DNs+qdX+rgQOqIXJfZrJNTFj5MTKhQY/F2Xgj1A37dHuCYiGPWnXq9ncIfxju2LDTsffWANXux1/woA/t330825poqWvjbQ+Wx1SQnYuMh8FrL2dzV7Edz0r31ipsAi3HbPIK8ulYC9yIH6UgfTve18P3/R0IJ8YheUHGelxUhs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Xu6+deR8JT4escjrueLU1aF9PKwpA7U6UqR/YszNMImyYILckwEzNYGIjkC5aDgt6ZJtc7bhedoR/4bkUQ6qA8a2Phyn2N4LjrfMbE9yKfn6faAZnLRYsP6MlyxNz9oqY01GPCMxZu2FhgFdfLd+zY0bY/v3Bp1C4FJkvV7Wyqrjz1Jpp+uESmkmt6j/9U6+MoJW3WdLbzQFs7d2JsHXsyRPefoiEoFWUVlKw7dD81uwVZFm+tEOmg0bDl6xAESDONAYZD8xD3vZUd4XNXYnSAPfoVGlNy0kBuv4gDVWo6QdHAXXE= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: a574dfa5-533c-4977-c21c-08d9d5f2462e X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:37:58.7000 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jWGY4/JBychwH5EI9cdHhVqYSPPyDNQW3K5OKKMrfzRQcd/LBZII9PM2JE02xq2nMK529vjQIjYZxM1oK9gH/aKedBUl0bwi3cHMNukt5yk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB5789 X-Proofpoint-GUID: jrjFn2xD_5fPfiUNFk8GvnshAyg-3Uqs X-Proofpoint-ORIG-GUID: jrjFn2xD_5fPfiUNFk8GvnshAyg-3Uqs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=658 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This driver was missing some required memory barriers: Use dma_rmb to ensure we see all updates to the descriptor after we see that an entry has been completed. Use wmb and rmb to avoid stale descriptor status between the TX path and TX complete IRQ path. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index f4ae035bed35..de8f85175a6c 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -632,6 +632,8 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd, if (nr_bds == -1 && !(status & XAXIDMA_BD_STS_COMPLETE_MASK)) break; + /* Ensure we see complete descriptor update */ + dma_rmb(); phys = desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, (cur_p->cntrl & XAXIDMA_BD_CTRL_LENGTH_MASK), @@ -645,8 +647,10 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd, cur_p->app1 = 0; cur_p->app2 = 0; cur_p->app4 = 0; - cur_p->status = 0; cur_p->skb = NULL; + /* ensure our transmit path and device don't prematurely see status cleared */ + wmb(); + cur_p->status = 0; if (sizep) *sizep += status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK; @@ -704,6 +708,9 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp, int num_frag) { struct axidma_bd *cur_p; + + /* Ensure we see all descriptor updates from device or TX IRQ path */ + rmb(); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) return NETDEV_TX_BUSY; @@ -843,6 +850,8 @@ static void axienet_recv(struct net_device *ndev) tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci; + /* Ensure we see complete descriptor update */ + dma_rmb(); phys = desc_get_phys_addr(lp, cur_p); dma_unmap_single(ndev->dev.parent, phys, lp->max_frm_size, DMA_FROM_DEVICE); From patchwork Wed Jan 12 17:36:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711744 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19953C433F5 for ; Wed, 12 Jan 2022 17:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244118AbiALRij (ORCPT ); Wed, 12 Jan 2022 12:38:39 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:25934 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240781AbiALRiY (ORCPT ); Wed, 12 Jan 2022 12:38:24 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CE6ssi020480; Wed, 12 Jan 2022 12:38:01 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2053.outbound.protection.outlook.com [104.47.60.53]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj0fcg53m-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AqtqD6rdchkvyyGWLAIluSmTB1sZ58Hs8JJ2Y5aSnanV9zoXvxEkTT6oMH1i34bIpjbqAckWsNMspBkk+QsFhm9WV1DYmAKrGi/wSojRfDjYT/0lkk+35F/LdmAWpmFS1R5ij/CdRMCQi7LGV/mEbdtfdn+lcXRQ2IjXdtDK2u0TFo+5AuNQJs54PBsnauBjSjWygxLuFZ2ZwoY1SMp9lMSWIjTjoZbOBd1BHQntyRDUDDonPzoCfIAlmQ8RHAKB+GyhW/k6rpNoGOvkSvoxfR8OIkTwqA4ZGBMWwWwkvVvhtmvzUEJng1HcxybkgzRYg4mJTFjcyEB2ip/E+UK5sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iSV1LcXhDE3eLySVJixtB5wpsPh+VDaIOsTT+RVzZ6Q=; b=JrJ+f0FUaqYutxZMlKvgd6GnjKaWeiITGLDqahachIVLjCVmglTeAXqrKMeMYHYXTuuwXlfvfNcLNVlKuQLproFKkmhGGjBIb4oMMXyXnFHT+E1cxQjBqA9O/NaIGgQmi+xBmHYctLnFUxPetnfb6dxTpTFUrV+iTslRo4+NWMZZW2tcstRmr7zTP8WzhIu/7tXYsvOmOqnD7i66qOK4gugfa3ls8ho6GLXhwuhQYaGcNG8+9ysKVhw5EpnFT9g+8xRjR9FFwJ1JIA5dajJ8uXYmKIinQds1xDno3tz1QkwvgHFPlvQFtj9ED/bw0iOFArdfvw4NUSu9Zr//MAv/Sg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iSV1LcXhDE3eLySVJixtB5wpsPh+VDaIOsTT+RVzZ6Q=; b=3NSXsFGnkr8MMm+YLb99FmEHKSwhjwmgKx9sHm3RT/1HaBEGoCnTcGsfsOHLnHirmwuIZhTWKT8IMUS+RHrdBS9s5uJwhavyspszGHBCBQ/pkInE3KBuj8wbnR0OpU6W81xDEcA3XG0i9M0rUOVkzAo9Md000zAEy3kgb9+5QhI= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB5789.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:55::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 17:38:00 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:38:00 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 5/9] net: axienet: limit minimum TX ring size Date: Wed, 12 Jan 2022 11:36:56 -0600 Message-Id: <20220112173700.873002-6-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1eb429c6-a7f1-4b1a-ae17-08d9d5f246ed X-MS-TrafficTypeDiagnostic: YT2PR01MB5789:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IjPLOV9pQpAYv+l83jIuz/6ODiHZKFkGkX/ZnQD8Bp1XNEk8A7QPfzn949P1qJEMGse8RhhKIhHWUwtcte7SKFHVBc2i34q+FtfEpLwn5oFQSx2u+ZRK2SZsKzMUyeTDi2O9eHDFswutrw/M6I9hlFQD0JHmvQnh6N2Ncn6ymPaG6yLUj4ep0T+efE8j18avp1owvyMKADwkfUZVTiRIAqM+HdRk3FqRWSNa9IbOlH+3hVzLIxUiQoMcHf3Yu3l9jgPAxdNTZSS6pI8LFm508SGVnt3BWCUvENulJq5DREw4vNJggogwaksyu1U7PZWM0OQYWfDhpZkkyMvZCwCArw77fekTGY9bczBpPyxvayEt480LzZsaMuj9WTBzvTkQXlYh0vFPOfyQKKvh33roqyLKjVqvBxoGk/X2WmzZzD5Qunxs5Eccw6++p+IsPcn6xcBoFLcES4HqcBbq2TVt5fRReR9BGON9aOyvzoKbsP9DYsGqgGEYv6BzG6O3HZcqnetUttqfcosSPgbadXUsJxZ+kfhu5E0aaX9na4ZBEz9OYYEfkPZSrN/XXaY3P7xiES3Y1QyrNgXAQf/Wj+Cshs88eW7EIqW1Ln32PQpqm3FqPXIu6LU/iMWyr6w8soECsP6OPm9hnVaIaLGOlWUCct0YIBu/GF4WApU5BfOqmMcp8nhahanVlWJ0f2Dyol5BlSWpUHJYyqDH4wMUpnJ1XA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(66946007)(38100700002)(66556008)(66476007)(5660300002)(38350700002)(44832011)(86362001)(316002)(83380400001)(36756003)(6666004)(2906002)(2616005)(6506007)(8676002)(186003)(6512007)(1076003)(6916009)(4326008)(508600001)(107886003)(8936002)(52116002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u3+oywEhh4enXqh7jxED1jiaEu3CVqjzTgevJ4+ZAu0H88lzOd7YKbZYJBiHk5dyyZANyjsFudPu/NIowNzM31fDvNqWa3EZozIH8TDVjYBj5LssmzkCbFsW1G6IH0wr0xLn345XJq9ecxRGGoUNk/oUEwFCboplzXNlxBDOSaQFXmyHvhRfgKklRrJUXGbXz2fXjMiSOVsqsfM5Be0s5lgw6pX25qodQBWiOk6sgfpuswDlr+OTzmqdEP9ovIa9JJRP3ARg7dBiy/yaARFKebIh7ZhhksE+ID/xKp5HLO6ZDRK7u+cOTxymR1+NDjYIPcJ1kFGiHtSGPCDiYG7QxOB6b2/PRB/mzpw7m5INVhXiBmOipA42Fu72IsMku9Cs7iQ4foMomt1xR9fqA4DmdyD9f3rjX3Jt9+6F3nqjgwBFJbozmfYVoE/Pq3EAULkuDsjSZ9FSPS2dHo2Ewwta+OzG3rg6Mqjx3emK9wU69hK2T9zJXjSKRqdV2NtYlIo9h28KOCtJyVySoohPYwUwrcmuM/eWmpXvwOW/xog0S2rQd6UzofNtTFbueao1cYvERlEVVHXgjHwZP1HLxCuLEHWGkwulpurMkiTKl6Ol9m6QaW+9DA/cOyHhLjpfomqoKSevGwGh3q56l/nZ/1B6dMwy3Zr8vWCFPnGOWjHsKrNHCGjKUMLGKLTOEuC+67rE3o3onpjGSgMOeEmqlksXxEuzFqeC2vPxgUiNkyjD5QMbBcx/hkw+Hs/t3zJvTMZzvX6a2DSlEuNFKG4gdj8XDe4SsAudv+7qO2oW5jtW2Crw5sgf+zo/wT8WdJctrW8eYbQa7UFc07wQhpWNEeUYFqy+OhFCMOKq7DybGSuKkl87Ode2jCsUkjFl+dzcCPzgzaKQfxdyI8OZPQbJVX/toGxx1JiCHxX4ht91igaIRdOgX56fIgUMg62eRr32kXtVmU+Va1EIB6tGbbgSX08CuIgXim9TfR0uXPNxxP2KVA6sQSTWINK74YM3kawQuAPrKeUsreDMjYx3EvpanPcdY1UldizxESc3UtYsqOnlpPhgVG3zyT6MAUhN/pHo5FsjnP9lIrUmJ6qO4mtQjJ5ttnq3qAug/BAFWIVud96gviFiNrpLC5e//Yf/D/ss0oZtLLuYUFVFAfMGvsqCgO7yN3Fj7bb9FZQ1efGILCZ4y3LNruQWhmbKcFTnEf0Dn7h1p92QGWaLeuJKxiKdbDWONDEgq2rzFiD9u4XCD+n0hR0JYvf5u3w3PW+kAYz2wKiIRndKS82VPCojqxoUgR01+oEHp2GhIZsfzSHJtBX1ZRtTug95ID9pk8f/G1PwHWduQdD3kvAprjFc5LWS/9fN13vj02mn98v5DwJw7GvS/Qc/xyo04a8F0R+mAYZhVsZczxWdfegWdcW2OQ3QIZIof2aMOJxbKO4aHmCJpe1DA4QdfOQ60ADnkfwnB9GME8T0zSTFfonzzdaqsqDcEhk728i5WuKBSr++haydi63puN0PyO3PC/fySWdfgQv5angliBk+jsf2aGqPgumsiiOD8hV53tA2jN0QcAlMQlqozPoL7NeAI/l8D/rpoyUNBm9FAvBKmANr8IDWz9dmdFtkH1FgUfCXABMGr1AryuYJ/JUgPF0WO2GiEcEtZvBkmJCXEkkkYc83gzBLAyGAY3T5s17s3yGfZ7q23p/KyZwNReM= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb429c6-a7f1-4b1a-ae17-08d9d5f246ed X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:38:00.0137 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ai8KChlMMmgy8VFLLt4OPr9wl8DM+9VPM7KKjnooFP+Vx+VKqbXXRej6ypLi97bL7fr6x1cUdy6duV4+VOwoFXNjUi3Q8gCYk+f8vCYmFPc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB5789 X-Proofpoint-GUID: cNb9QlBRLFrv3rxQFqWWIIgPnG_1HJWr X-Proofpoint-ORIG-GUID: cNb9QlBRLFrv3rxQFqWWIIgPnG_1HJWr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=710 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The driver will not work properly if the TX ring size is set to below MAX_SKB_FRAGS + 1 since it needs to hold at least one full maximally fragmented packet in the TX ring. Limit setting the ring size to below this value. Fixes: 8b09ca823ffb4 ("net: axienet: Make RX/TX ring sizes configurable") Signed-off-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index de8f85175a6c..8a60219d3bfb 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -43,6 +43,7 @@ /* Descriptors defines for Tx and Rx DMA */ #define TX_BD_NUM_DEFAULT 64 #define RX_BD_NUM_DEFAULT 1024 +#define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096 #define RX_BD_NUM_MAX 4096 @@ -1389,7 +1390,8 @@ axienet_ethtools_set_ringparam(struct net_device *ndev, if (ering->rx_pending > RX_BD_NUM_MAX || ering->rx_mini_pending || ering->rx_jumbo_pending || - ering->rx_pending > TX_BD_NUM_MAX) + ering->tx_pending < TX_BD_NUM_MIN || + ering->tx_pending > TX_BD_NUM_MAX) return -EINVAL; if (netif_running(ndev)) From patchwork Wed Jan 12 17:36:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711745 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1EFEC433EF for ; Wed, 12 Jan 2022 17:38:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241553AbiALRin (ORCPT ); Wed, 12 Jan 2022 12:38:43 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:7777 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241160AbiALRi0 (ORCPT ); Wed, 12 Jan 2022 12:38:26 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CGTfCv011851; Wed, 12 Jan 2022 12:38:03 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2056.outbound.protection.outlook.com [104.47.61.56]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj2j2g1b4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KnqL2aDjJt+9E+JXy/To6PSHt0XJE0FjaQv2h1u4s5Q45/yvup5fRSEdqDyPuOW3rK765tATTgOO91k0lx7u90LIqdyUZuVOr2zPoQacnI+UBH/KHgmz8mx6nrvF98fAw1z+jX4ZPsWDaW9f42zWoYFBVR/Sc7X3A0QpXfWgeHtMfwm42dsVDssvdU4EyWclADAFcUn9Zdvy/PatraZEXxXPUyu/blLXmyYvnHmipFY4+m/3nwJGeJpexGnQ1YEBVPvw23hGxT6cUslMcL/WyAYl0CX/I1I6csOPvvh8/029dVnK6S0X8gfk0S7g/0Ju1AMFQIR+9lrzRXn7EDYtig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7l1BjpEmKjjb01dQCnUrTbR43RSa+9MhabIjNqzQ7F8=; b=T3D1bkxtDPtG165R7kQdZSiqQvdIzY28Orc7+HUvTtjCsefaF7JBOiZtsATf41GQ1fKYt1VCT9T63/NPMUaoWq0Y/FRyAHJTgdITYTOJMDE/BhuAruOIo89I5jlpHaf99FY/wXpHKYgqJ4/4WSngSpbuktjucWVQdH9taUfJt3YsuS+vx/kAEcoyEeA4LwGi2sZ3kFJOc+R4iYTfSzq5Zl4ZEJ96DJhayEto1T5b+y3Vs8V8zp/ayYc7wOcpyLy++5wU0SWFGYIGhwXf6tqsJkxMe4+IYc4AIrDHEDrLz0kFFUXn/IdSxKkFIPr0W5gnOC2JIytPUPpjkampQ0V6Tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7l1BjpEmKjjb01dQCnUrTbR43RSa+9MhabIjNqzQ7F8=; b=kqdSvi46l5vIMnpMiCN1DjeDslQkc8m2SnVrChLjQQjePWysbqes4Vu6HW2ZKBJO/jxb9CgAIHts4Fc63bhT5ftFETTHnA1NbRjovbBQmxO8WQ+hE0E8sfL8b50UF+fbHvtRtYBCFTwj2PRF8Uvy7poBGTPawU4KDfMKP/NUfKE= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB5490.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:62::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 17:38:01 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:38:01 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 6/9] net: axienet: Fix TX ring slot available check Date: Wed, 12 Jan 2022 11:36:57 -0600 Message-Id: <20220112173700.873002-7-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d9337f6-9654-4696-9bbf-08d9d5f247b3 X-MS-TrafficTypeDiagnostic: YT3PR01MB5490:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VVzP9vBIdXzBk6ENtmH3TqZz2VxiRs4MQBVMf3QMAueUEWFO+NTlI2Z0PZjcoxpbEpIDma7ULAAApUJqxzTHVp2IUbYv/uupGyC8IfPPCt1vF0mPvxSr9F0uv4Q5F395mzFDGB0CgEQi50Rm0xylRuQybfQ4LWrGcasJ8W/nT53DMHPvoRgJAogifZFMeT0iWsK6YBuAPEIY3j5+C6vmZJJtPzttQs7iz91d7+aTwLY3srt2WHqymZES2UN4fxkNQziPjrhYLfZIp4aKa2pmpYIrTlDOB2/70b6MGoGhHubKK6KU3cVt8kixMq+D2h7fgzaZ2ZL6FSD9mFG3gXJGiDROpzlpKhrzAbs137xlapkOK6cP7WimwTQUFuj1BiRaGrxpZ6vSEF6kD8sjhcfyT2q4/fOanlJ7Ic/0mgsDXAy8LF25tRRsT5mjhIYkLrjRkiqklKVmd8U3PkK0UnWa2AmQCxK7+aHwaa3aGHuz/RUq8+scKxP6r9XkiHp85bHGewjCGkkU6VLxGWWhYaZ4jBXgePH4lutiGCnBzuwz6Si0hQoatlBIkOi1xT4ScXJTk3itbOLO/plGtwgumBOrSsy4VPTH69FIaGjAOX7Y1OWgIo5pAhN+N+SMn+VWf2UrLjhy+koUK8Q9D29XSOn93IwR3/bwrxpW9bgkz/qtLL8JiFo7lq0eVx5IV1hOSA+N63eZYdiZdi7t8vzkr4gXVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(66946007)(66556008)(38350700002)(2906002)(26005)(508600001)(6666004)(83380400001)(66476007)(38100700002)(52116002)(5660300002)(4326008)(86362001)(6512007)(8936002)(8676002)(44832011)(6486002)(36756003)(6916009)(6506007)(107886003)(2616005)(316002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: juGhKSLv4XMY9iljPt8sH2vDxOrUXQRwx+x9aBgbxzBNFDvXxtpcFXpcG5lhABwvJgYtGgvocPs+dmK1WimDlCJVPHWm3Jqro6HS8V/MeH8KclS/HTJsMMNVte9SRLxoL82seHfGIkyRn3DH4cFg9S6SH7yrGcrql8P2GkOpIDSWSEhZd2IpAM3ItWDmiEmIKy520Lg328EZwPsyNW2EJiiuA1maorTO6gYb+v7jMUJrCvCe7hSAyUNeSeJ7xDDvl73krH4LrT87qnvBD5H7YRfUzKZRMTaInpPAltx86oM9zUcponchMdMEDk2QRECW0wkNi8lAmUAz3COwfD8lUFyfZAIZqfXAR6A55gVImWVgbDq8yNqu86heH6RPWw6CyjnSDwlVkUNYCXyoLtGIfan4zlFyHCVZrZkLT2ajdwEVnpw2kZgsfyQxck4X5Q/fPnp5YDk6IfsLqxhu171bow1yaSDj5V8XUyT197zg6XPL8ZY4X1qE8WTfFyS8OHzD9DIzeagueJBDy0M5mI0YkcXsUk1ZfLCNkNyaZIo+1jkY5RX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6f+kWNQxQHqPqvfPA3SunnXXlqmFBa8J9AyaBrXSOj4pcP/yY6tW4In9j0eMySKgHHY= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d9337f6-9654-4696-9bbf-08d9d5f247b3 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:38:01.2796 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5Qq2awboLV68KizjucBEzZF09iFGcf8u5ptToVsvRJI1r7KyGwpbrmT4jqpAvSjzShNh2VWEnDpLADQVQKs93vCykTzbaxNrT/vtdrKxzWQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB5490 X-Proofpoint-GUID: 2dB9fALVW2mGQzLYz8SmiIf_VTDakN-7 X-Proofpoint-ORIG-GUID: 2dB9fALVW2mGQzLYz8SmiIf_VTDakN-7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=681 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The check for whether a TX ring slot was available was incorrect, since a slot which had been loaded with transmit data but the device had not started transmitting would be treated as available, potentially causing non-transmitted slots to be overwritten. The control field in the descriptor should be checked, rather than the status field (which may only be updated when the device completes the entry). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 8a60219d3bfb..ee8d656200b8 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -643,7 +643,6 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd, if (cur_p->skb && (status & XAXIDMA_BD_STS_COMPLETE_MASK)) dev_consume_skb_irq(cur_p->skb); - cur_p->cntrl = 0; cur_p->app0 = 0; cur_p->app1 = 0; cur_p->app2 = 0; @@ -651,6 +650,7 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd, cur_p->skb = NULL; /* ensure our transmit path and device don't prematurely see status cleared */ wmb(); + cur_p->cntrl = 0; cur_p->status = 0; if (sizep) @@ -713,7 +713,7 @@ static inline int axienet_check_tx_bd_space(struct axienet_local *lp, /* Ensure we see all descriptor updates from device or TX IRQ path */ rmb(); cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->status & XAXIDMA_BD_STS_ALL_MASK) + if (cur_p->cntrl) return NETDEV_TX_BUSY; return 0; } From patchwork Wed Jan 12 17:36:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711746 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3885DC433F5 for ; Wed, 12 Jan 2022 17:38:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244240AbiALRiq (ORCPT ); Wed, 12 Jan 2022 12:38:46 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:26337 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241185AbiALRi0 (ORCPT ); Wed, 12 Jan 2022 12:38:26 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CE6nAw020453; Wed, 12 Jan 2022 12:38:04 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2051.outbound.protection.outlook.com [104.47.60.51]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj0fcg53p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y4IZBq8jJQ0IWxB0LrO3ppilBCS51wt2fzT6WYh5+yV5cASd7O1fIC9V0RZ4f24dL0hWMJ/dOW0wO4RlLtYK8zIQAALAyeOZ91pptNmos6lGKCZ7NF5IZ0XsFnFmMq5106UB/gI920kEvS+1P5cSb7U9byh3T0G0RlIuIg1XoFpUciSR7mh7r9A989z2DrVUUNGpLpQ5c/SRhCnadZyst9UZ+wcAGtNzyJF7NW0Q0uxjIu4kwfVVm2TVldlXBnccIUW29AEzVzlaI/pCAh0A5oVwjb9LTPFAgRXvSdLDqbE/fRjImw6kxhbGGYdlygugmkBkOks1b4xtM8+mEQluPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3maKHlNnvSWV4s8RF71FZUrR7rUC6v0MJp7HOwqTX7U=; b=YxAHFXTKSfYNugrnOYdQeBMDGR1gscQvvv1E9zOvRnZs9e+N7b+i8/XP/fEtZKzX7yHFpel0QPMZatBPRyZL2kT9eOvTdpPyDlPLcDIQJWSTM0gbpWl2U3fa4fusT/mBj570vnxa8AGpToNEiCT4jRf9VAimpF7JBidYtGbLLTHdc12dLpDu0V3dYlbB0T2wD3NfenJmgjh1NRu1WeP3WkrjMKscijaHKNYPgy7LP5jSphaw2ZIs+FOE2KWpFXGTcVuMTjyphNEh9tw8weGvzs9+3D7DltIT/tkNkxkVRqprB/KM3XswMpi+EY3M9jjtY8tUmreRilnuUHufqUXtgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3maKHlNnvSWV4s8RF71FZUrR7rUC6v0MJp7HOwqTX7U=; b=VLhWmA9JbPy+B3OJnc4tkJFQ2DYWZnkb5VzMmxZHuNb2N+43zca3j+gq3OM35RDBJPzUukANurbQNe2XMvuNcC4O9w9hVEzhOjvY0Q7SiWGf3nxD86SwMSOwZA52B9R2yn4d+rejVhGPYsKxXEyfx8Bas4btH54lQd3KczdD8ak= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YTBPR01MB3424.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Wed, 12 Jan 2022 17:38:02 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:38:02 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 7/9] net: axienet: fix number of TX ring slots for available check Date: Wed, 12 Jan 2022 11:36:58 -0600 Message-Id: <20220112173700.873002-8-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc849574-ff67-4b35-6094-08d9d5f24885 X-MS-TrafficTypeDiagnostic: YTBPR01MB3424:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZtiSoB3YgPBzr8e6l5UmsP5dyRc69Fuetu3nib7YaWo5wQCoqCa1zflmmNysUvPapF6qmkkDCOtwDlMuoTIw7uDtBnv/xHpa5XDzxLv2K6b0UBo4dzDYwarksHt3OixM4XBDTULN3pQqLgeMftW4T7vFlogFBSWvRigg43iZ3yvtQOj8F+GbIRm9H4sehdN8aZnp89OoJs3s3N+Y56rplHxHvinb8312MQ4xz4INMBc7n7OGhi71MurXA4O3Aw/e4Ct2D4+GO2x1AoNQhBy1Aj45XKTXr1/nNhZucMGAvWwA92GUE8OLWY9ow7f0byJTzBx363Glc08NkA6cW9esnoi2fTqLHRvewxIMxPW4qATicb9PZ+a9zmksX1PsZehmDPKZzcErJRQD80CCzOAvGIcswNUso6fG7yJvZnw7S9i/ky2dUzWoO6EX/thA5seA3c1gk3LWjJ5e5FMRu7ZBQjHjjVZ8NNU1aQ5yIGZv6MEZovC8mo9Pb4q2+dmIffFzoYri2rHRz8InP+klC5qA7WLnF42mv/d6xikegWGeB8Y1ZvWc/peOgplHLU7BhAePdCi4P+UpMjitRTCe3dZST1MFM0QFfwyhFGFGeZ+Inyi/MHahSQ9G17LfIUPincXe/hWYSkf1lk+1v4DFtakDZb9u3OS79Z1I9yfMTXn3WUub9kvjLd+yj37wCRn4z7qsFTJqRZW/tbRxXMlbymA4TA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(6666004)(107886003)(186003)(66476007)(44832011)(38100700002)(26005)(52116002)(6506007)(6916009)(8676002)(508600001)(66556008)(83380400001)(8936002)(6512007)(86362001)(38350700002)(2906002)(4326008)(1076003)(316002)(5660300002)(66946007)(2616005)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6TRcLu2fisTvPqeQWRpRbYkmuy6NJZ5ScUU5+6FQmKkSNfFb/zq1PK7z+87DOJzoHSY804LiZEG/6KPFww7rtsAPU2VX6BORyfLxwhFkl+B5MIoC2APXzTfMGPhuITuf1kVYW72ZbomGkhboSc/6I1HafUKPFxWkAKmrnqOU9HDL1L0VlYitAOnTS9qBBa8CJACUkK1oYrrNvH46M180rPXxwoApyQkk5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GsubuUYqupSu2NK8X9H8HDHsnIavlhYvV3pGuoVO1JCsEFmumhmrnIM5r4Owu/qOl0PxYiB1inOKrK3nMF2i0und196lE79mGOWJ1kcBgDSBnAth4DeezuEMlQtvVtQs9H+jkNp51IYjz4rA0hYw0rri1k5/P860LFnHpGYyZ53hJHIchsu+cJoj4/z6nXt67X567fUMWnFS3N2j7izpdK2g5yndxNXTMRpqfIyqbnKmcYiQcBjq1RCHN0WScxs3TURrA65k9fLUJOEbcmsfyME3RsnS20KytbJi1kLFQmmvc5i7bqp1Gl871yGDFUzxJ4IWafhpprNcfPIuQH17MB2RvGpfu5EtVyIB9v51mCKVrt8NK2gEp3LkL0Da4WZAoXShbqfD6Ovzo= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc849574-ff67-4b35-6094-08d9d5f24885 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:38:02.6075 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6xxmd+Lt49NS6hBtAvjcglyX+SpS11pqdZricmKTEU29+WdbxEzMK6wCm1b4W0VZ8qvau95rr1Gep1d1iNpfo7SgtCVzU5EXBYS4hJgLI4E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3424 X-Proofpoint-GUID: r_HUvlY7L_r2W2u3QmALDzzyrJW_TA-Q X-Proofpoint-ORIG-GUID: r_HUvlY7L_r2W2u3QmALDzzyrJW_TA-Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=915 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The check for the number of available TX ring slots was off by 1 since a slot is required for the skb header as well as each fragment. This could result in overwriting a TX ring slot that was still in use. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index ee8d656200b8..c5d214abd4d5 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -747,7 +747,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) num_frag = skb_shinfo(skb)->nr_frags; cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; - if (axienet_check_tx_bd_space(lp, num_frag)) { + if (axienet_check_tx_bd_space(lp, num_frag + 1)) { if (netif_queue_stopped(ndev)) return NETDEV_TX_BUSY; @@ -757,7 +757,7 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) smp_mb(); /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag)) + if (axienet_check_tx_bd_space(lp, num_frag + 1)) return NETDEV_TX_BUSY; netif_wake_queue(ndev); From patchwork Wed Jan 12 17:36:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711747 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C6CC433F5 for ; Wed, 12 Jan 2022 17:38:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343822AbiALRiz (ORCPT ); Wed, 12 Jan 2022 12:38:55 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:28092 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241269AbiALRi0 (ORCPT ); Wed, 12 Jan 2022 12:38:26 -0500 Received: from pps.filterd (m0208999.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CE6nAx020453; Wed, 12 Jan 2022 12:38:05 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2051.outbound.protection.outlook.com [104.47.60.51]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj0fcg53p-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EGxM14P0SI9Ck7iQYueMotkDvI2oivLtal/LOHmtfxQTeT+kUEe8SHybi61Jems/hnmasFs1iqCvk3IzTIqANGcTxkFGdwypQtpoDqwSxmNDT2PgpPNxBWGznel+xsgFtIFiC2/ucGV1aXeCAFFPZxns3XvUyD8nuIn5oMIRDv2HlproBoGN0/qu55jQdRXAe6KDX504kWZzLzCRjxa5CZYzvbmOGf4xHxpl+zL7I4JuVdeylwUC+rc0602glw71eWpXk5jvZ5yz4+dC0WdH6sLHu2p8c/yBQsdqZG+l7ewRzTq5oVNUDYpKwo/jXSuckBpwYovM/C1nrarJnua4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=51+qJ3HUjZ4+DjkO06j8XK3STQZLOzifhN7quYniat4=; b=gDk7ohhaeFUS6Qgn7ytvdEDW/L/7aygPr7GaS2TZbjW7iChpZfYxfizU6RR0rYrDpRp0dyj2dJIx6ePzhp+TazwhMXj/4Z0Vp27aRZSltMarNYTvepLpMDaINmjH7TSF+XecRPomfl56f3UugTY35j0MNRMftBwOLfQW5f1Tq7SPG0L/GCfET21OkPrL+7dPuDHAeJgJf4lTF/EcswS/EC/z60BNaeGTuOpBn3LEZn3azvyxDhhqXfAFTpNG3hYEFKcMQJF1lusFJnIGKYicArFLsGXqUKVdtgIAYO0PTZD3VK5ZraPegbRpJbg1h3vAgLyc5W8yuun/0P4Ek5pPBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=51+qJ3HUjZ4+DjkO06j8XK3STQZLOzifhN7quYniat4=; b=IryDyLoDChT3TjDlXIvUCV89P2OSGlIKHa/RNCGSQ7AI38i/1vSXRUv8hsEMP2j6pPauXbDegjjZOPnnzLdINo4CNmIyedTEndfBP683YS/rFwpkC9I8dcXF4m9pmkSIpZLrA/4Qsk+Ois1PDFPz2r8nPBhuoEjWYlHJOSMUn1Q= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YTBPR01MB3424.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Wed, 12 Jan 2022 17:38:03 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:38:03 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 8/9] net: axienet: fix for TX busy handling Date: Wed, 12 Jan 2022 11:36:59 -0600 Message-Id: <20220112173700.873002-9-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b94b9e49-6bb6-48f1-0069-08d9d5f24943 X-MS-TrafficTypeDiagnostic: YTBPR01MB3424:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j9427KXUS0AFJxCAJ1wMWSjvy0DhA5AJ8XYgK2Jajd0Nz/65r42VgMeYWS9V7E63ngyUPiD7VJnUyf9nWXhRvf7TEiIHhq9YUEOdvAgzn+jlh1hpJLnvkMysgd+ecCnhfMle+hCX7gOn/w8mFxHCYTcTleaf2luqDLYFwhSz3WLJQpQoKwFa0QPC9HhCqrnw63fz4RuAX6wXQIicUJ+VryRWFq6RG+QapXT3KBqoGuqEBzh25n5BZ27vRmhusAiVjcD+j/Mc2RtqhBHZoTGUnqsDksvuePWfASQKqn+U0H3j8oit3oGmInf3JmQgn+5BEmHSiaqVZch1ZOW3DQ2BuamiQnEaEySSDds9wCSBdGQdrS8Neug3zJZXClL3+Oj0QfmOCz8lUWaBAkmzJ1vdlyparj8u/K6kyt2iaJMHS34PIN3TpZ76v8zTnSHPsHSEXv35d5F8aneRjvxaBz1xrOmTj4CoMwprjd1MhxcOLUErH4InTCF8nbB8FDPb/a4/8AdMEzkDJq0dK9z0SPzcTE9+51gOTpFOf4YFnkVl1yAqIhafvWens9SWY9tOXVjY6+YErwnWIDLa4BoS0AT0aen/4P6tzJBtZF4pE0kJc56xbMTk/eAUCza2pYZ2fWYRomAbEwYVtvlx62/mDB9MBWnlB69lD/FlsjaebL8qOqb8+snHqJK251h06yG/F3Zuar1P/61BTTrvtgtNW4lxDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(6666004)(107886003)(186003)(66476007)(44832011)(38100700002)(26005)(52116002)(6506007)(6916009)(8676002)(508600001)(66556008)(83380400001)(8936002)(6512007)(86362001)(38350700002)(2906002)(4326008)(1076003)(316002)(5660300002)(66946007)(2616005)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s3sat5LdVA5jPRYMm8UUknxBKakadpkWiahIz9SzoqLyjuB+roekH5xPzKvQPEiRHG04DsZwrlpZ2g5jcOhNlfOsJPzzDaZC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FUXKo8RPkL7iCuSXkrt8WG0mzWE8HYZ5h82VS3g5UajYFGq314nlAuEmBbVgt1w/+fjO+a86w2jFDDpeRXs9xLmHxd+uTe3ylQ2XRtQxun0iq3A9bf7gIv9TroO0clFTQpVVH3lPcUIlm2gQ7oe91YK8vXISmKorAuE1DMdheyow6Xac9R7NQqYhl9UrfjT+i162ctWNkMx9Caj8qC7FA3Z2tIedVmxwgDByuxQ9/dla4VhUkq/8HBjhHAb3QF7kXPkqjQDiF/9lpWSwn6mm3hYqsHsJW5KsZMGhSFpXRTMwZUzFoSc0Kv88ErpHTBbJi/PxYvUe1V/qRtQD7soeGhybYZPkMNVnxmvSJtI9NCM453REZ0WPdquVUsbrIzGWdvC5APO2uhacLrjYD9016wfCl9oz7br8dpYL/C501eVqGmqD9oM8BoCPMdUZwIrcPvX2PkXQHxs98Zk0rBkbg2lpBPA+aHbRz4/7EYej05Zdx25KQzggAFvc5rRhi3NrKrJNgVCAFfk+a9gLTd2LWG2xg= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: b94b9e49-6bb6-48f1-0069-08d9d5f24943 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:38:03.8190 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tqzg9ylnFQrqRA1yUIaMckJ0//7HbfqvlEy4invULf9QK8MkZOqz99U9tzNuTllin/w8i+zD6mOl+zdeR11vpmzIl9Ufwf83ty38qclAmH8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTBPR01MB3424 X-Proofpoint-GUID: nHzxSpE1v2tJ-FYMR-4p9_WYiomheZW0 X-Proofpoint-ORIG-GUID: nHzxSpE1v2tJ-FYMR-4p9_WYiomheZW0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=690 spamscore=0 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 priorityscore=1501 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Network driver documentation indicates we should be avoiding returning NETDEV_TX_BUSY from ndo_start_xmit in normal cases, since it requires the packets to be requeued. Instead the queue should be stopped after a packet is added to the TX ring when there may not be enough room for an additional one. Also, when TX ring entries are completed, we should only wake the queue if we know there is room for another full maximally fragmented packet. Print a warning if there is insufficient space at the start of start_xmit, since this should no longer happen. Combined with increasing the default TX ring size (in a subsequent patch), this appears to recover the TX performance lost by previous changes to actually manage the TX ring state properly. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- .../net/ethernet/xilinx/xilinx_axienet_main.c | 86 ++++++++++--------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index c5d214abd4d5..8ac277ef1f99 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -660,6 +660,32 @@ static int axienet_free_tx_chain(struct net_device *ndev, u32 first_bd, return i; } +/** + * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy + * @lp: Pointer to the axienet_local structure + * @num_frag: The number of BDs to check for + * + * Return: 0, on success + * NETDEV_TX_BUSY, if any of the descriptors are not free + * + * This function is invoked before BDs are allocated and transmission starts. + * This function returns 0 if a BD or group of BDs can be allocated for + * transmission. If the BD or any of the BDs are not free the function + * returns a busy status. This is invoked from axienet_start_xmit. + */ +static inline int axienet_check_tx_bd_space(struct axienet_local *lp, + int num_frag) +{ + struct axidma_bd *cur_p; + + /* Ensure we see all descriptor updates from device or TX IRQ path */ + rmb(); + cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; + if (cur_p->cntrl) + return NETDEV_TX_BUSY; + return 0; +} + /** * axienet_start_xmit_done - Invoked once a transmit is completed by the * Axi DMA Tx channel. @@ -689,33 +715,8 @@ static void axienet_start_xmit_done(struct net_device *ndev) /* Matches barrier in axienet_start_xmit */ smp_mb(); - netif_wake_queue(ndev); -} - -/** - * axienet_check_tx_bd_space - Checks if a BD/group of BDs are currently busy - * @lp: Pointer to the axienet_local structure - * @num_frag: The number of BDs to check for - * - * Return: 0, on success - * NETDEV_TX_BUSY, if any of the descriptors are not free - * - * This function is invoked before BDs are allocated and transmission starts. - * This function returns 0 if a BD or group of BDs can be allocated for - * transmission. If the BD or any of the BDs are not free the function - * returns a busy status. This is invoked from axienet_start_xmit. - */ -static inline int axienet_check_tx_bd_space(struct axienet_local *lp, - int num_frag) -{ - struct axidma_bd *cur_p; - - /* Ensure we see all descriptor updates from device or TX IRQ path */ - rmb(); - cur_p = &lp->tx_bd_v[(lp->tx_bd_tail + num_frag) % lp->tx_bd_num]; - if (cur_p->cntrl) - return NETDEV_TX_BUSY; - return 0; + if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) + netif_wake_queue(ndev); } /** @@ -748,19 +749,14 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; if (axienet_check_tx_bd_space(lp, num_frag + 1)) { - if (netif_queue_stopped(ndev)) - return NETDEV_TX_BUSY; - + /* Should not happen as last start_xmit call should have + * checked for sufficient space and queue should only be + * woken when sufficient space is available. + */ netif_stop_queue(ndev); - - /* Matches barrier in axienet_start_xmit_done */ - smp_mb(); - - /* Space might have just been freed - check again */ - if (axienet_check_tx_bd_space(lp, num_frag + 1)) - return NETDEV_TX_BUSY; - - netif_wake_queue(ndev); + if (net_ratelimit()) + netdev_warn(ndev, "TX ring unexpectedly full\n"); + return NETDEV_TX_BUSY; } if (skb->ip_summed == CHECKSUM_PARTIAL) { @@ -821,6 +817,18 @@ axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev) if (++lp->tx_bd_tail >= lp->tx_bd_num) lp->tx_bd_tail = 0; + /* Stop queue if next transmit may not have space */ + if (axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { + netif_stop_queue(ndev); + + /* Matches barrier in axienet_start_xmit_done */ + smp_mb(); + + /* Space might have just been freed - check again */ + if (!axienet_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) + netif_wake_queue(ndev); + } + return NETDEV_TX_OK; } From patchwork Wed Jan 12 17:37:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12711748 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A435EC433EF for ; Wed, 12 Jan 2022 17:39:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241680AbiALRi7 (ORCPT ); Wed, 12 Jan 2022 12:38:59 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:58546 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241271AbiALRi0 (ORCPT ); Wed, 12 Jan 2022 12:38:26 -0500 Received: from pps.filterd (m0209000.ppops.net [127.0.0.1]) by mx0c-0054df01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20CGT4uN010837; Wed, 12 Jan 2022 12:38:06 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2053.outbound.protection.outlook.com [104.47.61.53]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dj2j2g1b7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jan 2022 12:38:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLffMOYXSrSa95ZDUokz7q0eGoHBVhkmsXj1X78u3fiD2cL/9rrIigiKppnxO95KUX6o0cy+hLpoVgTvun7cAcpMipM++9x9mvM+58IMtCdcbqluyewZtZlYuvjIfrXgBGyrOPkTzdgUd02lt2bYK/pLKXwloZir3278ctXEnHIW2McZK2EZxw2O80DK4z5MrX+AwN4zmd7i0alRpXkXUP6i+dSigdO6Knzuudkfxp09KfcjGW6TZYhGUJRX3kz4MCJpOULNr1ykFFOw5tPExpP6P0xlmKD7HKOA8qCimsfoz2XSxoMuLJB/WB03qVyakvw2XiWBNaJu9moovNWvsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HgBfeBPBU0sHw7Q/3UtmHHhCi6TrDK/ghccggs1REW4=; b=CExq0eWqQOXwSemyzq+FQWg43R6PODl8pZJWVI72Yah9gWTfkwlZenq7xXl/BqKuUL7QB1zO5cbDC/H8V4G49pErbcwq5KtqPEGFkdaVOB33Nbg55dr5IxF+FATK0GfHGW/8KeUapdVbgMNNF8T3GV9Evc9k6dhj6lQkUf/Rf4tFPnzZlkPn61CT2xo2Mrk/gk1rBK3Z6cj4ab45ssAEJlwY3V0C7F50qpIaCOQJnUzJSAFXyIyzliyw604rYKpWgqvW0BShJYOikfKyV55+NqI0xyo7rBHUx1mnydmuLBbk3B4aYL22H5dhvnzdRZbPDnoTSzS6N00JuH2CTJrV1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=calian.com; dmarc=pass action=none header.from=calian.com; dkim=pass header.d=calian.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=calian.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HgBfeBPBU0sHw7Q/3UtmHHhCi6TrDK/ghccggs1REW4=; b=wfpK+7wQcBMQEo7o5nUTbzLnxGMuWtnNIFFYkyO1PIPCGi0csoAaXOt1DgKmMmPKxXb+bQxwhuhKZqv2KREeLkVSNvstVsvOy3ggh3WYNOLcLgWP5A3DrBW4h7mA9+lJVNU6WnWMOcszE5ys5FvxtYXIFJeFpET64x4Lfy+nn/w= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB5490.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:62::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 17:38:05 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::6929:c39f:d893:b6c8%2]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 17:38:05 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, linux-arm-kernel@lists.infradead.org, michal.simek@xilinx.com, ariane.keller@tik.ee.ethz.ch, daniel@iogearbox.net, Robert Hancock Subject: [PATCH net v2 9/9] net: axienet: increase default TX ring size to 128 Date: Wed, 12 Jan 2022 11:37:00 -0600 Message-Id: <20220112173700.873002-10-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220112173700.873002-1-robert.hancock@calian.com> References: <20220112173700.873002-1-robert.hancock@calian.com> X-ClientProxiedBy: CO2PR05CA0061.namprd05.prod.outlook.com (2603:10b6:102:2::29) To YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3643171-af13-4ad3-2a85-08d9d5f249f8 X-MS-TrafficTypeDiagnostic: YT3PR01MB5490:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mk5ox980Ubn6hLgDCW8zLv2Ihd69FRyfJ9nK+d3W6VEWLGg99QArofjCmcCvQ7Ovy8dVVtX3CnSgwbEa/NYooqrQB+MZuICJQGl4d9ljMt1jQx6A7TGUM/KnZZPXwN0cL9WWe/dl5XxKL5x4NoVk6C5p7rtlwVMEw+J1xsunzosdPsJjSIhZsYM3aMxdSCz1MWWBa54VSAaCPQuQ/H8tdpCuvy8kNgRzWeag0yPnkFf9QkMAWtT2l0dLWxDv+HymJz/K9R27vdkaLBxMZcBYj+9RKF74lWLXQs3E710nKmz82N4thKDUKQJv1xZqnuAb7h5VwP7IFt2Hrx3TsTLaOeOHhS/7BeerT9sQ6apAB+oQdBIJhvqbO5RoGDdX/CypnMs/0yVaof/jkn3EUWKZC46BO4qfmJCU0VkbuFvn79zLCJxpt+VRkOV8rLkmyY3kRj1Pmww0rvtt7Rh986sm/vWI5igLiUEiDttFTyRrQZY3KfQAjQ6kcnY77vX9P0IPhuU8JwTKSWPk3Q20kUQEvU4OWzgJeCfQKWX/rC4jW3la1EauaP6Z/GckrvbUXbbZgKWDO2T63K73VcQlH2nZHwi/eyKIe0vie0GE/WZXlLAzx6BIKJshIyJbEOoE2dk9KuDE/iJ0l/2q+A6xaJu2a4qwZ5p4PrJDaRFn0CfGAWQHp0pGhFsro9uX5F8EizrEVX2Vs86/Gson1L9OFsp7rg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(66946007)(66556008)(38350700002)(2906002)(26005)(508600001)(6666004)(83380400001)(66476007)(38100700002)(52116002)(5660300002)(4326008)(86362001)(6512007)(8936002)(8676002)(44832011)(6486002)(36756003)(6916009)(6506007)(107886003)(2616005)(316002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uZ1DATRjSd15EQYzywt1IiWUogqzRGZhdrPHDl/Iv5SXKHMqMw+lJu4Ak8jvNpcsV6gBfBlygYoP5J13WjoZtMD27gGDoaX50fwFX9jMf6R+G4GGB9NFBjNv4aJJ8PMq0xe2fYLsizJD1K/iLrt5Hr8jCdqPCuAYalSD4mGt3epbyXHKY19o/xcjudCGSb0v04PFkKBnQGgQtaGogesMfNfAuEB/dvMAtHYg9gPc0sPuz+1jPefWshSgGi9JWRxDi7RpwFjfbrvSMk1Z/LuY3EAY1zjA4/VafU6XUOsCTXM3x6mlC9LSWSt9KmlIPNlG2GnGsRRLgD5buRR80bExPYq/yvgdM95h6xSBKq5204Fg3o24mI/jftbUYctdmkDj2NpKRhG20nEvXlkYlL7p/N1yJezwpww21dUvnKpclIu3Wl4jiiJnElH4G7gAlU1UG0A91SR034ZJv2iT4oUK20pI/kO9hEn/z07zKT3SkiTZiBnJ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WOqeIm+usB9TeQggfNA4Em1uWVhZmt3/mzKumFXqhbN+fbHDhNzsC8vECZyT0cl9MDIOcGTuyYXGbbYUJCZhGJJxvoPPNRRkGUT9zLCsOBiSE2pb5UP1FEyzbWj7S74= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3643171-af13-4ad3-2a85-08d9d5f249f8 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 17:38:05.1326 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 23b57807-562f-49ad-92c4-3bb0f07a1fdf X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3pmnsDCnWRzGCIWe+UbDfBlyKTlDykteHEl7To/mzMvv0FljBMy3WHZn1T/JWumiZG/QKpsUZUbY8yDp/B1kj3O1563SkIqv+Tf0UGZKuDs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB5490 X-Proofpoint-GUID: 5kjDNVzKQdKbWL-EZDX1MlTSRBgWpxfz X-Proofpoint-ORIG-GUID: 5kjDNVzKQdKbWL-EZDX1MlTSRBgWpxfz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-12_05,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=687 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201120107 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org With previous changes to make the driver handle the TX ring size more correctly, the default TX ring size of 64 appears to significantly bottleneck TX performance to around 600 Mbps on a 1 Gbps link on ZynqMP. Increasing this to 128 seems to bring performance up to near line rate and shouldn't cause excess bufferbloat (this driver doesn't yet support modern byte-based queue management). Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 8ac277ef1f99..d5ea093fbd32 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -41,7 +41,7 @@ #include "xilinx_axienet.h" /* Descriptors defines for Tx and Rx DMA */ -#define TX_BD_NUM_DEFAULT 64 +#define TX_BD_NUM_DEFAULT 128 #define RX_BD_NUM_DEFAULT 1024 #define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) #define TX_BD_NUM_MAX 4096