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: 12716933 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 4241DC433EF for ; Tue, 18 Jan 2022 21:46:49 +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=KqGtHN6LJy9P+CzZ0N/SjTmYwy99emaoJxxyG7pD+2M=; b=Qhb6wlY7f/1jHR rM3QtB4Ede2rOmTTBzV+lGANm/tdUK8gEQFeq4gUBTWE970EKUtLSLGg+b6jEeAo6G540GKtBIijV SJEa4DMaugMqo5KiRMpHl0wq4TR1s4MrpIjpWtR32q7khHJuqbi4DMjbYV085+BQIPp5lko6ek3Y8 L+j1T3OyUVCZjFXu6ybyYuJBhKGL7e1N3NOnS82OjOo84QobxbHgT+j4rs1hsRFIpb8clVYmou8ke /neb6lGHuqmmSum/jvL1TdguHpEotax3EUIgRwy+36qjGzhnfOmFaQBwGISawKBknMRaEHb3V5RUn +XDHO0eRcIRUDO5QzEiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9wHk-0031pu-Kc; Tue, 18 Jan 2022 21:45:03 +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 1n9wFZ-0031B9-Rk for linux-arm-kernel@lists.infradead.org; Tue, 18 Jan 2022 21:42:47 +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 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/OnlWNTvy7AWiGqO7TeQAV66HGxXf2cLSkAOJcRZmfuR7lxXXuYXalBZYEMB7um/KEyUFhYvdDCIS2fFZfres4DL85HNIyqSrAFSP2Aqhjhci0OzDGf42DlGKB6jxK0dQ/A4XsC1or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lUsdDER5OQ1mKu6R7PUre0plAi/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220118_134246_061373_2CB60393 X-CRM114-Status: GOOD ( 13.75 ) 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 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);