Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1868409lql; Wed, 13 Mar 2024 10:14:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURGdajnsG2N7bwpV+RcvW4Bb4m025hjtQnb3SLjLxDt6pRE9e4UVV7BNrNyCUc9fVoblE2npGbHbWvRr7/I+LXE0ph4wEeIxCuU4LUrg== X-Google-Smtp-Source: AGHT+IF7maIfoKi7l79fsxj0JN9XfvzjvTEot3Zsyvsqd3foAbNwTUV56gDK6MQDSl2PpxLhn9zr X-Received: by 2002:a17:903:1c9:b0:1db:ceb0:2022 with SMTP id e9-20020a17090301c900b001dbceb02022mr19327649plh.27.1710350083229; Wed, 13 Mar 2024 10:14:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710350083; cv=pass; d=google.com; s=arc-20160816; b=EzvOM2dkIlbP6xsXp3CKJ99C46lAvrvTBsecD8ngR/esE+plvH5lenvmJt1Zdopo7O EbMQvXpRAEEfnFTXZ2BnMojMPGL8PRa/ywDixpCUOxTNZhuucw0DmwDIknE+YoCnUm4c sx4a3oGAetQrzwi1kxclALYWBAMWuoPoF5BBuq9BWwmB61v7YqKmMQGWIjul7tfVQONA bVpnF9Hs1h1EFM7HiWWisKGax5ySrNXk8+FTyWRdSRvGCwhNeTzmzSkJHB6KtYa52w8A FOWVnEbtoBz9+jR2qwV/A1gX92CfPoYMITpjrFMt4hdTAZxzdy76SEPsOyoW533WFe73 MdEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fVAu3jqUUFoWOdU6saImayu2dQsQ/Qu0beE4LDQEAKE=; fh=ClnbtZbQUfnZ6fl0RTx4gOPYpHYZQKgNVA4YkNULt8g=; b=LwqnsX10ixQEAfzgdFpoEKR5uwwVnV30GNpDjZwevEhKI81csgVxWwiWqlgqp36MZK /14tL9b8Qux8tOBqgngRwd25RaGSl3Nexnha19lI+7SPzOal/lH0L9eNuNo7o2B+Cezl VnMu0nlbxMP6nzybSsEMo0+b1kmOxkxD0ZgWY/npRuT7WCm3h4Uym5z6Oe7W4U44fJIf glf4AO83iKNCumd6bdjV9yTlYXWElKlIc6kuxlcpVMlNU7cmH2G6Yo3I+XhxwF2XKrOi bV26DHO1Uc/cP+wuGfCQtqj6iWtV3XBK4tYe2xQL5Tbri9qs9HqBCMcrzty+5d4a6i3E 0u6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sZRgJtB+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o4-20020a170902d4c400b001db492705ffsi9607564plg.97.2024.03.13.10.14.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:14:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sZRgJtB+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AF3FFB23EB2 for ; Wed, 13 Mar 2024 17:04:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F9CB60EE9; Wed, 13 Mar 2024 16:40:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sZRgJtB+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E9A360DCF; Wed, 13 Mar 2024 16:40:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348004; cv=none; b=ARQMZfQQR+81r0OzUjIW3P4pD7gsA8Zbu0LVZLMimZJCRMmtL29ALGjgjeUed5RuIJx/ituhyOJORzCb1h4OZ1+XxZ382JKkQLeZPoPu1vv2NVY9uPOtVp7B0T8SMcPPe41svtEBESlUfg3WVPO1/Rk18iyUCuesSvX1CpiJRUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348004; c=relaxed/simple; bh=/2glhdghFJgSJZQUZqqwqpo977Qof7haR5oJja7XJc0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D1bo2b42RRFccWrmbvlCIBN0iAyCRaZKPdTdFyg9k/YUfHQDKjRKpwXYWeoGhfcWBVbxwW4MvFUvy0jrwyFH16T3Q7g5rJBzIgQF9V1BELNyTrPVFJQXLeoaiIBlX9NVw6Xxsmhwkz0SqWuAn7D2dYxTgStADuRc8fq+t+J/rr8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sZRgJtB+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24B63C433C7; Wed, 13 Mar 2024 16:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348004; bh=/2glhdghFJgSJZQUZqqwqpo977Qof7haR5oJja7XJc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZRgJtB+ycLvPC83Z/M1Ovi5ulWHgYpRjp1ePnhYwEoF21UxeMncwVsXmN7ZEVYcd 5/wM+IyFNdXSBiD9tSkkG/1hPQMt/qMliD5F7wFoFdpm0Z3gr+T42HMmDihoIiDUNV W5vNOf6Xf5Z78uHWakeqb36htSziSAWseCDjLyJZ5nAWfO0Fp1r2F1pLKwdLDXjNuN oQkippTKfmRthTFfGnUq0jIh3XSppEbqEf303MhhkJW/jjQaAqLvz9sNHFRHRbRCdZ yRD6EZT8NPufMXqSqEKwyW3ljepb7DR0P0CVl1IsbHX8BwLMvrwIqubIDzinil3WhD zvlZ/m/lex60A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maciej Fijalkowski , Pavel Vazharov , Magnus Karlsson , Chandan Kumar Rout , Tony Nguyen , Sasha Levin Subject: [PATCH 6.1 03/71] ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able Date: Wed, 13 Mar 2024 12:38:49 -0400 Message-ID: <20240313163957.615276-4-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163957.615276-1-sashal@kernel.org> References: <20240313163957.615276-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.82-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.1.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.1.82-rc1 X-KernelTest-Deadline: 2024-03-15T16:39+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Maciej Fijalkowski [ Upstream commit cbf996f52c4e658b3fb4349a869a62fd2d4c3c1c ] Currently routines that are supposed to toggle state of ring pair do not take care of associated interrupt with queue vector that these rings belong to. This causes funky issues such as dead interface due to irq misconfiguration, as per Pavel's report from Closes: tag. Add a function responsible for disabling single IRQ in EIMC register and call this as a very first thing when disabling ring pair during xsk_pool setup. For enable let's reuse ixgbe_irq_enable_queues(). Besides this, disable/enable NAPI as first/last thing when dealing with closing or opening ring pair that xsk_pool is being configured on. Reported-by: Pavel Vazharov Closes: https://lore.kernel.org/netdev/CAJEV1ijxNyPTwASJER1bcZzS9nMoZJqfR86nu_3jFFVXzZQ4NA@mail.gmail.com/ Fixes: 024aa5800f32 ("ixgbe: added Rx/Tx ring disable/enable functions") Signed-off-by: Maciej Fijalkowski Acked-by: Magnus Karlsson Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 6dc554e810a17..086cc25730338 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2947,8 +2947,8 @@ static void ixgbe_check_lsc(struct ixgbe_adapter *adapter) static inline void ixgbe_irq_enable_queues(struct ixgbe_adapter *adapter, u64 qmask) { - u32 mask; struct ixgbe_hw *hw = &adapter->hw; + u32 mask; switch (hw->mac.type) { case ixgbe_mac_82598EB: @@ -10543,6 +10543,44 @@ static void ixgbe_reset_rxr_stats(struct ixgbe_ring *rx_ring) memset(&rx_ring->rx_stats, 0, sizeof(rx_ring->rx_stats)); } +/** + * ixgbe_irq_disable_single - Disable single IRQ vector + * @adapter: adapter structure + * @ring: ring index + **/ +static void ixgbe_irq_disable_single(struct ixgbe_adapter *adapter, u32 ring) +{ + struct ixgbe_hw *hw = &adapter->hw; + u64 qmask = BIT_ULL(ring); + u32 mask; + + switch (adapter->hw.mac.type) { + case ixgbe_mac_82598EB: + mask = qmask & IXGBE_EIMC_RTX_QUEUE; + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, mask); + break; + case ixgbe_mac_82599EB: + case ixgbe_mac_X540: + case ixgbe_mac_X550: + case ixgbe_mac_X550EM_x: + case ixgbe_mac_x550em_a: + mask = (qmask & 0xFFFFFFFF); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(0), mask); + mask = (qmask >> 32); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(1), mask); + break; + default: + break; + } + IXGBE_WRITE_FLUSH(&adapter->hw); + if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) + synchronize_irq(adapter->msix_entries[ring].vector); + else + synchronize_irq(adapter->pdev->irq); +} + /** * ixgbe_txrx_ring_disable - Disable Rx/Tx/XDP Tx rings * @adapter: adapter structure @@ -10559,6 +10597,11 @@ void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring) tx_ring = adapter->tx_ring[ring]; xdp_ring = adapter->xdp_ring[ring]; + ixgbe_irq_disable_single(adapter, ring); + + /* Rx/Tx/XDP Tx share the same napi context. */ + napi_disable(&rx_ring->q_vector->napi); + ixgbe_disable_txr(adapter, tx_ring); if (xdp_ring) ixgbe_disable_txr(adapter, xdp_ring); @@ -10567,9 +10610,6 @@ void ixgbe_txrx_ring_disable(struct ixgbe_adapter *adapter, int ring) if (xdp_ring) synchronize_rcu(); - /* Rx/Tx/XDP Tx share the same napi context. */ - napi_disable(&rx_ring->q_vector->napi); - ixgbe_clean_tx_ring(tx_ring); if (xdp_ring) ixgbe_clean_tx_ring(xdp_ring); @@ -10597,9 +10637,6 @@ void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring) tx_ring = adapter->tx_ring[ring]; xdp_ring = adapter->xdp_ring[ring]; - /* Rx/Tx/XDP Tx share the same napi context. */ - napi_enable(&rx_ring->q_vector->napi); - ixgbe_configure_tx_ring(adapter, tx_ring); if (xdp_ring) ixgbe_configure_tx_ring(adapter, xdp_ring); @@ -10608,6 +10645,11 @@ void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring) clear_bit(__IXGBE_TX_DISABLED, &tx_ring->state); if (xdp_ring) clear_bit(__IXGBE_TX_DISABLED, &xdp_ring->state); + + /* Rx/Tx/XDP Tx share the same napi context. */ + napi_enable(&rx_ring->q_vector->napi); + ixgbe_irq_enable_queues(adapter, BIT_ULL(ring)); + IXGBE_WRITE_FLUSH(&adapter->hw); } /** -- 2.43.0