Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp882556pxk; Thu, 17 Sep 2020 20:14:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7pkPZg2IbMVsFI2iFxjMzZH4csrs5eO1l3SccQ8i1iJD6sRvo2eKyAcAeXsQGq70/mXTG X-Received: by 2002:a17:906:d7ab:: with SMTP id pk11mr33590928ejb.472.1600398898913; Thu, 17 Sep 2020 20:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398898; cv=none; d=google.com; s=arc-20160816; b=uQ/ZAnCxUDFqTaWyyzGFk9ZjkvitokfPup0YZGEbsCGyjBJ8igQGOpLNscbKq3yW0e f7DQ3EeD+Yc//IFoOel7tdwLUjQ8lSH5+GHpHEi10sY42Nf2GPH0z56fxTyPSRZNR1I0 eE99GIqz/Ciyj2UOu/xx/2bqIP698jMdXWebqBiJ0L5TLiuR44Xog0trQ/azqZUom9Ey MI74SBujvPrEuzfUYo9yco9R1hx+OlyeKeetICxnIohZlPWBOvqmMFWvftMEJTB7Ph9F oqJ94EHnf/DJgp9knNC59qKQK1RP/rIcL8A7PbGwvZtsm8V0VP/PnYiERvwIiak5gCQN eI3w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+UCZvtQsrTJQwt9NigKWFnw2l4NY/cLrtOkCXMLb6fg=; b=O21BmmR5tAEHJ54/aVyPFcmo+0xtc8y0XEHtWGqB3LYDNPK4NkxPuCWe6Lnk3Lsh0K pcB+ifDKZOJ+arVIrb56t7PadYl61/FEVEFpqGP5i1fM1akYXxdTPHrijehHGHaKsrGy uKIgSWZQKHPOnbChguuazYXy43sKGxLoG3Avy2ifG8QqXIk305PGLvDNZMhd3WLMohxm ge7OtbdhXwpAkRkDX8AK9OAv4RQ+X8dyq8XGLUovrcVIxMZptP8eULnNSKJHfYapH5ds o4h9MDhP5yZcGbj6JlakdvoO85nH9uxkHDQLyf1AmRwTXH8LDwhXxo2Tf/dB4nsran9T 8lWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JKx2c7Cm; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si1314167edv.314.2020.09.17.20.14.35; Thu, 17 Sep 2020 20:14:58 -0700 (PDT) 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=@kernel.org header.s=default header.b=JKx2c7Cm; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730162AbgIRDNi (ORCPT + 99 others); Thu, 17 Sep 2020 23:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbgIRCBz (ORCPT ); Thu, 17 Sep 2020 22:01:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2576521D92; Fri, 18 Sep 2020 02:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394515; bh=GqoM6cRd9EYADEHXrQ0iozMlUKV4gzbkkS4fqV+rltY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKx2c7Cm7qHejxsLG2SOrb0/Bur2fExCQw5zXSIYoXGKEIfQhQ6MFOMyFGz4vQvGm 4AYE6pXs6bd7awwKXamQFw3Sn61tsTtLnTxmBGsPo7RxMXYT3ztAZ+bn/LjuIQni2g o2u6e3L3RcEZiSMjDEer4GXpi+txc+W3hCnaPqtQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Usha Ketineni , Andrew Bowers , Jeff Kirsher , Sasha Levin , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 037/330] ice: Fix to change Rx/Tx ring descriptor size via ethtool with DCBx Date: Thu, 17 Sep 2020 21:56:17 -0400 Message-Id: <20200918020110.2063155-37-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Usha Ketineni [ Upstream commit c0a3665f71a2f086800abea4d9d14d28269089d6 ] This patch fixes the call trace caused by the kernel when the Rx/Tx descriptor size change request is initiated via ethtool when DCB is configured. ice_set_ringparam() should use vsi->num_txq instead of vsi->alloc_txq as it represents the queues that are enabled in the driver when DCB is enabled/disabled. Otherwise, queue index being used can go out of range. For example, when vsi->alloc_txq has 104 queues and with 3 TCS enabled via DCB, each TC gets 34 queues, vsi->num_txq will be 102 and only 102 queues will be enabled. Signed-off-by: Usha Ketineni Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 62673e27af0e8..fc9ff985a62bd 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -2635,14 +2635,14 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) netdev_info(netdev, "Changing Tx descriptor count from %d to %d\n", vsi->tx_rings[0]->count, new_tx_cnt); - tx_rings = devm_kcalloc(&pf->pdev->dev, vsi->alloc_txq, + tx_rings = devm_kcalloc(&pf->pdev->dev, vsi->num_txq, sizeof(*tx_rings), GFP_KERNEL); if (!tx_rings) { err = -ENOMEM; goto done; } - for (i = 0; i < vsi->alloc_txq; i++) { + ice_for_each_txq(vsi, i) { /* clone ring and setup updated count */ tx_rings[i] = *vsi->tx_rings[i]; tx_rings[i].count = new_tx_cnt; @@ -2667,14 +2667,14 @@ process_rx: netdev_info(netdev, "Changing Rx descriptor count from %d to %d\n", vsi->rx_rings[0]->count, new_rx_cnt); - rx_rings = devm_kcalloc(&pf->pdev->dev, vsi->alloc_rxq, + rx_rings = devm_kcalloc(&pf->pdev->dev, vsi->num_rxq, sizeof(*rx_rings), GFP_KERNEL); if (!rx_rings) { err = -ENOMEM; goto done; } - for (i = 0; i < vsi->alloc_rxq; i++) { + ice_for_each_rxq(vsi, i) { /* clone ring and setup updated count */ rx_rings[i] = *vsi->rx_rings[i]; rx_rings[i].count = new_rx_cnt; @@ -2712,7 +2712,7 @@ process_link: ice_down(vsi); if (tx_rings) { - for (i = 0; i < vsi->alloc_txq; i++) { + ice_for_each_txq(vsi, i) { ice_free_tx_ring(vsi->tx_rings[i]); *vsi->tx_rings[i] = tx_rings[i]; } @@ -2720,7 +2720,7 @@ process_link: } if (rx_rings) { - for (i = 0; i < vsi->alloc_rxq; i++) { + ice_for_each_rxq(vsi, i) { ice_free_rx_ring(vsi->rx_rings[i]); /* copy the real tail offset */ rx_rings[i].tail = vsi->rx_rings[i]->tail; @@ -2744,7 +2744,7 @@ process_link: free_tx: /* error cleanup if the Rx allocations failed after getting Tx */ if (tx_rings) { - for (i = 0; i < vsi->alloc_txq; i++) + ice_for_each_txq(vsi, i) ice_free_tx_ring(&tx_rings[i]); devm_kfree(&pf->pdev->dev, tx_rings); } -- 2.25.1