Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3922555pxj; Mon, 21 Jun 2021 09:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzra7UNtD+7CExq/j0Ukuvhxs0+odTmOSM/gi9A9jPYuXbq9KQSes61EWvb0f5C9AVoiREi X-Received: by 2002:a6b:e219:: with SMTP id z25mr19765888ioc.23.1624292791798; Mon, 21 Jun 2021 09:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292791; cv=none; d=google.com; s=arc-20160816; b=a0V/4Xy7cxZA0E5SjLI3ltI1cpcyw9gEGvOlY3tFVRTFsq5l2+dFMxWch8x58omkRx UDzFJWRBIexI0ssW2VF9tGF6W3N+wSCn2NH7PjN9q/QWsmkBj28dFa/bdaF3ylZhTH60 /k0w0CaZEKGznDoMh8xuSWq2eh/KUi7SCGjSbBm/xCKTtMsqWfVpDAHFdMmL5KnbxPin sFkRxMf9EtK1pOZvgq/wdl+uvh4SvBnMLvJmPqiqz6KyTSCUQVDO1b0rar1a8l0aIRCD ID672FwT+TzTyiqyjl1TAFp4wPbdBQxDtZd5L/4P2cCahIL9TTs84YytJpLAupL/8NGW 1Gcw== 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=THF+PnzLgLtmh95/Y+EoRaqjMNVdUSUPrIc5VBnWhuA=; b=vP6+qY2b4zkqEbtRQJ2QlRIhdbkfs9UqCsB5xhL+DFPL5TngMhMkDTBSkpzgMuA9gd tjBOTJFEhUtg/qMgsq9MB70q71JyDhaG+wYcpXAuzcJc944ydxHXleQixnJzuwglLiAs lqdbhEJKXimfg53UNZiPXiG76KUFB3CAt3Xftkfq1RQyp/ZlNT9kPK+NAJ388hZWHTB2 zyzyQ1dZ/IS/iBK+nOvZ/cWW8ZWlxgKpcTJNvg8UstlNj18vCpKL/HmIKCBmoW88t97O I9ezz/Ean3u21+WEERpMEGojtW6p44MlCEqz4KT3u9YoWOGZzcvWbBIDfTFDWZP8pzXG WX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1GpcWtAI; 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 i130si7689276iof.93.2021.06.21.09.26.19; Mon, 21 Jun 2021 09:26:31 -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=@linuxfoundation.org header.s=korg header.b=1GpcWtAI; 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 S231246AbhFUQ1E (ORCPT + 99 others); Mon, 21 Jun 2021 12:27:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:42214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbhFUQZS (ORCPT ); Mon, 21 Jun 2021 12:25:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2CE236128A; Mon, 21 Jun 2021 16:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292502; bh=9YYe7ZqJ7+65s68bUX18QLvHYeEpE8mpjaZEI1M5D/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1GpcWtAIZS8F0jCf5AR4swOitgLw/ru5eQs+BjbZ3BmcYT9T51ffdiO/QE9dWdU+s 4CNpZv7PNB3XCYd58QLxU6eFaZNS14+elfZIH02HdswZVF9vY2JPYEP6B2NqFo0lb2 QJORGpiMDbe/qzQT8/YsQWlAmdcB6VfUnG8B6P2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Kiran Bhandare , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 024/146] ice: parameterize functions responsible for Tx ring management Date: Mon, 21 Jun 2021 18:14:14 +0200 Message-Id: <20210621154912.093482985@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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: Maciej Fijalkowski [ Upstream commit 2e84f6b3773f43263124c76499c0c4ec3f40aa9b ] Commit ae15e0ba1b33 ("ice: Change number of XDP Tx queues to match number of Rx queues") tried to address the incorrect setting of XDP queue count that was based on the Tx queue count, whereas in theory we should provide the XDP queue per Rx queue. However, the routines that setup and destroy the set of Tx resources are still based on the vsi->num_txq. Ice supports the asynchronous Tx/Rx queue count, so for a setup where vsi->num_txq > vsi->num_rxq, ice_vsi_stop_tx_rings and ice_vsi_cfg_txqs will be accessing the vsi->xdp_rings out of the bounds. Parameterize two mentioned functions so they get the size of Tx resources array as the input. Fixes: ae15e0ba1b33 ("ice: Change number of XDP Tx queues to match number of Rx queues") Signed-off-by: Maciej Fijalkowski Tested-by: Kiran Bhandare Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_lib.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index fb20c6971f4c..dc944d605a74 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -1705,12 +1705,13 @@ setup_rings: * ice_vsi_cfg_txqs - Configure the VSI for Tx * @vsi: the VSI being configured * @rings: Tx ring array to be configured + * @count: number of Tx ring array elements * * Return 0 on success and a negative value on error * Configure the Tx VSI for operation. */ static int -ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings) +ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, u16 count) { struct ice_aqc_add_tx_qgrp *qg_buf; u16 q_idx = 0; @@ -1722,7 +1723,7 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings) qg_buf->num_txqs = 1; - for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) { + for (q_idx = 0; q_idx < count; q_idx++) { err = ice_vsi_cfg_txq(vsi, rings[q_idx], qg_buf); if (err) goto err_cfg_txqs; @@ -1742,7 +1743,7 @@ err_cfg_txqs: */ int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi) { - return ice_vsi_cfg_txqs(vsi, vsi->tx_rings); + return ice_vsi_cfg_txqs(vsi, vsi->tx_rings, vsi->num_txq); } /** @@ -1757,7 +1758,7 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi) int ret; int i; - ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings); + ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings, vsi->num_xdp_txq); if (ret) return ret; @@ -1955,17 +1956,18 @@ int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi) * @rst_src: reset source * @rel_vmvf_num: Relative ID of VF/VM * @rings: Tx ring array to be stopped + * @count: number of Tx ring array elements */ static int ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, - u16 rel_vmvf_num, struct ice_ring **rings) + u16 rel_vmvf_num, struct ice_ring **rings, u16 count) { u16 q_idx; if (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS) return -EINVAL; - for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) { + for (q_idx = 0; q_idx < count; q_idx++) { struct ice_txq_meta txq_meta = { }; int status; @@ -1993,7 +1995,7 @@ int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, u16 rel_vmvf_num) { - return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings); + return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings, vsi->num_txq); } /** @@ -2002,7 +2004,7 @@ ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, */ int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi) { - return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings); + return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq); } /** -- 2.30.2