Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1937391lql; Wed, 13 Mar 2024 12:22:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWPPCDFbIBX7iwhDftOIrB/aRz4WwLFZews/9XXqjpSzZb1JIxJUheT63MjI6N1TTKqTHMEstWKGr4kNrYVLIiobgCle8tji5wO9mHoEg== X-Google-Smtp-Source: AGHT+IFNrqTRCA9IHzUkDOLGTUwm3FnhIRU7dlWc3pG+IrPsCaskdNNelRQKnumOm2RyyR9vnOBh X-Received: by 2002:a05:6512:e96:b0:513:b1de:8a17 with SMTP id bi22-20020a0565120e9600b00513b1de8a17mr7028904lfb.63.1710357778732; Wed, 13 Mar 2024 12:22:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710357778; cv=pass; d=google.com; s=arc-20160816; b=DW2ySuJNkO9TsDgGm5JNWXLgfPO2mjSSeW1BU926N84vojB1S2DCLZx6qGGT1HNie5 hP/Aot7DeVXEmfbrG0CXdHicBozQp5JWq413pX8rASGHya1FaKoLyOvnCUttulLb+Tep o5LWDXvorfavcnll2shc3Q6y9NzjqcyZ/KZ2msHBrGSQ7fFBYKICRpDMBmHSnZ1sNXPq sl1/j+QxR/VlvSYQjIRUPwAEUZosvpTR2OsXXHaA3ZDbMy13aaeq0zFiYjTfz234x8WB Hkrl2lT+mVH4f9tupG/V9cU50AMhpeixAKKRdpEh15uU6O51zru4s2hill5Mft2Wx0Qu ap1g== 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=YpLejdYWfyVnBPtCYVn8ATSoAxt1vnG3fuCcmjfOCoM=; fh=ClnbtZbQUfnZ6fl0RTx4gOPYpHYZQKgNVA4YkNULt8g=; b=NMr+3kA1BqCn+iZ4us1L0ZcWbuMf9IWvN3mv9i8o607SS2oy2m+BkTaeNTHs+jo6lj HuEDJZiC1zPUcsEhAE4wF9+VCP1TdaaecH434bFSL2Tgzkp8BnlpBoYjSNGBXz3zOQ5/ 0N/fAGXW46omq55vHNV8ISGjcG9RpAJzIIjiL44ASxPAyKAA84lF3FYY3mLRhlOHmgBv FX11mnTvzNMC2DuPR2YGgukthEFPX0uiVO3+6qXO7La9hcwQRh+UASFAa+uiWATv4rkA gFXqUgOcZOLwLYcfH9s5s5KrfmVpEwj+J9YUFPAbjMvdi4cZbbspbHe+CgbKCweoAHWF W11Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t+BWWnFA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102032-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102032-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 s15-20020a170906454f00b00a4652723d04si1086027ejq.390.2024.03.13.12.22.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:22:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102032-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=t+BWWnFA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102032-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102032-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 5446B1F2413F for ; Wed, 13 Mar 2024 17:42:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28F8C67C5A; Wed, 13 Mar 2024 16:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t+BWWnFA" 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 32EB767A12; Wed, 13 Mar 2024 16:46:52 +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=1710348412; cv=none; b=W7v6fzzBq80OKhQ+1wimmqK22zNz0Z6NMw7lFba55GiJYvA8sjuV4BDt+e4FXy3PF0CPTwQ1K/jdGOThPWj6Z+9ir0x5zWADJkObQgXUFRGwe6i2aXsDDKXAcVLxGXFwXAetKh1okP88jRtBbkDPo7F1Wd4EuRdCx8Tbw1thUIQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348412; c=relaxed/simple; bh=2qIOP+mIMziKVTG/sY6v8n7h17Tczgn5igYdDCbNxuM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rzk+OUBACh7Zb+oajIb+nO9eUIpo5YQP+W/WLWxUMTlAaPcj4AY4N5SRnfDpQoJUx52ZhfAF2qrY7nUsFP+Y5VqbLbSb3dJDpSmrzIG8EJOMEHpxTvgJjzey9OaLsf2jYjMvKHbxGx6nVfTIT7ISF/sMPoEppmS9v5yG3uD5l5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t+BWWnFA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02450C43399; Wed, 13 Mar 2024 16:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348412; bh=2qIOP+mIMziKVTG/sY6v8n7h17Tczgn5igYdDCbNxuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+BWWnFAYoxQtlVPvwgX7FOEhxDRnhop93bSbSXC1dw6JCwBP7HF/keWhL4i89lK5 N4lyNcHc+7EgGcVe+DjkujttxBICm/iKf9qz7sGJV1jMSiSxqmqbGsfbWL1W0xEftU 49hub2Kce+TtrVJVEiksXvHqVVrszASy6q4CWHCpI03ITapHiZJqajGdk0W0+q+mJ0 9DuVjBjKoMnY7FzC5pDTf8hKTSmynWtLbW5lVYs0I5DhrJnVylJpa95jdWHsXU/MA7 3rrF9VxSxvrIryArjPEzgeTXhMXseC5ZdU7mJYeQKHf5EWbJ5QeyurkCToTKeOAshB DoL605tzxWohw== 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.10 08/73] ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able Date: Wed, 13 Mar 2024 12:45:35 -0400 Message-ID: <20240313164640.616049-9-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164640.616049-1-sashal@kernel.org> References: <20240313164640.616049-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.10.213-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.213-rc1 X-KernelTest-Deadline: 2024-03-15T16:46+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 b16cb2365d960..b7672200dc624 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2949,8 +2949,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: @@ -10394,6 +10394,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 @@ -10410,6 +10448,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); @@ -10418,9 +10461,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); @@ -10448,9 +10488,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); @@ -10459,6 +10496,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