Why bother? This is not critical path. Original code looked fine On Thu, May 8, 2025, 11:34 Sunyang Wu wrote: > Set the values of the promiscuous and all_multicast variables > according to the return value. > > Signed-off-by: Sunyang Wu > --- > lib/ethdev/rte_ethdev.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index d4197322a0..b1f593edc4 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -3044,10 +3044,8 @@ rte_eth_promiscuous_disable(uint16_t port_id) > if (dev->dev_ops->promiscuous_disable == NULL) > return -ENOTSUP; > > - dev->data->promiscuous = 0; > diag = dev->dev_ops->promiscuous_disable(dev); > - if (diag != 0) > - dev->data->promiscuous = 1; > + dev->data->promiscuous = (diag == 0) ? 0 : 1; > > diag = eth_err(port_id, diag); > > @@ -3112,10 +3110,9 @@ rte_eth_allmulticast_disable(uint16_t port_id) > > if (dev->dev_ops->allmulticast_disable == NULL) > return -ENOTSUP; > - dev->data->all_multicast = 0; > + > diag = dev->dev_ops->allmulticast_disable(dev); > - if (diag != 0) > - dev->data->all_multicast = 1; > + dev->data->all_multicast = (diag == 0) ? 0 : 1; > > diag = eth_err(port_id, diag); > > -- > 2.19.0.rc0.windows.1 > >