Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3970921pxb; Tue, 25 Jan 2022 00:17:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8+Feqvid3xdKlogx9JRExCaz3ypk5jdSXbVL/8qSNLPI/z9BuQZj9Yj4jmy5PO5tCMXts X-Received: by 2002:a05:6402:168b:: with SMTP id a11mr19056403edv.18.1643098678335; Tue, 25 Jan 2022 00:17:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098678; cv=none; d=google.com; s=arc-20160816; b=BMj8kRfHSQ6gEfE2JRLtWK4/ohn62ftfxPNoKn3mAqvm9QXaihyT6CWy2deScA2yZm LckQV62jRofHLEJch4hrCiWliKntpL0cx3j9Owi47Vs7Y4wA6yjkOFHfqcgLn4XcIJGr mtyfYgT0vIP25J3OteANMmHZq5Mt7BSJv42TCDuNm2+XnyM+6bqBnTHDOgzTlQS5JkXa +RTcKQWge9gYeQb8wGafgLHhlJVwTyEqMzGuBkDLmiKmnz9bT/RbJ9seVI/ZCG0K5UNJ BL/3XkRN3/fkG+Tkion1qMlpRmjMbrqQrGQRHeYDrP6Kue4OOL1O3j9EC3TFaLcMLGTx EtkA== 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=qJRig6ITtFnVSUiElBlBBOq1q0TmtZCajoUSMLVlG/E=; b=X0demf2BkGKVYZF3n1aHnno9XRUPr9PIOdCbmOxDdHO2UolZSKml99M2GHu2cowf7s yCs9/y447JSZQe8UCzAXIc0f6kLSxNEWisSRU0JY+GOxpgTPkXGThxub2mA2UKCWLqqy JsXpbtewU1vSB6WIwONSoaO9Z0QKfXQYPo3u2nVuZX68FVuMvkJgsLXIJ4rVtoQN61wN pQlhfcd67351FidFgOZW2yTrobCzhEmRJ8sbUHz5DCnug+yoknvhqgA6wbO5Fcz4vALz VCsNICO6BYNJCzsHkvJmqLQZmeJSlr15+ls9CTCq/jsAmkKaZzdZs7kpc+rIF2TGkvHK 2iqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mBxC5oWj; 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 h21si1157342ejo.76.2022.01.25.00.17.04; Tue, 25 Jan 2022 00:17:58 -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=mBxC5oWj; 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 S3412021AbiAYAfY (ORCPT + 99 others); Mon, 24 Jan 2022 19:35:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364062AbiAXXqn (ORCPT ); Mon, 24 Jan 2022 18:46:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10003C0613A8; Mon, 24 Jan 2022 13:41:54 -0800 (PST) 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 CB19DB8105C; Mon, 24 Jan 2022 21:41:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02551C340E4; Mon, 24 Jan 2022 21:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060511; bh=qEjckpQvRmxcTRNa+OgIplbRP5NSdJP2K0D8QWEZUBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mBxC5oWjT+Lj7cRzeyPhlkxo8DrYc4UX+EUZSZl9gincvlCzc62g+z7f1CzP5Ok4N GZDJigELz1ia09k168OCHIGVsnxNmV3UVXHIBW3oTWfe9ty9g4xW02XJSpveDxeLB7 BnpwJZuy8ObEbpkTF9s5+/LZQiTG/V9bL5QHKnfg= 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.16 0971/1039] net: axienet: limit minimum TX ring size Date: Mon, 24 Jan 2022 19:46:00 +0100 Message-Id: <20220124184157.930377306@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 @@ -1364,7 +1365,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))