DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sunyang Wu <sunyang.wu@jaguarmicro.com>
To: dev@dpdk.org
Cc: chas3@att.com
Subject: [PATCH] net/bonding: check return value when enable/disable promisc mode
Date: Fri, 20 Dec 2024 15:08:11 +0800	[thread overview]
Message-ID: <20241220070811.40124-1-sunyang.wu@jaguarmicro.com> (raw)

Add validation for the return value of rte_eth_promiscuous_enable
and rte_eth_promiscuous_disable.

Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 91bf2c2345..f69496feec 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2783,6 +2783,7 @@ bond_ethdev_promiscuous_update(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	uint16_t port_id = internals->current_primary_port;
+	int ret;
 
 	switch (internals->mode) {
 	case BONDING_MODE_ROUND_ROBIN:
@@ -2802,10 +2803,19 @@ bond_ethdev_promiscuous_update(struct rte_eth_dev *dev)
 		 * mode should be set to new primary member according to bonding
 		 * device.
 		 */
-		if (rte_eth_promiscuous_get(internals->port_id) == 1)
-			rte_eth_promiscuous_enable(port_id);
-		else
-			rte_eth_promiscuous_disable(port_id);
+		if (rte_eth_promiscuous_get(internals->port_id) == 1) {
+			ret = rte_eth_promiscuous_enable(port_id);
+			if (ret != 0)
+				RTE_BOND_LOG(ERR,
+					     "Failed to enable promiscuous mode for port %u: %s",
+					     port_id, rte_strerror(-ret));
+		} else {
+			ret = rte_eth_promiscuous_disable(port_id);
+			if (ret != 0)
+				RTE_BOND_LOG(ERR,
+					     "Failed to disable promiscuous mode for port %u: %s",
+					     port_id, rte_strerror(-ret));
+		}
 	}
 
 	return 0;
-- 
2.19.0.rc0.windows.1


                 reply	other threads:[~2024-12-20  7:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20241220070811.40124-1-sunyang.wu@jaguarmicro.com \
    --to=sunyang.wu@jaguarmicro.com \
    --cc=chas3@att.com \
    --cc=dev@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;
as well as URLs for NNTP newsgroup(s).