Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1646601pxy; Mon, 2 Aug 2021 07:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl3An/yVhJQCFQ/6PCrot5LAUXvkvY7CMStfMBsGkIxLaSw0R3aPcr8l+emQQS3jyqcA9v X-Received: by 2002:a05:6402:4246:: with SMTP id g6mr19367061edb.95.1627912905376; Mon, 02 Aug 2021 07:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627912905; cv=none; d=google.com; s=arc-20160816; b=dBinna0FR5k7pFCLW1Ss+ptWQNhXRttRQ3a10ee+VVay6ZdkrnJLhpWDjgYwP3jWa5 nISnaQhij5bsIYsYv2YxifxuqNIUYOry+8ECRaoINDNY3e4P+nlSBhy316RTG/BOuyqA tz6t8azTSnDy+SjeGftYn5wj2uOamOsIbwCdyD5OCCLtKFwNcNw3PykyvMGyGyGu3blm qGDMmZIqn+pvjTDSQW5GpX3VTofddiGNVbM8x9quDZ/rZyL6GO24Br9JTuJMDXLUv78a WoX36Pto6iddqV8R3ULeXpRvFwZFPixDFLYKdPHUIogdOXPBp9oiH8VqK8BWIIN/nZ4r VoFA== 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=ATNGxU+U5qpJXePPlSXnb8Wnh+a9m62FDxDlRT6pVQg=; b=FBhlmXMgB2Q2b7TL1LNh85OQoATa/kIykJps/ex/nK3eJqui0qc+LpIMSkZ0QPlUyg q9FupiU6PnmLhaaI89ruOvQfiE1pQhNsYMbOX2qlNsis4087mob9XDyl9WRxfzTPdY15 KiGpBALsThXgAmLvJ7nhGoK7hVaQKfS8vsYrAEYevwobn/gEEOa06bAgCo/bCQ5wVmYs obYN0n+SjE9ihldP4XJLhbvcyMShGzUPXZI9yllsSdkygj7vL0QwnYQkg2CgpWP6mMr3 6Sko0KE46SjeD8AyXzS6CTWVyWAKgTauPtjrz46xVqklSDjkBe2WQKOlpf4vdtGj3Cz4 9mGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SQtReUQ8; 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 hp17si10538045ejc.376.2021.08.02.07.01.19; Mon, 02 Aug 2021 07:01:45 -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=SQtReUQ8; 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 S234824AbhHBN5d (ORCPT + 99 others); Mon, 2 Aug 2021 09:57:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235138AbhHBNvf (ORCPT ); Mon, 2 Aug 2021 09:51:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA3F261057; Mon, 2 Aug 2021 13:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627912265; bh=Xj2UQhSsly0w3e0BH8lHI/bWR+t2QLzCWTxtI+ebpT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQtReUQ8vRfZRQXGaIU/GaJyG0jdE8AIOGouSjmkeqM+oipsbjLq/GJJBiSAMxXa7 xAWQzIasEuM3DU+947jJRSjOoJ/0tLm0XHW3ZSggPnMFDRAmmSS4u1MuDCVIy9jxQr 4aVpPKzprTUnXGdwT28wEly1oq0498GVhPd6G8q0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksandr Loktionov , Arkadiusz Kubalewski , Tony Brelinski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 22/40] i40e: Fix logic of disabling queues Date: Mon, 2 Aug 2021 15:45:02 +0200 Message-Id: <20210802134336.102207599@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210802134335.408294521@linuxfoundation.org> References: <20210802134335.408294521@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: Arkadiusz Kubalewski [ Upstream commit 65662a8dcdd01342b71ee44234bcfd0162e195af ] Correct the message flow between driver and firmware when disabling queues. Previously in case of PF reset (due to required reinit after reconfig), the error like: "VSI seid 397 Tx ring 60 disable timeout" could show up occasionally. The error was not a real issue of hardware or firmware, it was caused by wrong sequence of messages invoked by the driver. Fixes: 41c445ff0f48 ("i40e: main driver core") Signed-off-by: Aleksandr Loktionov Signed-off-by: Arkadiusz Kubalewski Tested-by: Tony Brelinski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e_main.c | 58 ++++++++++++--------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 4f4ec1f166ef..3514e36d1487 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -4403,11 +4403,10 @@ int i40e_control_wait_tx_q(int seid, struct i40e_pf *pf, int pf_q, } /** - * i40e_vsi_control_tx - Start or stop a VSI's rings + * i40e_vsi_enable_tx - Start a VSI's rings * @vsi: the VSI being configured - * @enable: start or stop the rings **/ -static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) +static int i40e_vsi_enable_tx(struct i40e_vsi *vsi) { struct i40e_pf *pf = vsi->back; int i, pf_q, ret = 0; @@ -4416,7 +4415,7 @@ static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q, - false /*is xdp*/, enable); + false /*is xdp*/, true); if (ret) break; @@ -4425,7 +4424,7 @@ static int i40e_vsi_control_tx(struct i40e_vsi *vsi, bool enable) ret = i40e_control_wait_tx_q(vsi->seid, pf, pf_q + vsi->alloc_queue_pairs, - true /*is xdp*/, enable); + true /*is xdp*/, true); if (ret) break; } @@ -4523,32 +4522,25 @@ int i40e_control_wait_rx_q(struct i40e_pf *pf, int pf_q, bool enable) } /** - * i40e_vsi_control_rx - Start or stop a VSI's rings + * i40e_vsi_enable_rx - Start a VSI's rings * @vsi: the VSI being configured - * @enable: start or stop the rings **/ -static int i40e_vsi_control_rx(struct i40e_vsi *vsi, bool enable) +static int i40e_vsi_enable_rx(struct i40e_vsi *vsi) { struct i40e_pf *pf = vsi->back; int i, pf_q, ret = 0; pf_q = vsi->base_queue; for (i = 0; i < vsi->num_queue_pairs; i++, pf_q++) { - ret = i40e_control_wait_rx_q(pf, pf_q, enable); + ret = i40e_control_wait_rx_q(pf, pf_q, true); if (ret) { dev_info(&pf->pdev->dev, - "VSI seid %d Rx ring %d %sable timeout\n", - vsi->seid, pf_q, (enable ? "en" : "dis")); + "VSI seid %d Rx ring %d enable timeout\n", + vsi->seid, pf_q); break; } } - /* Due to HW errata, on Rx disable only, the register can indicate done - * before it really is. Needs 50ms to be sure - */ - if (!enable) - mdelay(50); - return ret; } @@ -4561,29 +4553,47 @@ int i40e_vsi_start_rings(struct i40e_vsi *vsi) int ret = 0; /* do rx first for enable and last for disable */ - ret = i40e_vsi_control_rx(vsi, true); + ret = i40e_vsi_enable_rx(vsi); if (ret) return ret; - ret = i40e_vsi_control_tx(vsi, true); + ret = i40e_vsi_enable_tx(vsi); return ret; } +#define I40E_DISABLE_TX_GAP_MSEC 50 + /** * i40e_vsi_stop_rings - Stop a VSI's rings * @vsi: the VSI being configured **/ void i40e_vsi_stop_rings(struct i40e_vsi *vsi) { + struct i40e_pf *pf = vsi->back; + int pf_q, err, q_end; + /* When port TX is suspended, don't wait */ if (test_bit(__I40E_PORT_SUSPENDED, vsi->back->state)) return i40e_vsi_stop_rings_no_wait(vsi); - /* do rx first for enable and last for disable - * Ignore return value, we need to shutdown whatever we can - */ - i40e_vsi_control_tx(vsi, false); - i40e_vsi_control_rx(vsi, false); + q_end = vsi->base_queue + vsi->num_queue_pairs; + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) + i40e_pre_tx_queue_cfg(&pf->hw, (u32)pf_q, false); + + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) { + err = i40e_control_wait_rx_q(pf, pf_q, false); + if (err) + dev_info(&pf->pdev->dev, + "VSI seid %d Rx ring %d dissable timeout\n", + vsi->seid, pf_q); + } + + msleep(I40E_DISABLE_TX_GAP_MSEC); + pf_q = vsi->base_queue; + for (pf_q = vsi->base_queue; pf_q < q_end; pf_q++) + wr32(&pf->hw, I40E_QTX_ENA(pf_q), 0); + + i40e_vsi_wait_queues_disabled(vsi); } /** -- 2.30.2