DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Chas Williams <3chas3@gmail.com>,
	"Min Hu (Connor)" <humin29@huawei.com>,
	Tomasz Kulasek <tomaszx.kulasek@intel.com>,
	Declan Doherty <declan.doherty@intel.com>
Subject: [PATCH 1/3] net/bonding: restore dedicated queue state on mode set error
Date: Fri, 17 Apr 2026 09:51:35 -0700	[thread overview]
Message-ID: <20260417165530.653328-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20260417165530.653328-1-stephen@networkplumber.org>

The calls to enable and disable dedicated queues are missing
proper error handling. If setting bonding mode fails,
restore original state and propagate the error return value.

Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index ba88f6d261..a74b0059ac 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -1727,7 +1727,7 @@ RTE_EXPORT_SYMBOL(rte_eth_bond_8023ad_dedicated_queues_enable)
 int
 rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port)
 {
-	int retval = 0;
+	int ret;
 	struct rte_eth_dev *dev;
 	struct bond_dev_private *internals;
 
@@ -1744,17 +1744,20 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port)
 	if (dev->data->dev_started)
 		return -1;
 
+	uint8_t old = internals->mode4.dedicated_queues.enabled;
 	internals->mode4.dedicated_queues.enabled = 1;
+	ret = bond_ethdev_mode_set(dev, internals->mode);
+	if (ret != 0)
+		internals->mode4.dedicated_queues.enabled = old;
 
-	bond_ethdev_mode_set(dev, internals->mode);
-	return retval;
+	return ret;
 }
 
 RTE_EXPORT_SYMBOL(rte_eth_bond_8023ad_dedicated_queues_disable)
 int
 rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 {
-	int retval = 0;
+	int ret;
 	struct rte_eth_dev *dev;
 	struct bond_dev_private *internals;
 
@@ -1768,9 +1771,11 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port)
 	if (dev->data->dev_started)
 		return -1;
 
+	uint8_t old = internals->mode4.dedicated_queues.enabled;
 	internals->mode4.dedicated_queues.enabled = 0;
+	ret = bond_ethdev_mode_set(dev, internals->mode);
+	if (ret != 0)
+		internals->mode4.dedicated_queues.enabled = old;
 
-	bond_ethdev_mode_set(dev, internals->mode);
-
-	return retval;
+	return ret;
 }
-- 
2.53.0


  reply	other threads:[~2026-04-17 16:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17 16:51 [PATCH 0/3] net/bond: fix secondary process crash and related cleanup Stephen Hemminger
2026-04-17 16:51 ` Stephen Hemminger [this message]
2026-04-17 16:51 ` [PATCH 2/3] net/bonding: prevent crash on Rx/Tx from secondary process Stephen Hemminger
2026-04-17 16:51 ` [PATCH 3/3] net/bonding: remove redundant function names from log Stephen Hemminger
2026-05-08 17:59 ` [PATCH 0/3] net/bond: fix secondary process crash and related cleanup Stephen Hemminger

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=20260417165530.653328-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=3chas3@gmail.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    --cc=stable@dpdk.org \
    --cc=tomaszx.kulasek@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