DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	stable@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>,
	Harman Kalra <hkalra@marvell.com>,
	David Marchand <david.marchand@redhat.com>
Subject: [PATCH 2/4] net/i40e: handle Rx interrupt vector lookup errors
Date: Thu, 26 Nov 2026 13:29:06 +0000	[thread overview]
Message-ID: <20261126132909.3488716-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20261126132909.3488716-1-bruce.richardson@intel.com>

The Rx interrupt enable and disable callbacks store the result of
`rte_intr_vec_list_index_get()` in a `uint16_t`. If the lookup fails,
the negative error code becomes a large vector index, and the driver
writes to the wrong register instead of reporting the failure.

Keep the result signed and return the lookup error before accessing
the hardware.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/intel/i40e/i40e_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/i40e/i40e_ethdev.c b/drivers/net/intel/i40e/i40e_ethdev.c
index 5ea26c3348..0f3295fb3c 100644
--- a/drivers/net/intel/i40e/i40e_ethdev.c
+++ b/drivers/net/intel/i40e/i40e_ethdev.c
@@ -10346,9 +10346,11 @@ i40e_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 	struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint16_t msix_intr;
+	const int msix_intr = rte_intr_vec_list_index_get(intr_handle, queue_id);
+
+	if (msix_intr < 0)
+		return msix_intr;
 
-	msix_intr = rte_intr_vec_list_index_get(intr_handle, queue_id);
 	if (msix_intr == I40E_MISC_VEC_ID)
 		I40E_WRITE_REG(hw, I40E_PFINT_DYN_CTL0,
 			       I40E_PFINT_DYN_CTL0_INTENA_MASK |
@@ -10374,9 +10376,11 @@ i40e_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 	struct rte_pci_device *pci_dev = RTE_CLASS_TO_BUS_DEVICE(dev, *pci_dev);
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	uint16_t msix_intr;
+	const int msix_intr = rte_intr_vec_list_index_get(intr_handle, queue_id);
+
+	if (msix_intr < 0)
+		return msix_intr;
 
-	msix_intr = rte_intr_vec_list_index_get(intr_handle, queue_id);
 	if (msix_intr == I40E_MISC_VEC_ID)
 		I40E_WRITE_REG(hw, I40E_PFINT_DYN_CTL0,
 			       I40E_PFINT_DYN_CTL0_ITR_INDX_MASK);
-- 
2.55.0


  parent reply	other threads:[~2026-11-26 13:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 13:29 [PATCH 0/4] net/i40e: fix interrupt support Bruce Richardson
2026-11-26 13:29 ` [PATCH 1/4] net/i40e: fix VMDq Rx interrupt vector mapping Bruce Richardson
2026-11-26 13:29 ` Bruce Richardson [this message]
2026-11-26 13:29 ` [PATCH 3/4] net/i40e: disallow interrupt support in secondaries Bruce Richardson
2026-11-26 13:29 ` [PATCH 4/4] net/i40e: fix Rx desc write-back with interrupts disabled Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126132909.3488716-3-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=hyonkim@cisco.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox