DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sid Ali Cherrati <scherrati1@gmail.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
	Sid Ali Cherrati <scherrati1@gmail.com>,
	stable@dpdk.org
Subject: [PATCH v2 2/2] net/ixgbe: fix return value of close operation
Date: Wed, 15 Jul 2026 14:48:16 +0200	[thread overview]
Message-ID: <20260715124816.19882-2-scherrati1@gmail.com> (raw)
In-Reply-To: <20260715124816.19882-1-scherrati1@gmail.com>

rte_intr_callback_unregister() returns the number of unregistered
callbacks on success. Since the close operation started returning
the ret variable instead of 0, this positive value leaks as the
return value of ixgbe_dev_close(), so applications checking
rte_eth_dev_close() != 0 treat a successful close as a failure.

Use a separate cb_ret variable for the unregister return value so a
successful unregister never clobbers the dev_stop() error already
stored in ret, and stop retrying once unregister fails with anything
other than -EAGAIN, since those errors are not transient.

Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
Cc: stable@dpdk.org

Signed-off-by: Sid Ali Cherrati <scherrati1@gmail.com>
---
v2: use a temporary cb_ret variable instead of unconditionally zeroing
    ret, and stop retrying on a non-transient unregister error, so an
    earlier error is not lost or masked by a successful/failed
    unregister

 drivers/net/intel/ixgbe/ixgbe_ethdev.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index c5010f623c..9433515b85 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -3095,6 +3095,7 @@ ixgbe_dev_close(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
 	int retries = 0;
 	int ret;
+	int cb_ret;
 
 	PMD_INIT_FUNC_TRACE();
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
@@ -3118,14 +3119,17 @@ ixgbe_dev_close(struct rte_eth_dev *dev)
 	rte_intr_disable(intr_handle);
 
 	do {
-		ret = rte_intr_callback_unregister(intr_handle,
+		cb_ret = rte_intr_callback_unregister(intr_handle,
 				ixgbe_dev_interrupt_handler, dev);
-		if (ret >= 0 || ret == -ENOENT) {
+		if (cb_ret >= 0 || cb_ret == -ENOENT) {
 			break;
-		} else if (ret != -EAGAIN) {
+		} else if (cb_ret != -EAGAIN) {
 			PMD_INIT_LOG(ERR,
 				"intr callback unregister failed: %d",
-				ret);
+				cb_ret);
+			if (ret == 0)
+				ret = cb_ret;
+			break;
 		}
 		rte_delay_ms(100);
 	} while (retries++ < (10 + IXGBE_LINK_UP_TIME));
-- 
2.34.1


      reply	other threads:[~2026-07-15 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 13:46 [PATCH 1/2] net/i40e: fix return value of close operation SidAli CHERRATI
2026-07-10 13:46 ` [PATCH 2/2] net/ixgbe: " SidAli CHERRATI
2026-07-10 15:26   ` Bruce Richardson
2026-07-15 12:48 ` [PATCH v2 1/2] net/i40e: " Sid Ali Cherrati
2026-07-15 12:48   ` Sid Ali Cherrati [this message]

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=20260715124816.19882-2-scherrati1@gmail.com \
    --to=scherrati1@gmail.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /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