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: 12716932 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F1CC9C433F5 for ; Tue, 18 Jan 2022 21:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qDwjhCwGDrGfLC02jeXZKFyY/rb0nk4ZyfFebe5OaqY=; b=ULApoCMZmJythb SXvEoIMh7cgQGFVq1kBvFPh4l18ymvacXb+IjBxq/diBr5OEhq9BgLAt+yMKsoTN12WoS+dntzX/q FKHCCYO+SHDIDMXWHLeIWFzwcUPq+bXJU/MwLQHnOUIPow6Lk5j352SnGtawznNI2QTNnhwANiaeM phJJ4B/s+JlG251Pa+0YHn13LTqbIg7SNzutGlm6MQvU2n0j7tHkDcXrAwb4OxxwAUhOrMLHUevL1 EarCzHkVDN8MC9Hxxf585vks4grXlakp+Lgg7jl8GlSK32EkkE6g61SIFBNsPUJApyHj0cwBugjps cgaDfNJtp1/w+bthntdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9wGw-0031XL-5D; Tue, 18 Jan 2022 21:44:10 +0000 Received: from mx0c-0054df01.pphosted.com ([67.231.159.91]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9wFY-0031A2-6Z for linux-arm-kernel@lists.infradead.org; Tue, 18 Jan 2022 21:42:45 +0000 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/kIAAlNA4PfBpFbbcXD39jKrUHW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ybul8cDMitFB4VNNSV/WhvOQqi7yUnR7SsWNNSt8S8Sx/zBD6KDwM57LemEqO4WN27lxcgU3NbI5wo6Np3GhCZ233z6eG5P3kCKng144ruh1k7bv3I9sGlcLZFoXfJcpKw5nowtOXBwnAlxnhQUvKjtuyH3zwh+QzmYNTwokoJsJMllLOUL+G51sd9fBncJEp6Q56WfAXxV8wkkhFKyhlW1yZLNU/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220118_134244_407609_8F640D99 X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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; }