Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3580004pxb; Mon, 24 Jan 2022 12:42:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPT+vPQncgbi2/BbIcr0XyetbAmn8pXGB2oO4Fgrhmx5raT1LT2sCLZn1d030f8geLaKH0 X-Received: by 2002:a63:2a57:: with SMTP id q84mr13146925pgq.167.1643056973111; Mon, 24 Jan 2022 12:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056973; cv=none; d=google.com; s=arc-20160816; b=Empw2VSX4QVG70P5p/LmIVpJZZrpIz9hUp32GPBEuxdyiOyLX9mBAsegQJ+/shfHum KiUvNbviM/sS7S8otGYm9f9fyztfwh4aMf4gmfS1Zc4yuLPAB+j0v9vYBDyghQv9NEaC bvIM7rdPQqBCEHuY9KLk3cIjw4PmIwi/rQpBnYmvhZA58eJXV/e7ofG+lJPuolg1jQuP Lnvox8GMibvXSmuIAuAfBTf30P+cM47VQ4FJUt6ApX4fkQbzkHeZM94mOHgXYBngeDUe eZMdAySCUEoHy7oVu1LYp+Vkgw55e99cH4Jz/iZE9ETB3J/di7GFM4ZIXPfSC8No/JtH 7hMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nrH6dncDORckbn036esAM3doQf6Pnw844ZDdhPpRq68=; b=SfPmXNapKVtV33120z++vrXy/H70gtc2setnwqpHpJITg+VVrO2WsU+/brMsUonupD t73GGdzKkjmb/MINxWMVho1n4sSL8A2BJDhaUw0DrQySTww3O1hELyY2ZKWHAj6fvo2h w7U9JJjvMuckfz9QYebFSjgbk5+UG/WYtI8orrw8tDYHoXNaE0ejW62n4jgFySugycx6 7lz2BGzNK3wOjnLnGBi1FwUuOBiPoTpjbK6b+XL0nAVNrWHzn6b+VTXQKqxhkIRWWT6U Pxwgsmxb+HtgzCtiPs7itqrd3vkmHsYkIPX7XNdL+FjLzxEZoYfDijC7Xj4RHcpWKXtd NVpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BX5S4btg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w15si311243pjb.175.2022.01.24.12.42.33; Mon, 24 Jan 2022 12:42:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BX5S4btg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359827AbiAXUAP (ORCPT + 99 others); Mon, 24 Jan 2022 15:00:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:58588 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348601AbiAXTjW (ORCPT ); Mon, 24 Jan 2022 14:39:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24E12B8122C; Mon, 24 Jan 2022 19:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38C5BC340E5; Mon, 24 Jan 2022 19:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643053158; bh=VKXK7kYTQZvVjzGQS4SN8dhAG6nk9/Iz3tYU1sWarK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BX5S4btgBgMbukpo/LIj5ujx8TxZyNSKjmsJbSvJYKAWr2bvDnwy4y1tzin3AGtGH s9VYrVQ0gvmYGNabyuqD7YZz5K4gT3DUW3Um2Kx88AApWP0+Cw8FLC3dx7WZe1cbxF w1Kf5Wi20c7ImpUAjVVJN08IRsvE3K2yCPhHof3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , "David S. Miller" Subject: [PATCH 5.4 295/320] net: axienet: limit minimum TX ring size Date: Mon, 24 Jan 2022 19:44:39 +0100 Message-Id: <20220124184003.977026219@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Hancock commit 70f5817deddbc6ef3faa35841cab83c280cc653a upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- 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 @@ -1223,7 +1224,8 @@ static int axienet_ethtools_set_ringpara 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))