From patchwork Tue Jan 18 21:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716917 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 D16B8C433F5 for ; Tue, 18 Jan 2022 21:42:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349073AbiARVmq (ORCPT ); Tue, 18 Jan 2022 16:42:46 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:4287 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiARVmo (ORCPT ); Tue, 18 Jan 2022 16:42:44 -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 20IBe3o5010515; Tue, 18 Jan 2022 16:42:24 -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 3dnbdu0rt6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2P6Xbh+WMFQH/bU0yjn1yo82/mmBQ0hgM7NLU1oovIkNSkFIEs/gvyyPrpqADQpdPHK6JrvFC+3Wjy6ysAgN07AZuIgXQu9Vs9sFQARtjqkKotfO05UHpkXNDSprLlyM+brnEkkB4KUz+svEqLqbWrbTojAjDAGOUkwCIBbX5keu8Na4eWhgJBSFkrCv/5HoxhrlQQa0rAawr3SsDvu8mXHyV20IHGxoka0KSkdVANNj1j2fm61JR5Ph32s5v941fhn14JwbujUMN8uTwEQ+nUKuR18TFaXlbfMAaMxtK5NIMARqZLXLFm7snDfmnZ8FEspnOT5JdRTmZQ3mvV4og== 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=BA8OcEJN8jFwhObwJKNFgblAeWctBAxgqY+UFzsddok=; b=ipXyG7y2ymcNbeNfzhLkYRb8vubdz1NldKxIMOy0Dm0h2FyAHm5g4vGzRIlZzcnqJSw/OPQZN+FzuuKfCCu8RCVtMsuuIpWWatoLA54yq+Jpqi2UseuXeG8GEwyf4Mp/48qdPSF3k8beR51Ed7L+CP1efxJ25Pmjs8WtdHI1Udx6ZdmfAsGR0R5+RbR80yt55snzhlu83iuMHVi4AFWXfDuDLbdauZOnqCyP9flHjZOAlegejQmplIw6wC9PuTu4pBc+1qfLXu9kH4ALYjpr7khHwvsZV4OJxko3ldP0MYTFkYv7figE4h1X0e166NwwRFbr1RngHtGBo05wqKUPhA== 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=BA8OcEJN8jFwhObwJKNFgblAeWctBAxgqY+UFzsddok=; b=xVJWsCcDq8NsrdTpbp/eTn6+AU1mwI/fgJavCoCsCXjIlLoPBb/XblcDcrUT3k4CGUYIZoM5JLn6M9hxSVrO6L6GWIktmR5kPG8DxxwslIDanICxb5oKdeZxTwVN9k4Plc5DLqW4bvjdNVGtj5Lnp5AQe2ZUIolgvXBVpunfaiI= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB6579.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:22 +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.014; Tue, 18 Jan 2022 21:42:22 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 1/9] net: axienet: increase reset timeout Date: Tue, 18 Jan 2022 15:41:24 -0600 Message-Id: <20220118214132.357349-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 1d37f456-6f18-4d3a-191d-08d9dacb6929 X-MS-TrafficTypeDiagnostic: YT2PR01MB6579: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: cHmfhxTk9SLAOEfmjMJFu/L1+DLpRWeAJJVXGiMNEtFzM81vALRaW2Lc6MpxRRLvWBgDDRJCpydRmr8e+8U89keshQUJh4hhVj+6sq6VI7mmNPEH2jVIDbcIgGq19fNzDiZhnyingwSOd1WoRHV6YkKzUaZIN+JAD808WFKbZmzCKHLeSkoVj7p4vqR0ST2oTaEUyUY+qSLscnUUiA67y3e1UrYlq4nI3AV43fd7H3TtOqiX20356qQ2jqXjN87AzLNSuX7nLVlFTsOQSTVgibwHa3MP/YoH47zTRo7NjbTVe32VebKMMgnjXjbuVrqNMVpUH4ob8HQaB9wKLqoARpRpi98qnPw19NWUQraYBlHNJAPR1KfPuRSb6TqbSi6gNu17JkEn30GThJKbaRv7uZ+7na18ENB5OmOREXl/ZLvdGkYaNIvDFo0LsGcLmP5ycedK7fkZQB41WnuDE7CkdLVcEidWKCTHRimqOqrNlNSwl1ncBCOP05iwZHf/WEEMbQxVn2EzRcAefOEOwa/CPc2BeMuYzWZ02OkBQld7huU9N0SMmoxq5R3kcIt57C5efCg46IYJe5tejh8DUQ8CjElFGUlN0tJxk6TO68ZVILPZgPm9g6Sj6n4XP7AUYG2P+gGrWpA5pYrwPXaT07NwYYOL9iy7MjqWe3PEunO1wowUk4ce7lkqbtYygyS0n9ZpGxnhp72D+cPujfNIeJtluw== 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)(66476007)(5660300002)(2906002)(66556008)(4326008)(66946007)(86362001)(6486002)(44832011)(316002)(52116002)(6512007)(1076003)(83380400001)(26005)(6506007)(107886003)(6916009)(508600001)(38350700002)(8936002)(186003)(2616005)(38100700002)(36756003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FXaj+BG60RUSkQxvmDLyHEr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XWrw0R9D7Ut9ZhLt0PrSbLLeBe6GvXju4Q30dAXwE2MfFzFhWoONCHpV43leo9bfS1RKpRHRgW9f/9eyAx78+2/3nQlUAhdDQyD7I/gioo25NDSI0xel8ggGuqCcMaZ4oJ7AH3upGc7HJ2RWKv8Jh2gkzjz3rXIqaVlxpJOHeWKBiG1ZsM3HEimoGLGZvdMqNK4b88gSi41VYj3jSMhwy+QUtYb0fEDv3I8GwyTM9rzTnnyaVNgZYoyQRApN9ddhYPqSl2H8/nKJ4lZI8xWaY5bvzqZSMjhslVcyqv4LlibiB70GU2v/J4ITi34mg/P9XslBPrr8qMFkKMj9JCz68C5F7ttCo3oFKn7D6E7YXiht6qKO7Qii4/c3BQlFV23eX1Vr+yuKFYuwTTIMm7D9LaJFU0mQFrq6ReV/ODQCl9B68AE0aGDX2rRdJEx8dYZPxFJLUBQayo0ebteDstHzAtHbh5I/c2+NpxkSnl6E/yf9sd6im5czq/CSWxLlSW7XGCBUoJw8tSuD58iqO4a15aUaEF257CIth9RkhEZUQytNJ0Bko8y19JK4sNd9fgLqygm0aBLOQrr1YgqpjwMcCgQZTwWsrMIZLSPnPmMNU= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d37f456-6f18-4d3a-191d-08d9dacb6929 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:22.8090 (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: lARNA7mKDOvMMDL4JeV05HCSS43XExfbnts3BFaFaxyP1vwxNe89jxreArd23RMDIn4H4GN967GTw+846vVuQGCp/Rbvl8MsfkE+aDQMIiA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB6579 X-Proofpoint-ORIG-GUID: S8XxrynGn2aK-szesXZLjeEgFaFaIh91 X-Proofpoint-GUID: S8XxrynGn2aK-szesXZLjeEgFaFaIh91 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 23ac353b35fe..9c5b24af61fa 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 Tue Jan 18 21:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716919 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 96541C433EF for ; Tue, 18 Jan 2022 21:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349578AbiARVmu (ORCPT ); Tue, 18 Jan 2022 16:42:50 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:5760 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349530AbiARVmp (ORCPT ); Tue, 18 Jan 2022 16:42:45 -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 20IBseYZ030788; Tue, 18 Jan 2022 16:42:26 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2057.outbound.protection.outlook.com [104.47.61.57]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dnbdu0rt8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PUOzlbtYhF58+Qab+aLUqlGgn0un1ghNIzcNeEKOdwrMQLMPFrtgr/qEUyIMAn3nvvuhHpemFoN+awZWE1ARLVcx2nqt3SXMmj96jKkU3ZyXfElSa7GiBUCyFMnXQtnzSgcWtBuG8HbjYy1Fq67WdAwGmPjNJHhG3fNhCtkeYhvTl9vfoMbuqt/El0vafPlOHNLbTm6CfDC8MFB7vViV7DTA0vXVe7dedVImyp+XrKP0sSEaH5coORhOYFce0qzKP9O/SuFEChd9qi998LH38OMFJ9kQG4a9VCm8ArLGGJPmbKX7G64i75pMQ35baJSsng4CL7pLEZ+5JUIdW7hWyg== 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=jGNGhhklyLWuaoKYoISaXFGAD4aNu9GeM5yAZfXBTFU=; b=K+lJdpsM5JYCR+7hR3hv50W1ArugGfVV2G183E8qqMGsYR06Z9yquhU441crKJR7diPgUjL17bzGxJi9kTuqDNja+IDzrE7NQOJbYxBkq2CdNrou/iMX/Mod/kpTNs8gnL0/PyKYYr5Zue7N0o4Z+KAb7+PPO9hp5zT81ETkz1QeOXKzOx3URyq5rvVdMGv6cG8Zme59N/zR2wQahE4gaRHDiVP4v1x7FrCD1AtwxcODKoyL9x1uMAFOsgDVvWZR2xHo0hnry5b5u/wR72nTO3zeth8laEXNJ/KSVnR2effnPsO4cqXTmPtYcymk3YnPca1JN8jz7eFmDi0KsMs0Gg== 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=jGNGhhklyLWuaoKYoISaXFGAD4aNu9GeM5yAZfXBTFU=; b=y47JOmoklVCkMHzVMP1lq5kphvLbNoDPMYs1ZFk/l6IBfcXsPdpTLPouBozUol+KNmp/W5ChbipgW6JPDkPDrPKPAI0yDVSQA4pZ5r6h8HhY5hgOzArQVafQuQCmiZjpNXYMQ12379ZNFU5rNVMeyNTlnu4gVW4ajxX03kV/56g= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6003.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:24 +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.014; Tue, 18 Jan 2022 21:42:24 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 2/9] net: axienet: Wait for PhyRstCmplt after core reset Date: Tue, 18 Jan 2022 15:41:25 -0600 Message-Id: <20220118214132.357349-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 7c8574f3-1eff-408d-a373-08d9dacb69e7 X-MS-TrafficTypeDiagnostic: YT3PR01MB6003: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: xUqS16caE0mW4WSBawJdKpX48lCNHpaOQ+UZrkTcqbpGsqWU9qb+kzqYlNiT9Vkg3OTvr33XRSrs0+Uue9RX9AYeJQN/HXHRnha/OV/B4BwKsl8cBvlLEYDc56GpzSFh56XcJVgLW3PaIdZk5HvDoNwT+qMOQtdTvuYX0p7U3vV97f/jy0dDjqeaJR/cSX6OU5onhspQVyLyAteSouKeRiSn1g+zTUf8x9zxWvt+Wqur/uOdpED5OIf7njIRwSVR1z0pbC3qmxWuQcmErycSgmG1yLa2+F6LZUbrnF6EAIMdW8/fyX6VbjGZXDdsEJ5LHBPUrR8zg1vTKGxJl8vrhnDkVAPUcIDUNvq+YDPNb4IYuWqxRyNCpt1ioOTRSpsCHXUMwoMOk0cL8T5P5icf6BbYj8ufpgxi1kZ8CWinZavDgDgSRFpSsSsKTiRlL9Xkq2/Wgx37BI97x9q/R7DixCMS9EtJOopkDK3Tf/GT+g7jycJ4aYN2obC6ocJ1PBJPR4okILyHusqnNp+jbnbMTTGepRT8fOxS3/Avbgs0Fsu/cY0/NOF+nCQikGP6eD2ohjYOtpSKofo8/WJ/ENHcmm+pClZfCkRt67L6HywSomASckfz309iyiCwdJJ3djQUm36k8vOnVjX8MSZA6fqW3x5xVp/QY8nuHcazn3sO/09kDEvKK7sppY1lOIx+/Q4j/6sy6VC5deAwh0N5IZNXcw== 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)(6506007)(1076003)(66556008)(6486002)(86362001)(66476007)(8676002)(38350700002)(83380400001)(186003)(66946007)(6916009)(26005)(2616005)(4326008)(36756003)(508600001)(2906002)(8936002)(38100700002)(52116002)(107886003)(44832011)(6512007)(5660300002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O3wpY1lQD2oBlcymMHgZIvuPnQ0EwcYwK05BNfuLrKJO0yUtLYL/RilowJIMQyZuh+xyymgms5aQW0WrEJfgwq/nttrm39X0WPcvavTbFJfFwBqCteTn5IG9Amc+4AzU908SUaNuZoetinQmVVGjeuqb8xcv8sdSEeIt/UHv7XtsrUkG7dRStrBvFrbcfBwFVlxGCSHJrRtAODatKt/LbwUY6WAlkW+hbFRalEuifsMw4TSD3Vtp4f/83NqVj2fyOfqPZPLyZfs0MbwnwRqjsj+dwABuixu6K5geLyjRnjO7fayzL0jsrMOQw1dAUcB+y+CHdhzPI6UH1r8hBsYbTb51Fv3ARf9weon5vb/RUdRhN2Ad4KIrsy/kHYzCdYa2MbBP8Q2Xw28Htf9gAv7lVQOeoWUwKm4MJtmviqIU1fH8doKVp8QIFJIOn5pKJ5GS5xySFpEKBuZj9MMcR5CxvlvnwwJdUYpqDHxMVM+uGWkbTBqRf9Q2kKL2CmbglBmTe3hIPNq5pkFWkvxLgd14Cb7As3KS5CxgzJu7AkgD+Sm8UP7EW/u+8sa58rqQcGWGStZ5hGjWiyWL3lxfx86KUuI7LslpRBk3jGWWOpWm4KsdKb46sU5bgdUTgEkgZQqDrW9Hya9ENeKIzzYY/hAM5I9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id: 7c8574f3-1eff-408d-a373-08d9dacb69e7 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:24.1215 (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: Uvb7O6asPJUiIt/L0ZDIFBAR2R64ldwPgpN1UxGn67AJCLAu7+h4Hi+/Chjbr9deAS31kP+ChGVYHip5DQSbKbeqL0jZXNUBTjZGDgXTeYw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6003 X-Proofpoint-ORIG-GUID: HzflXGKrRp9y3xfHpVU2-72JDXdQYPp4 X-Proofpoint-GUID: HzflXGKrRp9y3xfHpVU2-72JDXdQYPp4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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. When using an external PHY, this also ensures we do not start trying to access the PHY while it is still in reset. The PHY reset is initiated by the core reset which is triggered just above, but remains asserted for 5ms after the core is reset according to the documentation. 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 for this purpose. 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 9c5b24af61fa..3a2d7e8c3f66 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 Tue Jan 18 21:41:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716918 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 6C8D4C433EF for ; Tue, 18 Jan 2022 21:42:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349466AbiARVmr (ORCPT ); Tue, 18 Jan 2022 16:42:47 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:7967 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349436AbiARVmp (ORCPT ); Tue, 18 Jan 2022 16:42:45 -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 20IBseYa030788; Tue, 18 Jan 2022 16:42:26 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2057.outbound.protection.outlook.com [104.47.61.57]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dnbdu0rt8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mz/m22+5qzy9HeY9jdJaA86p1I05W/glSt1sO8sw1E0KZQNejFebwd+cslzmW80tVM1DTZ9/32p7LyS7+bytFWH52nzz3J2th/00JRZRbuq8F+l89fOj9zUk0w9fSaDlBzajkmfMtdDi46pQHMUwzijMwJQCViFhZ+Ie695Y0vm1pU5tyvwsqVJS1vzPU4I6ts1fbfJDWJ0VcThdJl8uQoewPYux+PCJ4qnen35yUkcOcbKNLGMarkQLDHmlF2UtqzeLL6f/k64qD1Y6XOfYCpjTSvYRQ1Gox6TwWElQxxrQHsuwL0xrTVUJRp+jIdIj3c+v/idRABcKaG/SwKvvPg== 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=rQDwv7K5I92pVNAUfKU/K6FGICV3JjVTyK7hQ+R2BWI=; b=Efx5wus724uJmWwcxweHwC86vU9IGiJ72lmZCOTag77G6t2GUoSReCcOSEeuo93MNfbAMKMOyWrZdizkDOmWkvj4Es5y02J1G8Xd8jdND6czRz9aUsdQYx40XePhX0Anzxjx0uJvuPPqsoQyptqim/3CcEXV8QQuarXHYqnWxlSxknzXGJPIdXMxSbk9uTvPuLXI0uJCoVALJfrNgKubxA9osmtmOoid2r+igbfW1DS1Pm1Xhi0Uq9pnmz/QlxrevTF2EbjFnqHIgO0s6d7aqllTrIQPztGeVjzgcJRCbRWeVcBJ0K/aRe1NZX1WcleCzZ5oD/XfTKclZcE/+00Sgw== 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=rQDwv7K5I92pVNAUfKU/K6FGICV3JjVTyK7hQ+R2BWI=; b=GKciGDdrrCP3DqGS4Ryt//YIhk+kdIbqMjhbHP51lclVw3c49t3u4+e0bdh44sXpbE47Ywqprp5mw5XX3/FHUsR+JLCeFaxSWIWotDRvFbv+XUf9GrctlEyfR847diDA0ae0u/9j+gndfc/IDDrU1KUbzKLyRB/LjenGr2Quk5w= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6003.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:25 +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.014; Tue, 18 Jan 2022 21:42:25 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 3/9] net: axienet: reset core on initialization prior to MDIO access Date: Tue, 18 Jan 2022 15:41:26 -0600 Message-Id: <20220118214132.357349-4-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 497c4ec0-5ea2-4271-11a8-08d9dacb6ab0 X-MS-TrafficTypeDiagnostic: YT3PR01MB6003: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: leB7gjbBqZECx73x8PSxXdAO3Dse8gx4NxL7OySF1Exye7DmgFb7XNM5hIu4SaSkCkAAZkrQm9VI8HUGCWrJEWceKhP4F0Oakitp//L11ngEWfrYav9EF0sW80Z/iAVYAVK9iQ6ciinH/9pEk3r7MCZYIDkpmAe8QZVLGhlP3D43JlMbjIYUCm3hXw0XXcG8a1G2ovVq4gIYdAJ4pV/qnztIKkcCOqZLplSUfDA5J+OIEcXICOexB7hXhrHop2E0Kqixal8FRSd9lXxisAK2AFW0Szc2JUdFmY3bUDMOXUvveVvhmPu9wCjVIT5USh6yZFMYyLePZT1qOctHW1588AprkFFb2ts8r8eFSYlHhaf83hinATqOBukTu9JVg6L9JWplR8N9HNNYTE6fqkKx63use/df+41w9y22hi4bHrH1YNQQtNG3QzyBsluzzfemjG8ZgwFWi8KjsD3Z7mze6GnLQFJIQlVxtdOF8j1/ShtFYmUIf/6hfdw14fkRlALervuOKNe0CL2uK7ak3llzgs028XaF6upVTWKDX76tXe+BdTewO0A2iKrjwmgJ8wX98kqKEfjBH3oJeBqXxtB34CibXtuV2mdDaUuUSsZaMq8EgL9R7928oQKoApI9z3a4UJWB4yLlMdGbPxLmBFWsp3MzCOzWjDhQQzDAH2oJQ/+VsIyvAy0ZJrZujegM/UP3lS46bYAoqh+t5pqMEBQO7w== 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)(6506007)(1076003)(66556008)(6486002)(86362001)(66476007)(8676002)(38350700002)(83380400001)(186003)(66946007)(6916009)(26005)(2616005)(4326008)(36756003)(508600001)(2906002)(8936002)(38100700002)(52116002)(107886003)(44832011)(6512007)(5660300002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wY8mMLWhtieIBBFjxYgEAyWlda2uLgf51yW3BcMTzOVX0UaoDN0nUzf84mM4xk8Y0JyVu2fdnhKCv3G6yebh0l6Oag8X3jtBWMTxPcB7YuCKfPJcZM/ankyIYiD9Cpc3Y1CNWqmEZ7p3OHrNhfiYA9jZepvE209D6+/4dhdiErJ+QzEKli8WSKCJCr3AlkjLBrVRGcWsGuj2gKaLeJL7Kza6iSlVTtPgKMbhXvOW1XKPasNIyQQZ9y2oMOxidZwEjHIsBJX0cPDDIIv02xXhscAfc9IQbhFB5r5zFehdTsl1+ytyPogJb+T/xWDKy/BHrMUx/1eN2COnqWDKsyanbBHZKb2lRWK6bs5P709a73IXDDUhtbOKoAJJ748E/K7qsRDU/gu711i4a6k3QDq0DzF/Qsy1SDaKFUKyDk6RkE8qfszchhRlaxX0nJ4cz5h0bHAF9OwrXcL9W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sClaAaLv4IHqbblDVHibEhycJrtLYUNVczu2uMvZMBKXif+Bk30CX50dtAJJBXDQRxMyv7+9CB08si+n8+rBUlDr17AbBUfmqkx21epVASLNhaK/39axpweegZt+S4pAqgcnyUIZVWMNGgJunDQuR+tlsAbweFiSVbPEX/WLGuwm+sud0awg= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 497c4ec0-5ea2-4271-11a8-08d9dacb6ab0 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:25.4338 (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: Yv2Q7OQd5zn5vV8BF6WXSAe8/Eg37ETfgAvTVdlmdAB8KG5Sn/gxVa6Raj5Cj2S7lFFR0NJ6SGQgzUPZj1QXUTcTkr+tIZ8titYAo/ZrKkc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6003 X-Proofpoint-ORIG-GUID: kJuxFHgu2Qlihe8GHfcT5sIOQkmzBieW X-Proofpoint-GUID: kJuxFHgu2Qlihe8GHfcT5sIOQkmzBieW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 3a2d7e8c3f66..53ff38cbc37b 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2036,6 +2036,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 Tue Jan 18 21:41:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716921 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 0EEC9C433F5 for ; Tue, 18 Jan 2022 21:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349657AbiARVnG (ORCPT ); Tue, 18 Jan 2022 16:43:06 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:1123 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349549AbiARVmt (ORCPT ); Tue, 18 Jan 2022 16:42:49 -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 20ICiDwW001396; Tue, 18 Jan 2022 16:42:28 -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 3dnapfs2m6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dj/ro1PhcZ1S/FIyT/xGfJwCN5L3N814+PUvrxHzHZjo6SjxR/vZ76BjRdWgBcdcEKVpO5KauSN+BsdYfh66sWQ9qa4d5Iy/tsnnuLQ6KKcieco7eJp3fYHiCMx25uVST0A6N0i6adw9veb3a+v49w9nBl3r5k1ioKnRD1uXKX4SRoCRwbNtoxwWLdMXf1AkLzp9oWx37p7sOeb/zuUyNWs/YAMK6waOuspJc8V2elOQnLI6VackUs18ytczrT6QPRNVofV/RX3I/fdHM1pIN/tROkVWxwvUOs1inhzF5LA/Mm2RgMfUhKZez+93rtgklpXXcZJsIIQ5pRXHHbKteg== 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=mS9qW9h/D477kjIlSyIvVI+5gM++DTlsJEuoteorGBU=; b=BdnSVBTeuedX4KylRa6aNqjhboMBMH3QExFsR4F35f0hh9jKOVCVhnMwUfPUuphF2+amzLMw+FMATK+RLhETVjUlPRnAUt1Chk0yTUCnHTyBjmEk+bIp9Rmr0VtvtsHXrnaaCwmxkWS8WK4AGFXxJZNb6lG/Av20Vsr5NiQZ6//payYcIlIZijAB1BN5CWqPUjbQRS1nMK43cUk1rJrK7SN1rJ0zMOodz+R/wPYV3kDkQ2/iFoKErwv7BM0Eug1o1MlvYXb6DtBJxVRrEfpE60k5C6LGLM3Aq/+Bkq+JH5QVPEhA5xAR1XWn8a65iz79CEU59at6DCgaSXE4aKmYLw== 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=mS9qW9h/D477kjIlSyIvVI+5gM++DTlsJEuoteorGBU=; b=3WZuF4zoQVwefAcFTLjnC4FlApRSOCxBMo/aFj1WnFF3lW7Gep3K+TZUT/fd+p0HGq5bZaEgfxjhrf96gj2PVfY76P1zF6R6EZ3rGjCwEvMJ42UqsTUV3iOoJqhOuh1P+x2/5jzl2e+3d6jpZoSr89YFFPpSYgqv8cfBlzHkjd8= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6003.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:26 +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.014; Tue, 18 Jan 2022 21:42:26 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 4/9] net: axienet: add missing memory barriers Date: Tue, 18 Jan 2022 15:41:27 -0600 Message-Id: <20220118214132.357349-5-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: fc3ecef2-a782-4f7d-e2a9-08d9dacb6b7a X-MS-TrafficTypeDiagnostic: YT3PR01MB6003: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: lB5yIkC76vqsHkmpbVRmM91fI0gkfGj62ZplSjVlHufvYbvIMofut0wOcI0zlzdQMO6+WyORrEagQCj+BLth4kfoeemiV1HyywB00jyraa6d8nCAopAB2X2rBPwwhD1O7/ilXzWNbx1nfQO12Wqq1kwHsSh1aOepAu8zx3HTQ45CaAOcz80KJzRZFZJ1EV1h0XABWbeokoi0dkkclxjQeynK624QIU2mYAEQrG+Y4MWU4HtbdfbKhcAsyqcyN00EqZP03bwzQZ7/2u3B14oKf6rBuRMNLjBa1PjdfBB+HZ0aMguK/k2YWplJ6qFKnlZZBAZ2wz6ZrHgBdOPU48ya4CDXHxjeEIkvRbzxoR3ZZUkgCVfAnNP8itRlnN+GMTuB8TXab8h3SzMupSIDK1rn0Bj+6bdqa/yJK/hCI+RHKSCF2qF7Og2DHWl+SHEo+4G5bKCcpjotZorNRLdBb8lCoSHuMrTxiSPvgERjspy4QKNDVkmz+w8nPI4b4YAJ2UbqX9ijFVAMY31mV4I8NpyyrwCR1+dftxOMB/m7z6hdwMXiPMGJwqxc3z22EdXKFjkDetz7ZF7lYePsqIw+OdC15NbjFpmyU/Y6W6YMYH3wMCyC3JTv9c8w8hSfliEcv35mZy/bd3RBNXTVnGVVdMc6ThEvxQVY6nxLBfkCB/Ea0zkjDlTdUf+EG9zVB1yCUxDzCAeZaS/T8u6pa/7LitmyUg== 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)(6506007)(1076003)(66556008)(6486002)(86362001)(66476007)(8676002)(38350700002)(83380400001)(186003)(66946007)(6916009)(26005)(2616005)(4326008)(36756003)(508600001)(2906002)(8936002)(38100700002)(52116002)(107886003)(44832011)(6512007)(5660300002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: u8ZPhqtHvB8FU1exd/VzK0oS4+pyNqQl6EXzLXGR5gfFwkN61jv7FG0BWxzjEk+aROXFtst+Ww5yokvT9vdWxe4KNb/+liV3Zxtf2SwSNNlyIP0ZtNhZA0poOnFeB7U0Dg1xvJAhJJUA1F4QpczLK9QplsPOEUCtJEONpmVKKwO9htT/mE3X4tXAWf7/mynbGz4HYNxQz9cXaPK/fWvYwcbNznOdwywpBIBjk6NfL0iljT1Vi5NZ9XztoJeKYhtEX3j79kBTeS6E9z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DReE5rniPq3NdrCLAWt5wzb2BBx/kkaziOhlbxpsEdTYEAi0B1HTJAs8ZXGxmW1XqTbuVtlKo1aq7Aka7c9vHaBAdiw7YfDWuEHyfSncqF2gEkC7wzQY8tutKlOtorAkRe2tkAxsrN1n9PxVkuHiXff++iN9SegHL8nqofmnNC1n4WBx2dssr6sbdggkFT44U5rU77RkZ/FIoG57AhPsx38+MuLGuod3I3ZYOVgpZLu1KdE+XYb3N1fJrxr2UcFeVVyTtWViCHN8lpPCSqiBxAGB6cfaUoof+kPwHvZIPuc3YWxGlK4iGR//X47RgeYJybZOx/QBA71YQBhPm12Qo6+IOiU4PKLe3aTaHAtICc3mO6ZRlrU30M= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc3ecef2-a782-4f7d-e2a9-08d9dacb6b7a X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:26.7161 (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: 2LWPHcyE9fz0YaKpTy6AWdLSARcc7gETTDYpF3/Uou6SVH8KKfsTQYm52eqBB1N12QXOJqLQtr5NmhUR3wSYRPeNCRbpEqysoGjZnrLohKM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6003 X-Proofpoint-GUID: DwqWuOldaR3XhlpfDicT4sGUJnGs15E5 X-Proofpoint-ORIG-GUID: DwqWuOldaR3XhlpfDicT4sGUJnGs15E5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=652 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 53ff38cbc37b..fb486a457c76 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 Tue Jan 18 21:41:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716920 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 65956C433F5 for ; Tue, 18 Jan 2022 21:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349613AbiARVm4 (ORCPT ); Tue, 18 Jan 2022 16:42:56 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:5990 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbiARVmr (ORCPT ); Tue, 18 Jan 2022 16:42:47 -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 20IBseYb030788; Tue, 18 Jan 2022 16:42:29 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2052.outbound.protection.outlook.com [104.47.60.52]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dnbdu0rta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RCgxDYu5HCBltRIHkfD5jkKRKr+pbWUdhaZeEenSRfKoSOzQiFmgixBjvLry3yds5ZePGxepKW1U7t/gaGX5X1qI2sdGJpXa2IOKaqxYpSmv8ElBWewRsZCnavTqiV0hscpj+wmHVBczLhbVvXclV6c3w+52xO2p5xTBwIWnq/SJTViE3knc3ZdPFQHjh8/4lwJA1xdlIbdfPhFam8n7CTJZaOJKHK9ySpk40Fx8vlGMSmT38tQQ8lbmFbDpMNMwjny7ZqIfubNZlX6QVGbeNNOqy4iRUMRzt0jjcgBs9OK8EKjeYnahxPHvrPKZ2ahiqdjCjube7YvC6X7TdtT85A== 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=4PR0lm+N0anKi1GoxabW0olSDZIV43dwjQfIwSvvyP0=; b=LJpOCLQpIbQGZI56GgGhi942mPa1HLzs1SJrShrNoeSpCseE162Tx/P5KQr8mftIoqSN9/M1PkzqEbILtPdRsnPjdesizHk65yC850Y0ZT5swmO4c349DqYbIxtDw9U7+EG2Mi3EEFQbKVjEm1CBurB5yREG86XYZg2DsOr550vFtOJ1cSDy06qgS7XNZECMiX1oM5TZ8fhUINMYxpv5efE6oWUxKG56ztFDkKk7PzKRrS1On8RY8zIWk2I/pexloiB9/8f1GNo4SYyIHIqYZ3nsqrPzv4uwEUMNSQBDSZDETOmcoBA0xMwl2C5Df6E2nl7wOtzSP1cjJK+j1TNiAQ== 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=4PR0lm+N0anKi1GoxabW0olSDZIV43dwjQfIwSvvyP0=; b=I6uS4bHs4Ar4xibTFifTCXuLysPGK6v7u7Q1wrZM0CLtskjY1TAxwpRS/0gSaMlehoZ7/SZ8RXZ9lYHn8pyuOHdWlfvBXaeusAFNf2tXbjvbwCJAVLXszK9eU4zj8aSXoNn2SN1/tj/DfXih3pb5BGb2BqkFU2d2A7o7bSqNdI4= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB6579.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:28 +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.014; Tue, 18 Jan 2022 21:42:28 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 5/9] net: axienet: limit minimum TX ring size Date: Tue, 18 Jan 2022 15:41:28 -0600 Message-Id: <20220118214132.357349-6-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 415c3a15-8a03-4524-a66d-08d9dacb6c3f X-MS-TrafficTypeDiagnostic: YT2PR01MB6579: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: F/NGnDupz2HVaPj6ZHIXzISppYU1PWjsGkoaRYzmQYTS2HoIpbUtcNxNrLaUNaJNn9pxgXcl//fkjvGLblVqt/P4xQhl2BAT91PtW8p3dBJiCFBaChyzqH/Ns7UlH/mX2GjHszWpCPAbjCinEwm3NUC2yfrJID8pAPsNZGdawJ5b5i/BmDiDtomvi3gnqxFOoIipHKzjz/sp5ivPwpK15hvCKxC3SWCI4g22pHRcrYRCl4XrrryVOLsN2pI+Co2uxkv1KZEn5P/UV6lNgEKXK3vDU7euSLFN8MygWnkoOsXSvKn0VYN4bF9CIFMu+2XxWhYwYT138aHNXdqcmteue2R7Gwq2YIL4aJwx1Lpsq0MD3F/NJdME+Zj8ngOpGrEPnNoDofM1kgG/Co5SPoO/x/rsc1Ts8T7J+Udtn7N1shHI1n5R3rG6B7tYpB8ZDgched30T05mg7MGPEZ4PCBwC6KvlKVPQUwfWvbSpNPMEAtEw3qH2mgVsmk7dZ0tOTHFHhDw+wbG7Ksew0SfpiFGecxqFD5NRqXxhtiT/ReszL/RZGM/znSScylHrNO6mr4byl87KudrjwRNizXyXjCZuWxmuZx3d9dtNSdTGP3U3TBxulZoJROkda9mQtPoXcsTHbjs4tvVFEXCME+p9ufCtsD9V1RNV4y6GdK8h3ZO89rlLIwHajeVSxTAL3FEkKKA98pGhS0n0z05YcADor0g1A== 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)(66476007)(5660300002)(2906002)(66556008)(4326008)(66946007)(86362001)(6486002)(44832011)(316002)(52116002)(6512007)(1076003)(83380400001)(26005)(6506007)(107886003)(6916009)(508600001)(38350700002)(8936002)(186003)(2616005)(38100700002)(36756003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PTFK0qoBQNC6ncGcPATM/PUPEpV8QfDY2ive+RvmZR2cETBKZi0thtw42QKAng6M25j8hGyTFX5ikvBgBJIPBTI7PKzWZlKbjHFSHfY/7fr1lzu3I883OIaXvlSiNUsx22uJ8Zd35RFf+Bh7dweW8NgEyD5azYDiKSra6TGrk+22Ox61XZNstIomT754URUKlvvJ7nwunlTrxN+x5Zl8xo6w73vgCiMwawhyhXI42fAUvdhC5JnxBoTCt6WcYwWDhs9fEukU2Rq3Qc6siBywa8jUaTTOnclvEOalV9GL55K/ab7Zcy7ik7CY4AlKO4oaeVTmddSS2bdvKDohiVtltnbdFM1Y2AFgZvdE7E9pzjyWispQd3BdWN+oEWmLaNIEcXfT5DUa/A0LAHIsLPj4lDxSKM+PS8nqEzRndDKaglaQtfFkNgiV/NxvshWHRaSDf1OKrd992aJ6eBuq8+TUMuPIxn8vXYpwjOB5a2XCKet/7ipR1Y/JvjvHSjmE8YGwjKhUPTLGzzyT9TCbd0N90IoKTh4zbu8olf+U2ziAk4huIz6WSleV0JWZPY7gMEmEgg6DLy+a5/Nrrnnme2mVuJOjemfsj+4KzPj9mvwurJp/C3y5IGwkBBA0cXPkgSQq8b9ulP0/pJ35l9AHlcMV3vWIKslonVb/V5FJTAffBlJZTufBj/P+A8MHCfSKKB7tYDYSXivLyPubT9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rossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:28.0680 (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: ecfA/arVNgX4UreO5vh2tvlxQt+NQ9FzJbXqChqEZQVL7ENRHyPBq1dRkDXZDO+xZdEf5RlMsLxmiRpPQ1GQu/sTNhn+6GNU6U6EVgeeke0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB6579 X-Proofpoint-ORIG-GUID: pd-tQOmTWjIdauqfc9op67-dRXyncCFL X-Proofpoint-GUID: pd-tQOmTWjIdauqfc9op67-dRXyncCFL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=700 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 fb486a457c76..3f92001bacaf 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 @@ -1370,7 +1371,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 Tue Jan 18 21:41:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716922 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 6CF60C433EF for ; Tue, 18 Jan 2022 21:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349682AbiARVnM (ORCPT ); Tue, 18 Jan 2022 16:43:12 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:1131 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349550AbiARVmt (ORCPT ); Tue, 18 Jan 2022 16:42:49 -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 20ILYMwr026521; Tue, 18 Jan 2022 16:42:31 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2057.outbound.protection.outlook.com [104.47.60.57]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dnapfs2m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SLTERn2gl8B7PZrTwDOBfikeDdmhuyqTNvYCSBloEP7ymuvtct5POpuyD2ut2W7zVwpApu2feMG5FZvYwIwE0vUuUMSMeYc7kbRAE7uzIvNNTQtyQDmw05oDj25c2bvPLzHhW3XqSEBPRxMb6FNxIJcoJ1SlRO1zuoZOLa7tXg6oe5autdLlNL1PtzyFvRg+1nGWFYWfd8WMCLummloY5PCpFLcD3l00woMFXIp7SKBW02/jcZjjCbMDhNiHh9lEZ8gIQ+iydreIeyroGnAbGnvjQIAlz8V3b9m6M4AOXMMZv1SRomSlrQbkbAicyHmovQBN7CzAmtJk+qHSpgx0rg== 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=1leo7FZYKMIKVIx6OVkLR4wHxprjP/g8VGKrKoIv9TU=; b=U7yysgpwdhXGfLjMBBhgJKU4hmlMmlKQ12CbVfWITazt72yOKqrF5id/7fZ4gliViwsnTwhBg2S7AcqxBxU01akgJBDP/cS9LJC8sgzpc30Nqn4U30SyANUaV+FN8I4TyeY7PImfZhC6stgUvxEUIvwI7rBk5IiRkzjuI2rkabrCQGsAEBMaurMnAh58znaNJNM/WDwiMPiAKhPTqwV4CS8gI4KNevswGTIzJr7agoy1kaQwEUry0kHg7aM3CU+Af0vOrVD0XvXI+uVLXFTD4FAg3XxkCDErkQiMCSdHg6RP8Sx+NyOxVK5PKatMQw30ytv9ARIDB4PVLnuDw6kwIg== 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=1leo7FZYKMIKVIx6OVkLR4wHxprjP/g8VGKrKoIv9TU=; b=rtdUqoQZKKNGESMp5Cpv7KPvBu3hnA6bZ6PEtQ/mnRY0Y+kPwx8iOEpfGAelfZk+7Xso3k4c+zLfA/80g9RaKUykdm4+M+SalIubgzD9yjG85r1j2jqUIBp9gvegMV9N6Tk9Rj9Lvbn0bNq98smwKZebzPUV3qp6E0BayUM7hTQ= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB6579.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:29 +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.014; Tue, 18 Jan 2022 21:42:29 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 6/9] net: axienet: Fix TX ring slot available check Date: Tue, 18 Jan 2022 15:41:29 -0600 Message-Id: <20220118214132.357349-7-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: bc20150b-25bd-4549-aec9-08d9dacb6d0c X-MS-TrafficTypeDiagnostic: YT2PR01MB6579: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: XhNy3hYNZ+YHQxIkM7YJMaa9aC2YcQhzvEbbos7OsROGNhlbBgj9ILmYYxprLVGBqbL5TRaVVpU+NRV5OQsqXstQ2h2Wc4LB22NltLwr+arOvUBeKL7Pn4FdmX4yECVMO4+EJatQDfgK08nFPOypznz4BnBOx1VRU3oifdwLuigOhzbHy2Ufb0pGmHPvBAD9FGwzzNV3lI/O30jy+iF8iRYnIGu5mo2sbhcHT0UffpEcBWs+m+cBWucFijSXQ0vFX7Az21RS1pMkMbfZrV2pIkODIL9QoYbhI81IjXYPplHdzNDnDEJZl+lBb9GMJBImFovXNMLBH4okQBsXac2opTxmAJWwP/udIZ79pzDf6qegLLT6JAjJv/DEOuPQDwMxXYQcUN8KquL9j2LH0FhXwQSRI9RTvKbBheAgxANPA+j+nHEsFD1uCxN1FgdGPaHPPlMTyBS71/rI+h5+pBwFn4R8KxCCRRWgria6xuy+be93eWrYN+8xy/30IwhcepZZpsOH07jbnySFeTd7Hi7Ks0FAhMOsjD5jlVRk3zmiSdedK56l61HNEPQTL2NOW71KNW0oQRA6fckCvdzv/88NJrvoxIWuwLoGkmfs97w+c1aEsSVnT+a7Yl/tE9lteaN2STil0/Ud6kWNmAODNeDqSGAypweoZ3AoF+858MPbTzMK+jivrxr/rlJRJGcpyDLzxSrq49jwCU2/CmL+qV8mWg== 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)(66476007)(5660300002)(2906002)(66556008)(4326008)(66946007)(86362001)(6486002)(44832011)(316002)(52116002)(6512007)(1076003)(83380400001)(26005)(6506007)(107886003)(6916009)(508600001)(38350700002)(8936002)(186003)(2616005)(38100700002)(36756003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cbUJxTVxpZo3TD8vUJrxL/7PgTkeApwL1brle+jjFIVjMJyqTJ6hoc5QX5WoqmqgRyN//C/u+gDLrslGJYYV755yBGguZQu6j/oJdiYRfC1GM/K2KDEp57c5Ji7qNBNISl0iMl2TAg52kzqLqbqxMTSEfIJiSAUaNjAKgLwaIqBJzM/9gwhw1920VCMXP5xbtsn6NdMc3efUXUwk/lNHCu0Dj7Sk8SmNDbubM6hP2evlyaakPpl3HX4y06oJdfqH97zR5ZmaKdWmztBY8qqf0fFe0/mtPWO+XbjL+FSNWOq7v6657m6qy6tkdAe2lk9CIkzNyCmGoGde7h6GHksDevpjMNFKlmFnXwWZ/kIAAlNA4PfBpFbbcXD39jKrUHWoYXdrmmzSAMbzBZE53lKiQnZutbcXvgnLTCeYsNL9AQjd1ult3XNdvevzuQeQBgksNeNcoQfjZ6ebCjLCqELLDRPS02oe17aBe2hXqgpsXgRMCY4TS4Faw/FLi4LRUsavKA+aaCb0hkVeYYXrCdo8ofJmkRFLiitIc8ehgqI6+bpWEaPVhvzVdFH1Z8n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Q56WfAXxV8wkkhFKyhlW1yZLNU/NydTiOmQvJ0/jNY3srALBc= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc20150b-25bd-4549-aec9-08d9dacb6d0c X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:29.3649 (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: ZQUMIPSknaMKufjNXZLXHKY93hbyXRxHYshbN4Bw1FASHv8pFqwwegjbNcS3V2oC7HhQR9ehTT6mTN1RFazh5Y2iYg4wzdvYJk7sryvtj+w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB6579 X-Proofpoint-GUID: hLY4scXcj9sQFhtL7zJcxFJQynepx5gf X-Proofpoint-ORIG-GUID: hLY4scXcj9sQFhtL7zJcxFJQynepx5gf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=658 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 3f92001bacaf..85fe2b3bd37a 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 Tue Jan 18 21:41:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716923 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 CBAA0C433FE for ; Tue, 18 Jan 2022 21:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349562AbiARVnN (ORCPT ); Tue, 18 Jan 2022 16:43:13 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:7724 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349558AbiARVmt (ORCPT ); Tue, 18 Jan 2022 16:42:49 -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 20ILYMws026521; Tue, 18 Jan 2022 16:42:31 -0500 Received: from can01-qb1-obe.outbound.protection.outlook.com (mail-qb1can01lp2057.outbound.protection.outlook.com [104.47.60.57]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dnapfs2m7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KvX93i8fQNMxilP/tTbGeRKGN3NP6XZTfvSJKZHULPIandp0NJMg6B+W5M0LFUaF5aSpch1sioQ24sGA1yTEbVnIcyzXVttAZOVgPQn9o6qNh4mqWCgdDhSY5OOxNUcQDOIdAo5whUUTqG+vbvdzjkCLwqOI1hv4MRZBEAqDLqV9mzV/0FraP+e85NXuaPh6O4CgpwDbT6G/M+jxLy/9T/YlUyNdWWCOqU423SBlSfLlMEPNdy1sN+S4DDW9TnYVFD/linElxuQbh9OF6P8nCzSj+lG/S5UZvgmbYhghSpYUmVvoMePbjhOCD13kools2zS6Fcd9sd8W63wNh+OZBA== 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=Ym7UxiJL8GHTQIM+r/8L6/nXNXOWKMgJrxtKIjyV5eI=; b=P5v+5jXj5Vtj7IkBG23dmejriByLCQuh+xK1ZiS9cwxdk3vC9vC+MavUMlWdHN7RQ7mc7yAyfX3n2YiFNhgV3ppm8CP4v+Qj9OZTThtF7zxEyEe17w/6BPoJSZj3SDQ7CvaijtXnV7V8NfIi6l+lf4KLFhFiFSTtFbKLo+OenQdeNCWiR5vfe20kpS5iVkUnygIuFz/G5jRfL1BTHnQAlkHYDx8mJmlHL7U+eKxpIULOHVLaEB0b4sUNI1Ev7Mid2DCEoqn3V/X2H0/fs4/FPwzjGdXxUmu6cLx9n3TkB7MleORimFaqscsrh4gJcTTvUu/qe16bk/88R53tAkrYzQ== 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=Ym7UxiJL8GHTQIM+r/8L6/nXNXOWKMgJrxtKIjyV5eI=; b=rUxlftdMVA23ewSyelbIeYShIxqlPlPiKGsK0GdWobqOnKo+f8QUr30y7pAXpyBztC+4QfbrH0cG1GTkGSYTgUsINTmeBfZFlifefcTq35e9WLNmBhWxrEk1UKhLE0Jr0LGe5FRXxsmlpXPrTwpbNYNtzqle9yKnZHdP7NT2RPw= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT2PR01MB6579.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:30 +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.014; Tue, 18 Jan 2022 21:42:30 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 7/9] net: axienet: fix number of TX ring slots for available check Date: Tue, 18 Jan 2022 15:41:30 -0600 Message-Id: <20220118214132.357349-8-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 15b87ab2-5c43-45ff-3017-08d9dacb6ded X-MS-TrafficTypeDiagnostic: YT2PR01MB6579: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: NVkfihZqk5zjx7Rc+den7RNRpGufvN7rVzLTcrtK7/HnhzbtEL3BXfu8WRfXiHePP0eDiMsFp/qJOndTZ8TMY4qZNSHMUjxvOQj/Kn90AMUr+Lhg0EkTNVTCH2dYGabMe6/Lz4Rw2rtFgPJYsbdxMBJFJ0XSwePTXJV86rrlM7QUAha5WUvrSpzxCtqWn6LR20wSTcECjGJVJfB2VOWw3FL8Ry2/2ymNKYqMDmq1oOxKgkAwsjUdvJTExhsBM/76/ZZYEpyDScNTLpdxuaoQbyQVb6riWf+oXbB706/w/e0JPP7LshzVfmARwjV/LpmUX+fZLUd9La2qtLbPCc822d0ioU6nSyS3ZR8FXwvtgo18nG0re9FMPHh+pKM1g2uicKH/aAhd1jOkiRG/ffnA7PcfYz18oRErklJzjm0TDyGljv0JhQd4z1OciCMcIDKscXvE0PEH5M/elchCRWeRt1+CYQUEvER1mRQtKvKTt5QAT/S/YeepUgOEY0/oZ9Yp+J1lhGmYi1QZuPCY4KG2INz9LF5rWV1K1iCR21bZyZb6b4sA0beGjx9XAoMptRqVvphX8LnbSjifu0cMvV6T3dCdJM+2IrUDE3+VFoAWY+bfzYLOaP/Uyao/032Jhd3dGdO25aH6ZwDs79RlpzwMrNRa7IoNm7qK4MC++8JbB01FOd60NPeJ2zqhMP2swc96BX9j5JNk/Bp6UrXQDhJsMA== 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)(66476007)(5660300002)(2906002)(66556008)(4326008)(66946007)(86362001)(6486002)(44832011)(316002)(52116002)(6512007)(1076003)(83380400001)(26005)(6506007)(107886003)(6916009)(508600001)(38350700002)(8936002)(186003)(2616005)(38100700002)(36756003)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MODuPpuLeKRbydfI5hbOKTZ0JvS13nvCH9iIeBzG8mJ/j1rQGgJByfoOkXmVyShQcdokUUSKAHm5KE2wqH72E757aaGbohBzfVbS3Y9GMsYJJWyoRrs3XJys/13tO2dB5+v18x9Oj+anOSmIXwqfdXHOw34vTBGbz5n6okGIzKWR/71HXh6LOD0Q3PEDDC2Wl6afWAjsWnLc7pXsNMzzhlA8426UC64/OnlWNTvy7AWiGq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VOWVjKe/6l4KW10hCOammyftNl/HSprtFFfTVSYIqDJHMCSpjNKIWDk7YfsQT72drrVEHIgp0oxOdHmcR9UCqzKYG/tfT5JTABE1s8x4Y+jei3QMMp5Jb+nH6xixlUsdDER5OQ1mKu6R7PUre0plAi/2+3P2Q513M+jIzfsbp+yxxzfasdF+XF1uUeg7nNMLLycdTIUmMMFeH2qKAPbzo4o4LjlA/n8q8mqlZ0Bc4aOijIn8ZBg6/G4X5otHL3X/H+M7lzVrgAUzHlw7VyxhMI1rfTzTL7TMTIDq1SFQUqw1CsjHlsh4n9+AY0j3fRglnjWhz8vOTJF46hah/90/181hTTw+kUFx/QRaB83Q23d8z2QIokQX9sBzNUwWYQtqOpwNePf2mOHAnsddI= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15b87ab2-5c43-45ff-3017-08d9dacb6ded X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:30.8050 (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: c+1AD5fL8MaTdM0AYFohlzydb1R7i+5lQOl8nC9lpcGmGkt2wTKMtoFsuGXST3vIypU0491Nm74L8E+tWVckYsblrvGMF5hmEY/sqw9X0EA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT2PR01MB6579 X-Proofpoint-GUID: tfqPoFqcrTADtGw_yug-8OptVl6QHi76 X-Proofpoint-ORIG-GUID: tfqPoFqcrTADtGw_yug-8OptVl6QHi76 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=914 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 85fe2b3bd37a..8dc9e92e05d2 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 Tue Jan 18 21:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716925 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 85649C433EF for ; Tue, 18 Jan 2022 21:43:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349638AbiARVnY (ORCPT ); Tue, 18 Jan 2022 16:43:24 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:29288 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349572AbiARVnN (ORCPT ); Tue, 18 Jan 2022 16:43:13 -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 20IBseYe030788; Tue, 18 Jan 2022 16:42:33 -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 3dnbdu0rtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MqcP5k+eBV9JvA116NSyl+gZ8g9nwOzLU5yZt2O3pppablVvwTtDzQpWhR0FPdqia39StBTENbMEJ/0Dde5KK2bVyLYqunmHe5aYcGsiDAZ275MG6o5W9BdU4kUe3bkgXGF6+p5WKwqs0XZUqxX5jhuBKgknsvtwNOQS9txSiW1zmz8DULFL7cvmGtJ2zWcavJOutV5NoUNp2YU9osWaCCAhtvL3Z4wwbPnSDDSmUlq5lml/8AFUcptkEX2efLYx7DSe26vVRBfwPO7WRtbAxpExEdTl5JRTrfaYEw+YiiGU1vUJ7RomPWq2MSpRKqn5J53azxieIgQXl4Wn56lJHA== 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=XBEHX0+2KS7zBTGcTSZ80+5YmSccCTj2/B5Hu9dkVBk=; b=DpUXKhMdoUzeaB1GRPyC2tc7a8TCvL6mn4Kx8idnioKn/qKhYkgEG3AUJJCwZrFIFz/MvlqXEzLab4qkZIo4hMo1P51PmFqBcQzlfA5R/i0QMUzKHArmttlkdabsuzGGlHZO33kdAbIgNO5JbmemGZuVuTd1T6INJGEP95UDQz1jFuNf0uzxEiLc41gAHI78WzwhwIDEWeO8MEf5leCsH8a7n7gL30tRk2sMbI+jyuh5u7ylck4hkho/BwxLdYsgsAlksmIsgW1A5J9xMlMMYx81nrrqLfV2XwsTPiO7MfGWjgzL3znnz4WDLtWLxOJGZW19agRCOaJmqMPgKkwRQw== 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=XBEHX0+2KS7zBTGcTSZ80+5YmSccCTj2/B5Hu9dkVBk=; b=fzgBySAPW759g6wPAODZuDE4O9eQmuIvKdgbwTalZAfUQBEn3idwRQbbH/XcYfprK7/HNHBJkuk3mK7U7qUB9ifT4+99zgSlv68BWdI09X+QPzwEOMyqQOBrs86jSKb6LQd0vDOakfta9iBAg3F0GVBJTRrVaODJ9WoxmLCWqYg= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6003.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 21:42:32 +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.014; Tue, 18 Jan 2022 21:42:32 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 8/9] net: axienet: fix for TX busy handling Date: Tue, 18 Jan 2022 15:41:31 -0600 Message-Id: <20220118214132.357349-9-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: 26b64f9e-29ab-4804-0037-08d9dacb6ed7 X-MS-TrafficTypeDiagnostic: YT3PR01MB6003: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: k+RNKoljgb7gnJfZUTQBNKnaCzwExuBNHLOyFFrCBlAdjtMjqGSgblrzVQPZbMzIZM1sKwq+o4Kigwi4DZQe6jtyONMWfzYCFOg8/q9rWxK7sbSIk7WEuy+go1egCjU+6aI8mH61yxxr609SbCoowUWif7n6KFFPzIPt92WuOy+6/HxVKkpjOwkpO0YcisnXu5jzi5pY7N9yCQ6w0UlAHvLn2WX9pqcom9sSrZsMYALgGMNCzxmhTxiGxwd+xvTqF9FpknQ8TOGwr2BI+AiN0KlKn1fga0aNWWktS+zFC0MskpZagTF7VT8g5/10PwRdGPVo/r8IgBdGYkugqOTYdexf6Ux4fnp9BT6QPpE2F/onealxWaYkjZx74xOQQajcYAN/1oo/7dBN9Svc1G7zprpxf5h5DiZqCrLN2AbjMVcc17hPkhF4eV4mY6nN6C5142UjHyA0Og79z8ghrjhOjg9d0x17PANM9nK7JBUgzI4FCT67RYP4sfEwqBeAUDbwNNtt25sKVLScPtR0kMRatsSBJ1JLlSnQ0e5JUo6j3MAjR25rI4nCkiVbG9V7Q7Jbqh1sUvkyK1TazoK/TlqqmYSUqNR7x/h8QRNaO7W5RxrPcFsWP9ObajI760Z+zUbxPVUGvyl2J/FA8Dwiac0upYf9aR1cwqK3JYhzBjVQLQLADZq7x608xZMPtiHNKAYmKuxfn1cDIxZdK2xPxyh/Ig== 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)(6506007)(1076003)(66556008)(6486002)(86362001)(66476007)(8676002)(38350700002)(83380400001)(186003)(66946007)(6916009)(26005)(2616005)(4326008)(36756003)(508600001)(2906002)(8936002)(38100700002)(52116002)(107886003)(44832011)(6512007)(5660300002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 34i/0YwabBUKYjrmQdtPlnukTnMtsQNoCTGIyWvSsgrTnPUX2Fghd7wifOnY/DQnD/DZeUQvPQ5C5A3LSYiLUuFN8t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RycrF8cVbrX0DJ0K+SSHW2hwsb5/RsJ0b0YaI+eTx8Wl7vOX9+oL76GR1j3YfVvR3Wd1SO+34TnGJ+NoDt/GvX0w7PPaMTkdn8ue/QbjH5eY9pN0sPjTz0QJxZ2sMcFQl4L4IfyU01KhbDUays1LIF6BXpyFi8ewhFTsrX7UTRZpoL03Zve3zkTHV+K1AbptdXWVGe414wVcoaHvpg7/yHWGGaVxGd89xxrPCMqfV/fPja+rg5Dsve9vNo+5Dn3lB/KxCppf+nhWcMuuWfxia9JwGy6pzSgTNGy8AG3EjlbzbIQCwtYdoLCzGsmt6471iWq5vo6HQEPsrUwebc0q1uRIXkvhMtNUT0V0CdrkTpfNtJJzJ1fL9g6LfbmXLOBFCjBfr7zKP7sknkhvdNHgFNkqCpVIOdoZl5t0pQjm/jY96G1mt7hRvXlm996O9+O+sjSDXZltaArp9CwcWTnOCz4+gxfL4/il0r6832KrsJekfF2i0scE6/IShAq3VDSKhbxxto6zMfLBctrqU4P+bPJZ0LQ= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26b64f9e-29ab-4804-0037-08d9dacb6ed7 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:32.3529 (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: RCZmjI9XvmYxQLDMEU67wZqD3GJ3zA/g6tdP7Ce9d3oBr9VZorm4JphWFnxbpDiJDmfZmxgDXnHA90ho2Rdfwpz2hhUocfXaVw1VsIJfgvI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6003 X-Proofpoint-ORIG-GUID: K2CLDWFdhdbIlmbI3t_iPYGjBwuZYM8R X-Proofpoint-GUID: K2CLDWFdhdbIlmbI3t_iPYGjBwuZYM8R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=675 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 8dc9e92e05d2..b4f42ee9b75d 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 Tue Jan 18 21:41:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 12716924 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 8EF1BC433F5 for ; Tue, 18 Jan 2022 21:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349583AbiARVnO (ORCPT ); Tue, 18 Jan 2022 16:43:14 -0500 Received: from mx0d-0054df01.pphosted.com ([67.231.150.19]:13290 "EHLO mx0d-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349587AbiARVmw (ORCPT ); Tue, 18 Jan 2022 16:42:52 -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 20IBxQUE007528; Tue, 18 Jan 2022 16:42:35 -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 3dnbdu0rte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jan 2022 16:42:35 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NiM2uf13AENh7Z2mx/4mwgTNpBZIRRaw25ZafM8yJVbJnwG9bQxPyOr9U2EBPy2C0mdb6Jj778RaYUdNPH9UT3WE9lIb+PE2f28nqtHa7BhvgAR0YNMf+a6CXxlrmbJh4XFgnvykGyG6YJULbDf3buCo7ZzSv4zKrWF7/H+odyWWb0ueYWWUW0y4gbUOtqqMUsFU9jmJ9df5Fch85qd0hKIJn2zC8v9piu1FzgwpVN7040afxzEERP3KFCUMnU8p5tUBu3POQgKBNmm9rRLhOqJhICZ8YAtDq45IViTPVFp9iqLHDx334KE+dnD04NrjEA6oAUwDT+5deTym29y+4A== 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=BZ9DDfEtZf1cRTgI1GPp+WCaxta9n1fDGueAt0DNbwM=; b=QNv+/BmScjqFRS/HwCdc1AP/x0wlXAGDWXzHynNp59WMOkcy8jKhb1C8cHe3D4hojYROgB/ztwyhprOntVBv4RMGDrPLJHFMPxsx4FDW/issn/kkhNOD8NuRO6Sx9QqbXI0ahPzFc8G2edkiV9siw1rgXFXkwTX4722wrjzTTaFiJjelQTbVOvoFyn1ax3nKEvdimG7xjmo5haT7qekZmHBNDDHOqnfF+iW3FI9Zm0AxZcpVk90FNv19d562yYjf2MO8xxY5itVeSVIj1ga7TjUvViXcDhYQYLIbW2SebswqKiqCI7iwGuiz7evCzqqNco0SPwB1hELgBhatIKjSwA== 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=BZ9DDfEtZf1cRTgI1GPp+WCaxta9n1fDGueAt0DNbwM=; b=hJQYlKjNBdtwyKpDwIYcZLWkMyN0ZPpUl8VtN6Fc9Xgz/jT6EeSrVdLtPkV14Mhx5LkeZ+YS8Af/KkQ6Z0VBNCb35Uw1ZLm+q871cbuWgzQ5cLODtuknv/o76QsXsElOPvZ77W8AVsUWdavWMfP5bcQwOZFK5Lg1Qf8J7qMY2OQ= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB6145.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:5e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Tue, 18 Jan 2022 21:42:33 +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.014; Tue, 18 Jan 2022 21:42:33 +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, daniel@iogearbox.net, andrew@lunn.ch, Robert Hancock Subject: [PATCH net v3 9/9] net: axienet: increase default TX ring size to 128 Date: Tue, 18 Jan 2022 15:41:32 -0600 Message-Id: <20220118214132.357349-10-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118214132.357349-1-robert.hancock@calian.com> References: <20220118214132.357349-1-robert.hancock@calian.com> X-ClientProxiedBy: MWHPR03CA0009.namprd03.prod.outlook.com (2603:10b6:300:117::19) 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: db01e330-fa66-44b4-d806-08d9dacb6fa3 X-MS-TrafficTypeDiagnostic: YT3PR01MB6145: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: LnjQXYGxJpjgqyiUGFgUqbWXJxaH0/+a9uH56yflNTZOi37sEQ2+wO4slpbpXMTGVZHBf5chHwOSPvoQjbHDwgjesEHo+kbZ1rPqXBHce/fmdPhasv3jXr23FqMoRAZs5FroAAz3zPNvD+TTipXwAHsUQwX0Vj3wlLHMDKms1bJgCSGU9hC1C2mlavnmElDvsSu/+sIo5Hzz/SA7x5fY7qs5V0lxrEl6PbWAepEjYw+H2OlCUI4HnjxhtU1pmBOvm8NWBEpxVhS9vkFfCNU60imypVN8WwBYzAiuV1cn05PKxJWrJuJcM55aDIYu4xdij5cDRjAT4voyOgAXtZ/tQp6+gF5Tk4lcAQEvK8T+833pG6temDGvc4yg8OLTy95ynS8OLLpO+eGJmxlQGEIvrw4DuGifnmhvq7+YyUB0F5hakCNwgLJuT2muGYbmzYQ1E5iEiJm+mZIOtaYqK8W2alb65cNs+xiwcHxWWAYu6NwxROqWawqUrssKxPH5a3u2FFEnx6HhuYE47i5vWvtfy2LiRpvrO1XmmCMePXKE8H1KxHC2rFhlhvwhkR4SEfG9vF3kuh3dpmEoCJoUV+EWrVbS6JceeWqrldRzzcldOygziA3DMzhpizZQLqLLodwxiSGNMlwnKRT0BODRybXbgl3C/OIMbYZyzoEp3jc7ziu5F9kogKYrdkXKcw7mtk5a013GTDGxcOOgBFj94rOSqA== 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)(44832011)(26005)(38100700002)(8676002)(38350700002)(83380400001)(107886003)(2906002)(6512007)(4326008)(6506007)(1076003)(36756003)(186003)(86362001)(66476007)(6486002)(66946007)(66556008)(52116002)(8936002)(2616005)(5660300002)(316002)(508600001)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8faPm1R6uXmHHU7QPz/J7O4HJDRnWjhW6exZwWA31TFemt9bWS20W6YPEyv1yZEG1u/bEB2NbYgFLPPhp2Mvb/UWBfp4Ud0dNLSHgLS//And5gTZ1cRSzxNWw3lqShPmPeqB0db0nafE84E0zVQqmTRN6fu4cYZFzGKi8K1TfhWhJqGpwGj/fsEPero3dsG12qvP4hWaT/1aDvlOAGoSdm2zkB2T7uFcs15d5hET6wRqMrE/U+79mjfV6ufianw7e/HgxYw3FYrtPDSy+/br3VDW8gU7QFhKFr6MmGUBUsnabCbklFV9+h3Roci9DJDSWdAeJ++TNICG0ljMjOLKmQ7LAHz8OlWxRqbtmw6sTCGjPwM23gk6OKeCMDXk40nKkfh8qvMtpGGZrmCCecSfrSuXdb8PLQ648RcnMRLrYOaTvUA/valgNHjlyKSbKmtl2PZHq3IDkBbWzeAd/BZtjxGd895v4mhuwVrl+KP0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ar7FDtY2pbUaEFXz2Ank2j0cNDwIIvWaNQb793GX8G9hBJQDLeAuha5rcEqQywn/tVUMeRI1OgcZzaUdO3J7MYsbfMVGsPBi0Iku06IOS+iPQ7ULXIts9xOGuibLusucuJFPRXw5o+XKxqHjHoz9PXq/vR2N+w4= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: db01e330-fa66-44b4-d806-08d9dacb6fa3 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 21:42:33.7423 (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: CZHnXyRp8Cba7t4pd/K9VTJ2yj0jrnUl+fQECevofvz3FysKPXRjSs9ROqIRtvPwkBib7mW0kptiDxt4O3zBf93HWCTiUuc/nkESHSnQEFk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB6145 X-Proofpoint-ORIG-GUID: NxZL487RlxrGCCVsKsC8tbe8nGi0Megt X-Proofpoint-GUID: NxZL487RlxrGCCVsKsC8tbe8nGi0Megt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-18_05,2022-01-18_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=673 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201180122 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 b4f42ee9b75d..377c94ec2486 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