Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1875262lql; Wed, 13 Mar 2024 10:27:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWK1oSlZkxM6q1DHp+6rW8VgC4l3vAEjGLZ56Ti19Qn87CA6JryCpAvrSw24BzuhcrN1elVYw4qsMUT4RR6YfefEBO4QNBK2dnk0cmhwg== X-Google-Smtp-Source: AGHT+IE1Yl3DVxWeH/4QJ2GhbfmVK4OOcF1s5luXjAXLHWv/0y6Msaxxh9fJvwpz5NVnH1nk+gB+ X-Received: by 2002:a17:906:2ccb:b0:a41:3e39:b918 with SMTP id r11-20020a1709062ccb00b00a413e39b918mr8423862ejr.24.1710350842996; Wed, 13 Mar 2024 10:27:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710350842; cv=pass; d=google.com; s=arc-20160816; b=i+WgwpLEzuQtEHeSuwtRbPTvqOGpZ2S+09zJ03zcSqs26rwOqYM74N5sKEhvxS5Nvn ApugQ3eJovgBbTC2pyoTHAHBE2BLymzajuopubpyOHMXZyUh4UCP8NLfcmC1mHiZoQuZ OKhUQz/9naQ84/0z3HXUlrEvzMJx51hM60enSyZJQZD88x6j6O6wW5MZuqFuSzrhJD5d N2RXH/uoTQIDZNIWBF1sZVfMOukJdAoymxklNRzpPT+cSLFsZ0F7Vyqz2AyaWV9RClF1 SHODni/pNp/AVMaBSbWXKODjbDFfigYJiXD2vUrybqK9r546thmLeGo1+6eScsfvgObR h2Cg== 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=39iX3oy4JXEvhLkcf9G16rN7zoqts8chR6rIR90vzZA=; fh=ClnbtZbQUfnZ6fl0RTx4gOPYpHYZQKgNVA4YkNULt8g=; b=FvAsRv7+BfWe8f4osZVcBViaZqvmdF1hFXVFj1NChVozjOo9oVkVxAFUxYLFI5Tbgt uydKnMvbEphoN12KasFVjKLiBApiir7shlQOhXx9CBaot1n3l8hYKNaqzT1ldtrhZqDM ETJcYWSgyoRbs1hF8mTlrAQLyYb+h+onR9/zdR7lmhmBqQhNAYfKBabYsRHcikM6fYPw VUQBfwbYz54zrJGGJqkKCXPL3UwYoO3sf8RlHCXzFF3CKp8+awSEzkazpRSJvg77OK7R 6PCCnK3W15+tL+Jj2SdjV+u1CnAQ139k01UDY9/9Pv9mhOrKEGLl8SRBREhEEafOhh1I Rc6A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r6LMPOsB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101944-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101944-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n17-20020a170906725100b00a45ac05036bsi4560809ejk.311.2024.03.13.10.27.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101944-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r6LMPOsB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101944-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101944-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 am.mirrors.kernel.org (Postfix) with ESMTPS id EAA951F228D2 for ; Wed, 13 Mar 2024 17:22:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DDA7A629FF; Wed, 13 Mar 2024 16:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r6LMPOsB" 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 EC1ED6280A; Wed, 13 Mar 2024 16:42:31 +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=1710348152; cv=none; b=UjJb0BtmqKIA8IyIXB8KKef3TGwBeBvHfsRZ9s4Yp7pKof4dtRzwyYpGQl56gBVe3qOHELws4V08Ar4/mv3KUG0G4YyOtQGKHTuf7WtpDdTZmTZL66egKY9wd1hcDy6gEkYv0EMWRIfu8mGHFELEnAXDcWILyV73Jhtgowsn+bU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348152; c=relaxed/simple; bh=tDLapTrYVVfBn92f5DQJ5rKP0LhQm5cgNKUSlLYd3iQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qmLxpNpCqEisPqEqlTcsm+cFK4vs0CaRzku7X7Vr2w7YakB/SEoPjbx8K/JikKgp/bY0KCOkZBSlBKYUtWESsuX3GloT5pvkM0J7CBGJS0spyTbL/kKM+osDJdD6w6ONDF3aRiKAw6CYOic9ezUY6q4yVyO8gPRyBKkyHhpOUjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r6LMPOsB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C842C43390; Wed, 13 Mar 2024 16:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348151; bh=tDLapTrYVVfBn92f5DQJ5rKP0LhQm5cgNKUSlLYd3iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6LMPOsBJ+qptjWCiw5gNr5XtEz3QSKAKMP//cjFh+DIO0iMscGtYHIsXkKk9zkpg +kZiFbzLD6/KWqfkeio8sDP17WvMEtytcvaZwI7BIca/GOsDxrlocdkSOlYPaFhSOf fdC5JhD5sWM3t7gH7d477T/WPd1PdVh8/JfbU5GNJjpw/Cy4NBBdAiXXP3RLIPunAP piShabUAyc5HzTsa7c+8AyvThpSgFXiDzelp1G/3nF9gQkyLs8z3eKii/Bks/prDX9 5KuRvNcpT03SmrWTb6y0+hKn0O+4+0Kz+tRqeCh6ZpierBB9+wfiLE5YfHs/F+DVrK 8XSrsOKDovOXw== 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 5.15 04/76] ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able Date: Wed, 13 Mar 2024 12:41:11 -0400 Message-ID: <20240313164223.615640-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164223.615640-1-sashal@kernel.org> References: <20240313164223.615640-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/v5.x/stable-review/patch-5.15.152-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.15.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.15.152-rc1 X-KernelTest-Deadline: 2024-03-15T16:42+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 cb9e9d70b338c..d7eabc526f782 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2941,8 +2941,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: @@ -10380,6 +10380,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 @@ -10396,6 +10434,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); @@ -10404,9 +10447,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); @@ -10434,9 +10474,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); @@ -10445,6 +10482,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