From patchwork Tue Jan 11 21:13: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: 12710730 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 C663AC433EF for ; Tue, 11 Jan 2022 21:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245336AbiAKVez (ORCPT ); Tue, 11 Jan 2022 16:34:55 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:33144 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245513AbiAKVem (ORCPT ); Tue, 11 Jan 2022 16:34:42 -0500 X-Greylist: delayed 1174 seconds by postgrey-1.27 at vger.kernel.org; Tue, 11 Jan 2022 16:34:17 EST 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 20BBWJUj022122; Tue, 11 Jan 2022 16:14:30 -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 3dgjrs97yg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=awod8VKzLpNjWw6+RzbdJaYnhU3gSnsWPMwhzy+kmgRUHMl9bY1D5RG1/rjDx1AceZ+c2R8EpfORo8Q//Y1HJMALpm9Q+0wZy6dh7kNcF4+uG/2xPmTQAcoTK/ydBhqA1IUnT2UQQ36//9pmj/SSDB7hVRPpcqU4o0a9svfdmwMqnbPezzMYw0ERAHxf7mbFnqkUGlJPHfyWCvFyrYVeIXnB0YoK/IZ5XDpfn1/ygV0cgo8F7BfWUEZtUdPXKmAMXE+OIiCM+b+8IMWypl+12gmdBQH/YTdMAt/+XVQzRIcyc4222ajwP91ZEgyAcKiSGELw+27WmcM7nP8tusTRYw== 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=WJto+NzWYyoZ35AolrnLB2l386zWUK/Zg2JmThe5ow4=; b=H2qH4hAQFUqjnVhOyy8DLw1K+dDrAdmdRSJ8z020WggsEGBL6wJ8c0KtKErCY7ZW6K+SV3KnMpSendhlXRia6OCOy8KXPBAbBgwawydvEc7/2JvJ5lMsKT3FcPbqBLFYLSwUmNU2J/UFdIXQAF+Zsca+gmifMzjZQL9VwHRs6f+dG/YdgG3sxB1tLz7G6OJewo9ZwBXiwosMxBKgvpQOwqr33q4l6ofViy8qctlgWE5PECUqokxvzh1Vi3eS0JFKrN0PbvUfRfVFj/YS2gdCs7+7RHPAuNdWYxFPQr7rXKp9EIdwpvUQEwLunFLtrzVnxLXxymRtxCOoZG82/ekY4g== 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=WJto+NzWYyoZ35AolrnLB2l386zWUK/Zg2JmThe5ow4=; b=aN2NNluHN6q/MteQVAegU/tiVARZfinkJX+rl24ZaJI4qI/IXS2g4vfDJCJ1ffuA6puxfG/eRfSOTKScpUsff2v9X09SwryRl+pL9lfsR8zQvy6BpBvRCGUy5ZrylJK23JOvcgb1/9FzdQah3B3ML2IMhV318MouDFF0VIt0yPc= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:27 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:27 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 1/7] net: axienet: Reset core before accessing MAC and wait for core ready Date: Tue, 11 Jan 2022 15:13:52 -0600 Message-Id: <20220111211358.2699350-2-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: a7702423-cb14-49d8-7bbc-08d9d54759e1 X-MS-TrafficTypeDiagnostic: YT3PR01MB9218:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4I3rKDDc1reH/F6rgYF46q93Kkzz3zHM3p771wo+881ZBKPs/Yu/bXHllzSFP4m47TPxl3v/GW8//KhhyoVuphgLddnrItQf3zep45/6A+ra64c4SMeT94vquNFueoRgYTMu4WC0NnrVbocL/OzHfP5aVs/lZLTDzvyoD5JfHJ5NpVLGXuhaa+CEvTaHH76vVvFFM32bPB5b2+4eKes3VVucpb1vMVtMAd9l7nay+ffsWZhKl8BUgZ2ykaaQRxboAm06L2uxAsAxvJK3YQs7fwhMbMCC+ABEZiQ8LydsEckjB7SU584Hzhm4Npg6esLlnLspuaigS+gOr6LJlWHMxJ9eVZFgbT9Dc6S1HDncOvkfXGKJFir4op1eDOttJKFgDR4b7fAChBBKhcE11zgK3DtMjpzIUHjpyRJ6VudJ6nqJzGNVvWHJGNhY6oL7gHIddKq6mOWJLiyBxDm7i5Cv2R2BrkZFuQSwa18qJn/AKHDrdmbT5R5J0ojo6FKr+njMjfYabk4xznsYGMDXuBvuDDBcPIup/TXmnnpDJ6jFDPTv1SFiW+V0N2btxMFqKJH539SOlK5bbXs/1Gt3o8SVQCJDxrP66pJqeX1ZI+GxVg+ItZzVJblvHoyAS9Z4vWsEH1YdiLOheP27/Y/NtJoU5byr/cQg/8FzJiO1yYxy6FPGH606s4NtPi+Lvbf9QjDo85fiXc9nK+RES/MqKc7Lqw== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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41BmdUGuEnhFEv8v/A/fRpE21Tahp0aFiw1rMyddWVtn8oEoBjbKdZCi1+worjB3TajPKGrDOhTZPTiLVzOgLRPPivLafFVlScYPzSq3RrVHAMPmxMcwF6v6xCtHcv8vnL70ONm5FAP3Mw23lrbqJiKTAy56dqlNozRop8x3LrM6/eyqVjBmNAHySA0xzxNN+l54nqhkyJ6PMbJvrOxSgzP8jpq9M8n1adbSNCGEWUnJKVeCmSG36HO7UX4MXCxHyMzwqvKIpEJ+jaWh5GcPxMSd+INlbLZdWncOHtAaYAia7QMzksnH64SGx3ekluTYqkD7II+iCwnaswEFfKT1irQmScJ6ldZhyI0JDv2Nf/1z8MDkXQwMLK0P73npRP64Lwz1JMAB36UTddPYOKcoxvk/wNpwSuX/2aIbGpPWBy3GhLev/XP/BRGCaILEzzlTAnspwXlEizN1FXPt4nkEpN2gzMO7qNtdemqAqiV7H/Mzd0/RxRf48VaPTG3uFRLDmjcakriVBW+d9uFG3UPW7Jue4EkHXLh2JWu7yg6VOD6Kf7xvedqTWZ8Bak/bQfVkD8Owc7uDbmZJgnRhJ1BhSrqWVCL8X7QtlR1TZNBl0R+/lcH/+IL9C8Put4LQQZs3Bfa5s7AHnFsrlrOQes= X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7702423-cb14-49d8-7bbc-08d9d54759e1 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:27.8541 (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: yppwRfdaj+9RvWw6abXienSW8CgSn66orp8/Rtqi1CFX+z86UIBpiqRcnHvKJGuusnzikPdvEB7710TsGmEKmtkdcPhOSehoE9ZGgI99NGo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: 3Z1JTWY0q3MHF3R9W_T-S1Du7yksMmCd X-Proofpoint-GUID: 3Z1JTWY0q3MHF3R9W_T-S1Du7yksMmCd 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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. Also, 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: 3e08fd4a8298 (net: axienet: Properly handle PCS/PMA PHY for 1000BaseX mode) Signed-off-by: Robert Hancock --- .../net/ethernet/xilinx/xilinx_axienet_main.c | 34 +++++++++++++------ 1 file changed, 24 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..f4ae035bed35 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,23 @@ 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; + } + + /* 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; @@ -2046,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 Tue Jan 11 21:13: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: 12710735 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 D982BC433F5 for ; Tue, 11 Jan 2022 21:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245366AbiAKVfd (ORCPT ); Tue, 11 Jan 2022 16:35:33 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:16703 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245384AbiAKVfb (ORCPT ); Tue, 11 Jan 2022 16:35:31 -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 20BBWJUk022122; Tue, 11 Jan 2022 16:14:30 -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 3dgjrs97yg-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGX2L1+SS0Svi2p5qlNdjkxjv+g+rmUA0Dde/KUSO3WdhSVgJhg4Sr66276uQdUqwhelVY9Zh/PxdVxKvTiKZ6vd3mHq7yc0gJYl6SemADYRyM/fh26GalNm9jH56ebLBA40AO8uup7pnm+N2rX1YEd3sPO0KEgYvjUp0m4IGo89tAP9m3++lbtJAWOt2OAnJv75Bi6nu6VgPhEQ+Q0EiYgVzslmr6mxOoeQOsbolMvtJUCa2OavguZWx0TB2iYYOsZW9y1/sdZ3+Jh6coG+6FYi7XSp3HGdIFO+P69YLD6UGKKt+yJOXNPLWANERwBaW0VAFqWL5fSZwKV3N3uDtg== 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=EffuHBm1xJgKh8gb/tCRUkePQDjBrh1w42qL8Kowrfa8s56cxZpW+oBHG0OY26JGlM/kymw/c/aZfouX8LpSCI8Yjbdk3HQabfnTDrZoEYc0fePWL46Q0CxtmKL8tIY6f8ZPvJeAE7jouTnhG6Gmeg2ehZfiYphIEmfec7XStO1YNpySmtgd2Ql8cW5/JFeCSO7GxOR3oileQcjwucL2G9OAduZeDKkLxvcI1inqRKBpD0HPk3jZ1QDHWhotdZpw+0yvyb4MY6/imgC3Ik+5b0+0opLDBoSgR/+Ys/qw273xAyOWQkVthJYveLMyvOG46mxKGJaZ+bEn9epCtqYwLw== 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=qJnKW461+kEN1X8SYnFDwVokpuDW0ghWHSdcFY0Stu1qS6v3w4bRmVsPPUFrmErL7iVzHnbp6zEEgBO7tso1z2fRw+2p8rnsKBZDPWIjJ9Dtsk7eGZOdGgjoWbleiFoxcmA5NM6rb/fiFUgb9AmSrMM9dcMrNaygCd4S9/Q/Ask= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:28 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:28 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 2/7] net: axienet: add missing memory barriers Date: Tue, 11 Jan 2022 15:13:53 -0600 Message-Id: <20220111211358.2699350-3-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: 2fc4e2f5-b5f1-447e-22af-08d9d5475a4f X-MS-TrafficTypeDiagnostic: YT3PR01MB9218: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: S5oXCrwXgpw+/Y2ITpx1LF1M5WAzmtve8hHAMJgxy3w9z3ia3K9mbzE1ZY7/REmXtDf5LFu3AlXH3G5a+zpIU1t47WAcRuQB2ro7l7uRzhE4l3t3mpwRzx7NcKtwmFZML4UEKsmeJWoFVNaTPMRrepp+uuK+RgY5o99RJf/7R0DXIBIwthwvuGDvDWe3dhTlBOJ9/qUYKO+Fu3e5WFXKYSOBQBX7Hw481VGk0CCot5F9wPHyUS4p9X5O6ttc1CPqraOVTzaTwEzUlrpjY9HnmsN2/x2b0E4ipt8Zt/xy7n3NNAxI6YMXnU7+40E3mCQY+GR8mV4DazB6p16+RXkYIXYVcCcrmRGKZgRgA6LC/xltRoy07gC73CmE0+B+ur9CJDaxaevbkRv+7cergpnK/mWFX4jIaYYS2X5iSCehETeyxjLVLW6AuR1510RorGjqdrLYvW6kKJuX+0ZbaCqU9j4qNqHvnXDEyKEeaCJp4Wdf7YmDCQaD4GYWa6rn3Wu7SkrFG/8103K0CTQGWyMQCuPtzg4PBVNNlfrYIZjLQKcP/zxNfWV/64vXh7940ZGHtY42Try5RCYW7Uqm31P7eybHvdxbXT3SC18QTTsJ/+Azy2xG6TG2HvxTdTJZEaCp0q5cr2x77kwSHn9bdjFQQ3NLE9rJSyEdplIOzspN9pCEuCgWLOn6ka08X2LtodSLTyr/k+OQK7momQFH7oybBg== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hW32TeJolecs/m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Fhn7PtEQBckiZMTqhrK+nG35Mgo2glEKdKoV+ExApr/JDsGSas4lysjgyVFHIs7vBqy17RShEhkqI/NtehZs13/tZKrheoXbIdrY+CYVIMX13Imzh3//0TKXca7xKwWkzt5CdZmmwJHOilEd8LfZUWXk8DIjtxxid7hoTvTBUxAINJJ+U8VS9/DAu3EzgHOjtIswkTRQOiT/3691c7bTN13NU2vDYCpqEKfqSnZiLLAKcd3HXcUMpeWQCOoR8jQm9o/tiJ641fSGRaIFVlQsaEN9RvFe04BDyJYxsCU//hTTEznekIPnNQgL0BfTUsBw6khnsAu7KGU0tuVLjAI6kNZX4zJm2AkiKs8KB722Ab7gcT4IAOOgPc7jrMvzQaqPNihQvtMISh7qvkfNjI+9BHBddwprKaWYJYHpYNAA/oFogU1tDOoLvtIl+JTD9brAEGPPuTkszZpEawo8muK0QW5h34rvbtR1BDuXB8IKWHFx3NAOrRLf69LC8YQkKoD+AcyqxU04fWEunApQ5L5Bm/nrdKKsPfkxfWWnC37woH+2V0rmFhT+zuTCQ25oy6gfDC7cbQRXg== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc4e2f5-b5f1-447e-22af-08d9d5475a4f X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:28.5277 (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: POIGZwB0dBT4auYH3z3e52nb7pyxTPwKBGMDWFI/chzMdY1QX/x1EJGk4hvROOkFkk4p2mcbrs7ZEO8j4NsRRsw1O8gxcVg019NN6gfSxZw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: ZY9ugOZKPcPlUb-6EsTJ3qxeW3OXM5WB X-Proofpoint-GUID: ZY9ugOZKPcPlUb-6EsTJ3qxeW3OXM5WB 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=635 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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 Tue Jan 11 21:13: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: 12710732 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 4EA8CC433EF for ; Tue, 11 Jan 2022 21:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245373AbiAKVfL (ORCPT ); Tue, 11 Jan 2022 16:35:11 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:3485 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245360AbiAKVfG (ORCPT ); Tue, 11 Jan 2022 16:35:06 -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 20BBWJUl022122; Tue, 11 Jan 2022 16:14:31 -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 3dgjrs97yg-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Au3PoaguC34UBgdwzFqySm20JxIKOkzvKJNE09JljLKR8lB9alJ4p1t3jFMVZGobOBEf+myjTXN2OnwZ1S7c4fRkgI4pK3wkctdQovJtee5s1yobjDv2SjZFCRuto1Bun2fw5wwUjhMxiRQSosdCVrtTAwd1rz1A7StUaRZ3wUkWW57cRInPrvAS20jxjKNKuJCeGJPMvz2cwWB/l+2bxWOCItzrGCnH0piNXpAnObaSMyMYzvR+L0haM5hJSUOFZKbZ8Ji2v+3EdKIdzZsK6YIxDWEtekW0Ncv7rMRZpwYtfqJY7nLi11c45zXHK9d8czkzZf17tiL9I3i0kVNoyA== 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=P+Cfit9k3EzjEP9tXDu44sAmgjZXLhYr/QMhUHpqyX0QUeS+Zn5cR2OT/EalvfTlI/k40VzAJ4o+GmaRHgTnD09SQh7ajA1ZKysB0Z6MtZP6AcLO3MCCcebbqtUrSDZKvh5veyf0YXeWpN1lKEwei7wS3zSGQbN6CqCGrdW66WMf8z+ns/YSJzIzfMygp8DbNk/ALGPn7Y/4PeSJEmu3JKLDptIF95+SMZLdn4usRULukZ+naiJ8sup11KoN+fCJlmQdGFnBjJin4stHrT4GsLjZqsT0hROLZ+zYPSsP+DfGXV7r+1EHk5Cf31zurMsn4k46UVFEfgFQyfl0UlZCBw== 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=kNSWBdDQNXolSvtGKsY1xaZhvs1sh4zM+rTEwKBAqFg/PjZ9X/Sga2E5gwTVIoQ1f/nfEImfCL1ANkaHA9FOJLucujZ0ztXnyRTnz7CwPL5EFPy9hIE9rG4L5KuA+gCOpEWZ4BJQIz3zV6L5/G1NBjZb0A5fVc6HMvprxI8mOQE= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:29 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:29 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 3/7] net: axienet: limit minimum TX ring size Date: Tue, 11 Jan 2022 15:13:54 -0600 Message-Id: <20220111211358.2699350-4-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: 28014dde-4842-41e6-1be8-08d9d5475ab6 X-MS-TrafficTypeDiagnostic: YT3PR01MB9218: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: YhAY3NP3mYyianmZHhOkYsUW2w5r9SHAlwmQBxb+P4mRTjVKiw8aVhq5B5mGhd21JHcLXH+OnIS8kBFZiLuscbJcWzfWj7iNJrHFi92lsLvhNQvlwQW9X6YS66jc6CRkLc71DY9Vi/1FAsOCUy09kZrYPOtYIoWzASKdia6Rcj6hVwkC/W1sbYPsaqLscuCj0sr5CAO0QkRa3ej/qZ75eZM3O5fEvJLP5Fee/Sm7lY/UQisQQjUowxTwOQj+CsWixQNmU9ZdqXKTjdFN5wbSzpqECN7CzJGKb/Ge8wkY6Bmmqz3o2KVVWLkkxCw7TTPHXI+NJTaLUbHIlX/QdoD0zSR6F/At0u4QjRJf0FBqdjJ6+S3o9ScHAKnPWiLq5QPIJV3ezDNkLyzn9hzgmVG6tJ/Q4D0xao1htJq5y0F2f7czgDoJ9CPPvJ9DO1HleaZti4ngVRQmf11/zg25Z7DnAnWJbywtKba1Iv288GY8Tck9Z/nZjBkkimxC33If9XMCevw/nW4BAJV13JG9GO5aIYkHE60hV+w1RzRtDcU1IaSvcU4y6j4TJchut+gO6v3/DpqyP1lyssv0aSYDLIqM/LGHeF6Rx4HqVp3abJk7LE7rxwflqk/pDt7UvRU3Q69xTO2QNiIsbHwCtK1hDNutscg1fmWXpMhe73CvlcRzUJHI4Czb9Irc2hFWGE+yzCG1jsNHMffxNQTYDMpd4sERWg== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YPox/3IM24KviQS9HT1ipZHxMBIw0vdipqF2lvOxeNHuoSIuLQyxMGStYIvzIGk/ce7DMAjdXO6R0Zuu1TySmk4HRklQnJviHIhxb1eq8gphfjLJRFpBWUW5nr7BusGlvyKNvh4AQtW3ILixKthrni50w9jxbSl5fHMXanhcdrJ8b6P+tykHLNq9A+dLEdPMKrGOTZf5AazWNFps0KhJRZKLzHO9hWfGZ9aF6j0zu8iff6vKGBL92Kec3LaC41vaWbGj85SPXjBgy7bhz083/lhGzPwKOzBZqPxdC9CPo6xHF21f4Nc3QPq9nTCiyqj29h51UBjaQDZvVd9YJy312lT89YhbNlKmx1az2vDUylIHTZ69JCPismQZUa1n/PRBjcfAauTKhS72SbUbRHMcKsLpoOz0t/aSIJpnPuYIFO2VOQWBgZa6c49DZdeS2IWpkY3wtDVKjWQKJF0aHpoJi9GJEpII2oZFI/2J4LTXCkbn9qNrfiFtwV2mbuNQBD3IoyuZ/3wj10pCppHZl5BE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TsNMX6E85Stb9fPp06Eoop4LRCzQm+zsxedV8BjXdAMnEM1tg0aIHw+xLFNDyY9iZ63r41hZcLvAQ== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28014dde-4842-41e6-1be8-08d9d5475ab6 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:29.2645 (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: p7pE3xRqrb4fC917/Pk+9jEDS0HN5aEvTJd/962ONX/7klI1gYqGeM/l8sgDj56YC12ltIpF+9oIRWaBP69frMGYV8U+IWoQn9IhHZrmsiE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: fFEjHdhzVybUOKIa6UjrBntsVOTilgEp X-Proofpoint-GUID: fFEjHdhzVybUOKIa6UjrBntsVOTilgEp 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=682 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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 Tue Jan 11 21:13: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: 12710729 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 08E2CC433F5 for ; Tue, 11 Jan 2022 21:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233586AbiAKVey (ORCPT ); Tue, 11 Jan 2022 16:34:54 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:36885 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245492AbiAKVem (ORCPT ); Tue, 11 Jan 2022 16:34:42 -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 20BCxNPm017415; Tue, 11 Jan 2022 16:14:32 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2055.outbound.protection.outlook.com [104.47.61.55]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dgjrs97yj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrSvmFnQe4sf8/R3FWoUEEOVnnhW+D6+FZDLiyIyvNVzWjxk8Mpq6TUFhGNbfW7E47O+GMayxB4n8JTb/vFS4JPynZ/eHB65Pa2gl2G5l6xGjwtXvfZlH2xLoZiyshQxEybetKLEznHHHnRr3iuSx2mJvMCUD9BjijSsaYY8djUVY7giIFHiQBTWAyLCPvt6gffPDeBlrvAckYAbYV2Eod/pN2TiQDc/D+FLHginuFhFcxjdB1aEIpRbDBj+jc26dLPlat7+IxjCLgp/OqpUYRJDWAlPmBhWxzFBEd2Uwv5CTc0arf8VDjlyxyobP1P5/RH2RATur7cgGnVXz621fw== 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=LRzNh3MyxiHAT8IQkqjHD5TirvmtUNYqqKTXOcqzFlqUlgbtomN51KI530eNJcQGGfyu8wbWUvCgbIZE9JO5k1TUoPCqRtpsaTe21EscGSQjonCSL6T+DcfPfIqYef6Y4p0pXjQ+rHMM8ALockTsFS+Z1n1NGY+oZKe6PVC893GZMOD3zLYhHGtG981BEldwtKM3BDsLmwtl8nU4HCv41P//nkY8Sbg4dTMHoNcSl8fK2CEVDuwY6EgSZYVynA1fEknm8YPZRmdd4TaWTjGv+P0uvjDFGuU/TdfRBmQiLpUobhsSaa9CD7qX8M/ghkhkEMmDmrrdaDEGBlF06/CooA== 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=QFYAbvAUrIjYM/grYDg3gCtqKTvc4w84/0DOIoLpKnr/4U1VvnP39+8VZrbiPcDN3qHGvMD/f+ujXRZUD73UXtoEmx8TgnJD5pjoyl5rQQCxvYpVISs+FiyKQGjLWXB+Niua6UaEdXem3X34Ln9ihtzYW0go52i/9m6xfOawr9s= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:30 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:30 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 4/7] net: axienet: Fix TX ring slot available check Date: Tue, 11 Jan 2022 15:13:55 -0600 Message-Id: <20220111211358.2699350-5-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: 67468009-5c23-461a-56f9-08d9d5475b26 X-MS-TrafficTypeDiagnostic: YT3PR01MB9218: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: FTwNYgFvsyFq5maqf4Ogqkz5z5wM842Z+V6ezYomNfaytAYK4HBXCmQnQwk5z5e7y04fp8AV/GWxiRegNsuRh2ds/2pA7/qbMfbWvbSjFfrZb1LBUc8iLkK7AjIDGO4F+Eze6OdcNSUg33XvT/WhNM82iUN5EOPmtqo/HchXJg78UEAQsrtT7PlWcpW0Cw8b7XviRWVHRuREk9uaE7CccaMUPRFyl376vDSXVjTtByfXrfuj7yBpjWL6xQL7SKQiy+CWn2VY7CsCNi3lMWGBptKsV5ofnptnnAkZb1LOPeCTbtc4ZNT4K7oJLmRpSNRHihiFPs/Eg+lKI+WQ0TS7JO4J0EWqiDQhUFA5TdhCRQ+aW7Y3xZM6+yXa2gddEiwIGwf0ylpR0aAY+ir9NG17julwqF0a83mlYtEbeAl8sz0pFntfpZJd7j5326LEGmqqzrTRmj4FmMIJqz3G2LrLn+WsXJcXKWwolVX4UBmeB93rQ1pCeBxjIbsz/kelVCEBSoUzsR9M1g9reByeAG0Y8NUZ8A56fFA3RqXAv2LFezsBoeQb1ZZdmpDd4elRu/JgaS5eq5zMLRgZnSz3ei1EYiBPmR2qF1uazfasRtrFE7K81p4NfMdExzhKi1cF2N0hwcTQNdUS5d11lJ3zfPU7035gCno2vynZQuJf+HcmQk9HPBxo8P5e4uCXF+O6u7Ig3Wl1/5CtjrvcgR0XGVjzww== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4gJSiRTsEmd0UuZBZ0C/Nd8WWqMVU7mg7DSwK3k3i5k+YJ8EIhOmYcDhLs029Sr4SCjXXHPnaxqkw6zy2N+CHNZFvaWkvdXwF1x8bKrzzyNUIA2zQJJ5U30B5AXunxxikX9tRUIkw+JURniKmf168SkDs+beVXPbeav7gOaPWwSoezg0nhMEuuLp0R1JHBzhBW3sJh8/R6vm71flhElSsdF/Ctqkm60YH4efYEI/9txJyLPGU4ylu3wzjE9cXiQtv496RDEnMClnpGMztccQnYFEjTafJuzWHXxaq+7df+IZv4fn8Paau7pdm8L32QnjqMhhou/xtyGt7SNUWeAEglh9nbjJip6hkmwxxj0Q3DPNkcWhc5I7NFj6sIA/CGqvZmW6jkxj72Z2iSxLosl+5ZE5Ad4sLTJf1LqRaoOrn9pbm0CyFuePOH4e7nl9eJ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kcBkgYkkGj5bYSRpbTQ82BvCdRafj/S58PoGxjlw7eQN1Uzp76KHOOeAn/V7Q+n9e8x4hCrZmywoKhqSFjSiU3EXclEMuuKWzUa/rrxGpJFQyDaMkfbWJWlL0yfFDjCtaV/IYBgVgX/RzbVsU0uLtDWQ== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67468009-5c23-461a-56f9-08d9d5475b26 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:29.9831 (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: CEd2d4vVYSpGF2ocNe8C7nR2BBb5Z1aCsdtjKKCVpXEtXLLMt0eSyqduEg9xgx6AJ/Mg4kHSChTjnj5pkoLbWNEHalUP1dUWj/okFL3UZaQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: TRyAKUHtD7JWCetOCEM1J-9voBQileAY X-Proofpoint-GUID: TRyAKUHtD7JWCetOCEM1J-9voBQileAY 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=651 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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 Tue Jan 11 21:13: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: 12710734 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 7DA08C433F5 for ; Tue, 11 Jan 2022 21:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245385AbiAKVfQ (ORCPT ); Tue, 11 Jan 2022 16:35:16 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:3485 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245370AbiAKVfL (ORCPT ); Tue, 11 Jan 2022 16:35:11 -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 20BCxNPn017415; Tue, 11 Jan 2022 16:14:32 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2055.outbound.protection.outlook.com [104.47.61.55]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dgjrs97yj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GCZ3PWsmrHAUR3gJNnwcw6DFtR5qpiN0D5r5N1w5Ig38KBCRZ/6xHkoQyOjGbxTbaursrvO8Iq79v5OeyUK8teyjl1iXmWRmjPPEt26R+lO2tJjiCcBRXF25NHupBZbEb5pIM+qxuxHfRrTBniee/Hv9jJS4a845m7QuOryvKWug8jQaeqUZJxI6p2QD5otbM6HgfZBJ8/BP2uDSj34bznk1nG6S0oeGFlNUw16XV4O0swS7hYkFlmOO8+CUPb8ocyEkYBEIMfWjiWl5RD50aOWSAMJ1vaHRrD52usJh5xow+7MeFDyNx7NP+ExXFPSwUivqvI2GQDkX5ww+HKp5LA== 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=XhXtzBSatS6Ls/xeHLoqfXRgrgERJ6AelXh979WjAODTGyggOrMDoNBnSqsUPhXQHWfKM5F9O8e21Ge2BWWkAMFhuKxAWPVysQLr8txneo4jTAaRNEtaTqAJnkCnjU8L1gOxa1LnBSAsVIjWdW5uopfV0WazUL1JpQL2O17onszQoZAKwQ8u9LPIuvXfWXnyl3vz5V/HfJLUJ/x8mWD12uULIXmAtU7EYvMyjZ9KH4q0Hm7uGvRU/P5aFWgPBEs3OcLR6+NrFR09SXrXb1aaJ5wCUQUbZFIgbWw8BaUVnYlOR6eaIOsh/GqnkYTmK5YBSuCy3+dVqcocr31gWrzmlg== 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=xsDC7pIEwtw7wEDL2imU89UU6cXJElrU+Xle0YQfXMXwTdPos3rA9IX4euHGToo0QGmUIX+Wa0KP/NnJg8F/nXA615nXOtALsGkBkTWWxzZk07iIPwfyQsj+u8sVyJwIQms0IQTYBDKZu6L9rDMSOjT9dD5xIT1MFL4jU3maI30= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:30 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:30 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 5/7] net: axienet: fix number of TX ring slots for available check Date: Tue, 11 Jan 2022 15:13:56 -0600 Message-Id: <20220111211358.2699350-6-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: 66ae3126-4971-45b6-5d38-08d9d5475b94 X-MS-TrafficTypeDiagnostic: YT3PR01MB9218: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: npC3UfPe/yIdazx2DSYoPU0GUzSNQ211ql1GE2d5RoqASfGG+vZehdX0u4GjB/gPKjPoTWxAxSztFsNYNDZKDY11TgV958Pfvl4B+ghzhyjCXL2akujQZ2D0dYQib/5K/5g7YVbcu7RMoPDwoVcYn5wTc1zQjDdepItr8gEXTK1gltBpyVfx//4BP47n/uAyfbnBRsfRWajjEAGThl2mfwkvIAW2l9iEYINXj3EsvIuUXp0EQQtyEjj+SJNOhU/fzmmEXDPkvSdUk4n6b+CxoxKfNaDC6qhLT3rVeeC0CkuRbsiaGcPEqlJjgJzCeZLucTcVlh+wECxUgqEwRhJVC5pQcm6Hg7wf3lnEabnnr/hn1GaHwJomRwg1cUdxZm5Cu7xDZz2aFg/voyi1xZHxIZdLzOGiRXVazGFW9OSDPLlAXHw1NwHr1ZreExfp8P9xauktkdcEtPSQC7LwRZGMz4pUQjy63Ch+4r5TtVJhh1GxEwjp7tW5f96vfFapA0vNMz7udVPCwuomxkoPiUtUfPZeSbrUkkkdcN7hbXiPRVKHxbl9frBPQV5AHDZzg47U3s/jjC/sdkGZyoOtj9LJ3u6WIH3wGSo+gs4ZE9F3sl/SmavQQd4b8G/zNgFheiIOz207TuH9AUb9tmiL5Y1bcFleqcXF6Urh+vlhsaFig3f3FievpM/cg48sGirC+qkmbrDUQznhKtnDeXQTWW7pmg== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DWupSwNlRNdRoZqShiVbjFWuwmIcE51Z3ZWkRSMi/MgoJEw1qFZEMAI+QX1WgXTR5gBzFRDSXC2Fvm150GEsjVCUKTFzOLxqaomKaogm/gEovfV4jsc9sdY6YPiZNMCzZ04uaLYFPtpD7W3WPbe+gpCEreoRlLNf+j3VPfWjz3cXntU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GSYXij/7cZP10k+hKBkgBFsXuWuHmR9S/JnXcDSieNbu0So53TvdzwWsP3zIXYVoSpZMcVPRnnT4oZNSxkS2eO/unFNdQhRhYEWgURxBknIY9r5MLYerT90IpWeaHpy6hCModt0C1ePZqjOYD1e24WhCBHOuFSNkrZR/6ahUHLBtWjvLWKkL0DRJl9YNEgxY7ZSmEO90oZ3E6N4YNmDCRNgAh0nzWa47FW0oTfaQM2R3802W5tlNyxXK7YQS1MB01Ri4Yq0peHjQ1rqdpb6RPBhhDyTnHhSgAuLB/dBPgaQ3i/Gi8IlFTNKHqUg6+8EX+cnQ7l9TJwYoF9qU2xZRQ1lxwUhtz1tmn0Vh/hi7LjsQ5D0wC8jAgiP/AsaajV7UGhTJ41FfG6UUN9MlhCkjkiOa5uzAKBiSqi4/8S9MCJcboVax2k3SI+77j0Pg== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 66ae3126-4971-45b6-5d38-08d9d5475b94 X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:30.6885 (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: CEsbKtfTUGu38Es7y+I02+TiPFBqjoELjtk6zHUmK4wuMzWaRJHj7KI60dSWehtQ/VmrPsdyqQZeP79qh5ENHmUmoIgfFjDrXqGgO/x/ROk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: uAmRV42trP7I_xqj2aoKvOwfLBw_uwz3 X-Proofpoint-GUID: uAmRV42trP7I_xqj2aoKvOwfLBw_uwz3 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=888 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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 Tue Jan 11 21:13: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: 12710731 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 C689BC433FE for ; Tue, 11 Jan 2022 21:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245353AbiAKVez (ORCPT ); Tue, 11 Jan 2022 16:34:55 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:36885 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245503AbiAKVem (ORCPT ); Tue, 11 Jan 2022 16:34:42 -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 20BCxNPo017415; Tue, 11 Jan 2022 16:14:33 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2055.outbound.protection.outlook.com [104.47.61.55]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dgjrs97yj-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VraCVA0IMvtHq1ynw5HD+215j2pwznNw7VQHsYMa5UIjgVaX7ZsxUdjsfDWgYfQlAuCmV9B5v2nMF5aoQx3Vb6e0buhr7AM1CW4G405GVDjcPb7O0bBt9FHhuJ8cZrKzTIYAiqBi+/dEhO59bBM6Xrn64NNgiHN3+7CfG0OkI5HsjHSxXXQW6DMg8E30ssz24sDqDERogKPX9n2YXwa6E9uGzJ5ovSMCQEV5hP8hnzSlydFeYaBAf6QKmn7OvjCBXdjz7r+zyV8T49c+c5Dl1vuM7/V8Iw/iMbGEfvwrK+lS5T5YcWuLgzwQRLulIYPJng/FO3ABhc49eXW3kVVUzg== 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=NELenvXBA63kf6Snn4EX7z1qhoNmazk74Onyhix7id4=; b=ZxxOkrBFDiXWxjkD2nNsHzIvjLBrOPSquweEhNiX/4pfSsTQKnyKlrwj4hHak3uyDaDJsyN1GQpnwWxmKec69Eq5mHlPa358pIS6w/1HeJEA2pB1tTdicIza8/kKT6qXsrr3Vtsg3Y6+D0T1x8zwSe52SMee0FYN3P/dtqmY9at2CfQfIpgLr7HAfKH6P00kMQN1JBAQF+zvjVI629GqOx4uzeQirZWrj6dkKtMBS9po/PAsaQwP74D7GwvMwSAOO0UdoQAMm1UjZOJq5x2PvLQmULLSxWBe2kqTO3HY4DFPOjWnwdL4txtHblmokOzLWv/g+4rvbU8K2+sP10grvw== 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=NELenvXBA63kf6Snn4EX7z1qhoNmazk74Onyhix7id4=; b=xZ4JtQ2rF3L+DJATHX/+10EW+3S66f2gDTyxxC1FLD1hHr3P2zyuS7r4ne3nQzcZqM3aQ3I9yB/e8NvPUTZk7BJE51A6CpkIvsVTjZ7JjeSdcqDhlT/IeDIkAQbLCorIp86ibvJFNRuYRvoDxkS+I5K5lXv/b4h7uNTGs64WFzk= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:31 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:31 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 6/7] net: axienet: fix for TX busy handling Date: Tue, 11 Jan 2022 15:13:57 -0600 Message-Id: <20220111211358.2699350-7-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: bce36c4c-56d8-4304-a1ea-08d9d5475bff X-MS-TrafficTypeDiagnostic: YT3PR01MB9218:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 40w3suxOELcyseHgXTxj6tBaPMmeka9q2gBT2Pb5SeBcojFS9jR8068OXD4tUGbzps5VyXtWQCdZUDynAt7UQmc9Dfs9OyZir8nz8Uo+rzFVqKCtfQvh7DYON2A2e6jCeAlRekBXWDLxZRbixrSZ/r5ZYxddlbOq55s3v9VUEGtsKs8zOP9o4VmdqXtyQbRRxxour7vjsADBpKlgNkrhXrdNy0HjVB/f+XRAJqWMm4vu07ogM9fmvFNhOVhB8if0m7ywxvxzZDxLGybtqtePHZJ5bLL9Xw+OtGAtW0CmrUeoqcH2FMis/uTSqDCotVKAwgmB6Mg6kyKGnszHTsgcUDRY+w83X5n9kfOl8FHAICJzJrDbK915wQzSNqWLHaeJ8SYiZd/jt5h1lQy1/rBqX6OnaRfDzdppvYi/VWikF3C/Xp7arCSY1APUWssKQIk9L/mUID+bFc/0kGtZWPj0X5ilrVahSdzxDSAPu3oPgfocA33ktyUtELorMauhtQM6NKE90G04F1Gax6e6ZWI0jVykT3QHyQL2uhDVoaW9hqsIPIGcz6F2qFHCJlmoD30IrTDfwcS8LC/SrVrj38sXmNAl7mv4ayU2X/EIUYkMuy79PAIQ01ZpwRwFCwZrjdoO92p86kXBrLNwIT+6T3mYYoSo+q5rtELixot0IkcQfcC9KKuLSvO+u09DWpe5fdKd6hEQF2nkBO7cNhLtEiVpYw== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U13ecBgl6yfNeutYA3fhLKbyblPXZIjYI2AuAX/nN2KS7doh333X27gD6DnmoOKGS6vosGdnpJ1E9lk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1aMCUXEQaJiyGubhppSps/CKwITpwDct9qPC9b1CIA6eezKMJN1Hm0kAueR8DyOUNgMjMAGf44bS7Wf49RlFhRhHJti29tWJcP2EMmOGupU7NQeIW86e643LPLMh4VqXvBcH15FKsTgoz5mkHBoOAN4lWBOWFYUx/JHj1qBYTc8KEKR9VEkIAtLQbJ9Zkx/8YXQ5jEwJpR+62CF7npbEkUC/D9EvhlNJp9LgYBqrKTytE7t4qIvg9trFDVod9jbxKI1x5nfOXtxlPjtT4kprfSK8LkoUo7iW0xsmmda8/OHqsopOf9GKa003w4U61oOXC0yRauYePEHQZe3DvIQTIwAVUpVaGrgL+BhYVhHpQqwUkIErZJZPL0Mb7lAnvhtDdE8kGr/bVB/9W3vZJLd9gsHe5IgJKHkXAsRFZh/dMW0d33pPKVJibZK3X+ZWn/YaUF9y9MtzHo37bAb3NRqe4aRPeEKC2GZ371JDow/affRsrO2bsC6rX2WNa9kQVjgVYbW6203yBQ== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: bce36c4c-56d8-4304-a1ea-08d9d5475bff X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:31.3915 (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: tXe4ls0O4ylk3uY1Rs/atMiQGnW+LBIDS7oiuMDYCNzDx99+LjRdZhdOfDDWFaQsiMYJHs4TtWAH7LLeW+itVqXbO5tGUpQxd7NWg6zZTqo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: z10hEzwEisIPnPBj_E5qdM0lm5ZcaCIy X-Proofpoint-GUID: z10hEzwEisIPnPBj_E5qdM0lm5ZcaCIy 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=795 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We should be avoiding returning NETDEV_TX_BUSY from ndo_start_xmit in normal cases. Move the main check for a full TX ring to the end of the function so that we stop the queue after the last available space is used up, and only wake up the queue if enough space is available for a full maximally fragmented packet. Print a warning if there is insufficient space at the start of start_xmit, since this should no longer happen. Fixes: 8a3b7a252dca9 ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver") Signed-off-by: Robert Hancock --- .../net/ethernet/xilinx/xilinx_axienet_main.c | 85 ++++++++++--------- 1 file changed, 46 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..2191f813ed78 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,13 @@ 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); + netdev_warn(ndev, "TX ring unexpectedly full\n"); + return NETDEV_TX_BUSY; } if (skb->ip_summed == CHECKSUM_PARTIAL) { @@ -821,6 +816,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 11 21:13: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: 12710733 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 89E88C433F5 for ; Tue, 11 Jan 2022 21:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245377AbiAKVfN (ORCPT ); Tue, 11 Jan 2022 16:35:13 -0500 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]:12394 "EHLO mx0c-0054df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245368AbiAKVfH (ORCPT ); Tue, 11 Jan 2022 16:35:07 -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 20BCxNPp017415; Tue, 11 Jan 2022 16:14:33 -0500 Received: from can01-to1-obe.outbound.protection.outlook.com (mail-to1can01lp2055.outbound.protection.outlook.com [104.47.61.55]) by mx0c-0054df01.pphosted.com (PPS) with ESMTPS id 3dgjrs97yj-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 11 Jan 2022 16:14:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CqZssIal8dmzw97AFkxTdgRuBH8kXdLY8/822a8cVIcKWWrldJqljd5N8n6fZODYavxPG2Py1csUG0ZQsnWjdnpkub0kEvl0sryqR5ew9OqEamCOLs/aXia8a0KS/sK8MgdKruLYzOPOnUbgTCqe/7W3j/bm5LkPmfGgcsKO88/wL637M+cpmRjn/fiOIPPGz7mQ5BBe/6H6wQaA4upQeyDGP5FL0pj0zQYv/sz7q7oYt+SaaHHbZpxIW9UwfbEUPTJsxKfEn8yz0BfsThaaQl6hb8uavAa02fT8uGIjYQYa7mnrestGtTraxV77Mc2Pc5rp6i5FwylmlEZVN+mC4A== 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=DeicbdEHGQnBrz9PhpHkqIG6ypNQL1pi4vlQgh4CCJM=; b=aXDixZ+PuEtV+OQD4A6wMk4pmQFJpl8toxnBcOKwGiwVF2vKHEy70bOM7S1eYdVvV4bWtm96hkFOM+2D3m7p12sicuFvPRxXuAAX2LT1T2rnZrAP58Szh2aFpYj7NKcx2YdiQcYotNPcC2+4f3sRrEau/n5qD/qiYUNUoaKMeFHWT92c9DldviHZLQZycFBlwlYLRjyzuuGkpXl/YJ1AA7yH8jmiwnuevAjl7fmIQkzl4+3zRo7wBfpLfbQlBL+DFb0jXFyFv+w0eWOc7CSrkIh97FUdNqMNAtsbs4nySqRiJq6CTPKQMYuRIF40eA9CIqntXDQNQdjbiMVwIRdhwg== 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=DeicbdEHGQnBrz9PhpHkqIG6ypNQL1pi4vlQgh4CCJM=; b=0C3m2JR305Dc/jqwlQ37tJCepF/V4DqnuNBz5EMNpXwuPNBssvSRLFN7waKEeljX6DAc+9J0qO+SeA9ALqyWy/TV0ZhAYLrWtDfqckLX8gYeGzeh3MqElLEPq8QTm7U3aL0q5ufgVbAvM9JoQ1wRL4alyY08Tg7ZBB36AOv3LU4= Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:6a::19) by YT3PR01MB9218.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.10; Tue, 11 Jan 2022 21:14:32 +0000 Received: from YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76]) by YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM ([fe80::d1f6:d9e4:7cc7:af76%5]) with mapi id 15.20.4867.012; Tue, 11 Jan 2022 21:14:32 +0000 From: Robert Hancock To: netdev@vger.kernel.org Cc: radhey.shyam.pandey@xilinx.com, davem@davemloft.net, kuba@kernel.org, Robert Hancock Subject: [PATCH net 7/7] net: axienet: increase default TX ring size to 128 Date: Tue, 11 Jan 2022 15:13:58 -0600 Message-Id: <20220111211358.2699350-8-robert.hancock@calian.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220111211358.2699350-1-robert.hancock@calian.com> References: <20220111211358.2699350-1-robert.hancock@calian.com> X-ClientProxiedBy: CH2PR07CA0049.namprd07.prod.outlook.com (2603:10b6:610:5b::23) 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: 016c2da0-c8f4-48a0-48e2-08d9d5475c6d X-MS-TrafficTypeDiagnostic: YT3PR01MB9218: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: K8/3TEk3QuHrb/BwMYaazDy7OOfj8HJ8cQXP3S3mqS0jyfueP00cPjiEOqenoh5YSiKLyxByZaCkU8m6OQJJkwTARy2r+PjZB+gTlTZPsO5JxoLhvAKTO9HZU1SxsFJsdPHskXweNfslT0kSu5s0LG87AUTXtlaQcE02YaXatUIjZTaBkyc2fM327zbo1DHGMAIFftOX+tWW0ePUofIBXQlP3fQIuVQct5h4Ct0ynNBqg4dE4ogzg2uUcXBkmvFHeqizx8CikktTE5OPiqj2dwsYrr5lZWkiRJLPyQ81iprQI8CNb/19RmntYNWsruJArKk6hbsERgqZcFviLR+NLc3uZ6PJjyFG4i52VkKO1/pSbmfyF6hSQK8vzBXWG1f1UcFMKtahEvkKo1TgkkRzIcKf3LCNSf2mdgabNYYiW2r6wLWLI6luKWQFpCPOl9irOHg/+UHCxXqvJv6SXwY/qfSq/XI/MuMdVV/X9Sb1DNcNAsky/ZRvnPt2b2T602T4LfJ57LV58VSWaIjR0zWQQk1PIwoCrE6lVAYE25IhYJ+31om4aKoVIm0M1+hm62xMbkwuQBiGvEa5URiWnLZJrZtsxa9sTgS73H1sVdiloaogGbg55H3DVe+/X8nYYEgp2QkEmN+1ssvMiJRRuiBms6SJ3ePu1a1eyUfdenGGWfxO+lZ+FZAk7vPBU2gkWSePaOnQaAMTEDkQ4HKCMPwasw== 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)(66556008)(66476007)(66946007)(52116002)(6506007)(86362001)(38100700002)(26005)(186003)(44832011)(2616005)(8676002)(2906002)(1076003)(6512007)(38350700002)(36756003)(316002)(8936002)(6666004)(4326008)(508600001)(5660300002)(6916009)(107886003)(6486002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: whw9uyEst99Blkl17S9zSPgvU4E4AWz+4ro4JetE7gO2C7YHduuoa6zoqYM81kgwKSnzZ66WiaunPaQ1RncNvEHGE4QBIO281Wz+fznlnhQ7uGvuXCwa5+hcIlll9DqtvXibFnIQaba6AIJDDbqJnBaID32C6CvPIMMJiHX9bMoz7oFsV2B+logLUeiGI7xVUdR++gsCTuO73wVMLAag4f+TPcRniikir+TYgwrZM72BHJN6IHma05cMiUzNF11NprXpOOC8Ao/UDmFLZHjMpUsTJ44FQhyOqZgYIiQ3bMizWAEWvEJhr7kNiABnzT1LagPc6SZUk/VEfgongqvlkaEglaHJFVcMjJx5xaZL6Nb0qiu19wzDZHgHkFoixVQW/2mn5v19fGt/LINQ76BTFt62pGeVGkKwJEjxYPbEO9IbLvDWz5AAKoWNo5bDJl9T+Lq4M7MFKswktXuPrVKiasFRBDFcqjE3SPIgX1O8Tg6c717F1TYHavTyRPISM6O6ddD3dI5I6EQMa542Id0tPFDepzNfJjHeMg+OW6PvN4maaZvd32HmQLBy+Om08yivBpuZ+ubcQUPlCGTip2MAA0tjtSbdauqkNTdnb2S+ftOXvZ2AN7ICEw5ngXSe4j5CCCCaFp4x276rewmTuyUDN/6QoVy8d4pvzFEqv1EueWd5VP/wbgfk0+WEGupLqNJ4ra6y5awXaygszodOsrTT3L5eHsaCDeuybmlOxQoPy8t/ycCPKMQKh1vDfSqBxjsqmzWoRibWBvNcpceE6i2AsgzFtfmuMJs8yNzFzh7wRwZc67ifxIXiJbUbY81MWB0QVFVkhzeiS32QsXNuStQS8KlOqdIopVm/Ft+tiGtnR3CBvACYy6K+6RnCq0taS9PAcAQa6+xNMBKJz5Q24gUILZMuElK+y0ouLJQqhim0OF9WZcqpwBIqzuYbgkfzzaazZM20y38NJQ+6V2V4To34hJyJOj7bqxmWaDRgqct0jbOKrCOaaMdv/Lb1d9qJcBxQokDxaQOzWj0Bgob+DJr++cJux+zZkZ8PMlNgb8w+V+dgUWfrWZLg6vwd3aN8OW6LJL1RxpQ8wpyJ9JaXuCiwNfLSz8c770tLdSPtm+iDEfsCxiWqkJyuoWGdMr8bU2Q0IWG0mkqi60OvwizzVuui6qP0SNJNLjLvSd2tu4x9+KxdOVwa+PphatCAesTIUHztiqIsN/oCBP6B0ntkKsmMmv35jscdjS0uSu5k6NosWkWqUFAlAbiFRbRZf6CuRmZSCKkxN8k0LaDsXFwxC7SlNWFbn+puFo2ae4y2N72XgOGEXgG9E3DQnQCO5PGnFVJGDnUxZrK7LrJv0jht//2x4B3Yv2euF9EpCKEIkNbwbvg8iYcir1o0BVksQMRmMpdAzU5duC02NbSr5jetCxwP9FhiZza8nSaW8ojZDhJ8EVwjI8uCTXj5JwtgI8Yc3WYXmPKCvI025IYzo+vFi6EFYPSD3sA5odkZG0IqWziDxKbaYr7BTZVucDcUhUADPhjdWyl6r4VWENEdukn2OG2O5fold8TtocIG+EmPeGtWfPz0qjeVUyvS5fsPyVRu8EQe0vp94jBItoQTEApBqbVI8Ycadfl1AdaA/j5pEkES4tsUxzsRteUTTxVbMWS4LSZpRtPhq4wULgQxQaVR6dlg1w== X-OriginatorOrg: calian.com X-MS-Exchange-CrossTenant-Network-Message-Id: 016c2da0-c8f4-48a0-48e2-08d9d5475c6d X-MS-Exchange-CrossTenant-AuthSource: YT3PR01MB6274.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2022 21:14:32.1102 (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: /aadvfeHm3eYq7/ptSBukfKSfou7Eh/+57vdyi9VWW1RPk4FCSOEWieSEz3xbI6UwokJEN1Qe9+tdF7XyQ9w3cHeiKx5CWgzKe0fViR71BQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT3PR01MB9218 X-Proofpoint-ORIG-GUID: uQYeI_uNs6fE97Rqc-8GWGxZDGTy_Ia4 X-Proofpoint-GUID: uQYeI_uNs6fE97Rqc-8GWGxZDGTy_Ia4 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-11_04,2022-01-11_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 mlxlogscore=654 malwarescore=0 spamscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201110110 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 2191f813ed78..580a4245f8da 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