* [PATCH] net/bonding: check return value when enable/disable promisc mode
@ 2024-12-20 7:08 Sunyang Wu
0 siblings, 0 replies; only message in thread
From: Sunyang Wu @ 2024-12-20 7:08 UTC (permalink / raw)
To: dev; +Cc: chas3
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-20 7:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-20 7:08 [PATCH] net/bonding: check return value when enable/disable promisc mode Sunyang Wu
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).