Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp54920ybg; Mon, 8 Jun 2020 16:15:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3Fw8IZtClByahkUP16oM1ASFCHSUxBUE/WvJmpVHYh2D6D8pmYZ8r/D5V4IkDJe7Vqz2d X-Received: by 2002:aa7:da4f:: with SMTP id w15mr23426170eds.384.1591658152844; Mon, 08 Jun 2020 16:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658152; cv=none; d=google.com; s=arc-20160816; b=DbhVaWLSWsY4BKyOFoWjbASfqNgInbX0x/bkMWyHmbc8vGsJjcpAI7XBQdWFJc9xq5 W0cv7/ucOTUGpWd8SdzSIrDSVApxGtyw6Dn9zWjH2fy1yDYKADt/crVbwv/If1qp559D lBcOltWtOdQO33s4wKjRLdxPO2yI0mx2sp30D2m5n5fv6VYhz8UoBJg+ks8a7xK8mzZ9 BahmDcQhoWlRbrWQbMA88sllge8rlV5v3xYIDJRbMUh10Gw73gM0PNNHHreHwwPV3kh3 YDQfQfdxpS3oovDA/i7UPvh15SKz9itNwX2twSfdqZYQ3Q5qeZZholOWPrXDZj1lH2dI lftA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7O/MWkESfEm7dbDVK6Ezo6QOwEDDD2csNyG8bp/Qyx8=; b=Hh/utfrzgiDu5TWLzkMoZZBRA59IMogJfwFL8Qqn56anLrQx5PpLvg80dBEabx6O38 lOupe2I3Jc3ErGh7PrqhDEiSwaOyHFQAvYdgANaqGYjEDzyH5ynuiZSDB6ViYSVZdIJM NTlZPP3bVB8yga3HHoRl11GRUmswb6Uba8WMWz8q14DYhU8lxq4/2173QZFNHG6e9Rcy o/zWb+2UeWEBeKbbLafMVoAvUMmGBVyXeRXt3l8kCyvfz4CzscZPayOb/Q3Ajn/E9Fu1 mW/oEyxeWgHAnq09KLPNP2oc4KUSv/hFTB9CHlFrkqlfEdGfnzg7wsLc0XUQbsL1zszL ozIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oYbWLxxv; 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 n15si10211133edt.88.2020.06.08.16.15.30; Mon, 08 Jun 2020 16:15:52 -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=oYbWLxxv; 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 S1728115AbgFHXNF (ORCPT + 99 others); Mon, 8 Jun 2020 19:13:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:57742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726857AbgFHXLG (ORCPT ); Mon, 8 Jun 2020 19:11:06 -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 E1363208C3; Mon, 8 Jun 2020 23:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657865; bh=6fIE5Hz8OMymYYjrHzCdvXBjcqLLwBhH7L5RJjvcvQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYbWLxxvK9ivZvtiu8s6oL5eQdrn22qHgS1qaWgQ7T+mELIGhOBRl2LHl1qAdclF3 2L/AhDXdCgY5fF2BlbgbM6/UzV+Hx29wBLYjDPesTYa3+IWO2NfP9277UwwtGpZAR/ Gak2arc2J+btCK72vzSNEYT/2liVYOVyIICAOwsI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Brett Creeley , Andrew Bowers , Jeff Kirsher , Sasha Levin , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 227/274] ice: Fix Tx timeout when link is toggled on a VF's interface Date: Mon, 8 Jun 2020 19:05:20 -0400 Message-Id: <20200608230607.3361041-227-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brett Creeley [ Upstream commit 4dc926d3a59e73b8c4adf51b261f1a1bbd48a989 ] Currently if the iavf is loaded and a VF link transitions from up to down to up again a Tx timeout will be triggered. This happens because Tx/Rx queue interrupts are only enabled when receiving the VIRTCHNL_OP_CONFIG_MAP_IRQ message, which happens on reset or initial iavf driver load, but not when bringing link up. This is problematic because they are disabled on the VIRTCHNL_OP_DISABLE_QUEUES message, which is part of bringing a VF's link down. However, they are not enabled on the VIRTCHNL_OP_ENABLE_QUEUES message, which is part of bringing a VF's link up. Fix this by re-enabling the VF's Rx and Tx queue interrupts when they were previously configured. This is done by first checking to make sure the previous value in QINT_[R|T]QCTL.MSIX_INDX is not 0, which is used to represent the OICR in the VF's interrupt space. If the MSIX_INDX is non-zero then enable the interrupt by setting the QINT_[R|T]CTL.CAUSE_ENA bit to 1. Signed-off-by: Brett Creeley Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- .../net/ethernet/intel/ice/ice_virtchnl_pf.c | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c index c9c281167873..f1fdb4d4c826 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c @@ -2118,6 +2118,52 @@ static bool ice_vc_validate_vqs_bitmaps(struct virtchnl_queue_select *vqs) return true; } +/** + * ice_vf_ena_txq_interrupt - enable Tx queue interrupt via QINT_TQCTL + * @vsi: VSI of the VF to configure + * @q_idx: VF queue index used to determine the queue in the PF's space + */ +static void ice_vf_ena_txq_interrupt(struct ice_vsi *vsi, u32 q_idx) +{ + struct ice_hw *hw = &vsi->back->hw; + u32 pfq = vsi->txq_map[q_idx]; + u32 reg; + + reg = rd32(hw, QINT_TQCTL(pfq)); + + /* MSI-X index 0 in the VF's space is always for the OICR, which means + * this is most likely a poll mode VF driver, so don't enable an + * interrupt that was never configured via VIRTCHNL_OP_CONFIG_IRQ_MAP + */ + if (!(reg & QINT_TQCTL_MSIX_INDX_M)) + return; + + wr32(hw, QINT_TQCTL(pfq), reg | QINT_TQCTL_CAUSE_ENA_M); +} + +/** + * ice_vf_ena_rxq_interrupt - enable Tx queue interrupt via QINT_RQCTL + * @vsi: VSI of the VF to configure + * @q_idx: VF queue index used to determine the queue in the PF's space + */ +static void ice_vf_ena_rxq_interrupt(struct ice_vsi *vsi, u32 q_idx) +{ + struct ice_hw *hw = &vsi->back->hw; + u32 pfq = vsi->rxq_map[q_idx]; + u32 reg; + + reg = rd32(hw, QINT_RQCTL(pfq)); + + /* MSI-X index 0 in the VF's space is always for the OICR, which means + * this is most likely a poll mode VF driver, so don't enable an + * interrupt that was never configured via VIRTCHNL_OP_CONFIG_IRQ_MAP + */ + if (!(reg & QINT_RQCTL_MSIX_INDX_M)) + return; + + wr32(hw, QINT_RQCTL(pfq), reg | QINT_RQCTL_CAUSE_ENA_M); +} + /** * ice_vc_ena_qs_msg * @vf: pointer to the VF info @@ -2178,6 +2224,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } + ice_vf_ena_rxq_interrupt(vsi, vf_q_id); set_bit(vf_q_id, vf->rxq_ena); } @@ -2193,6 +2240,7 @@ static int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) if (test_bit(vf_q_id, vf->txq_ena)) continue; + ice_vf_ena_txq_interrupt(vsi, vf_q_id); set_bit(vf_q_id, vf->txq_ena); } -- 2.25.1