DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status
@ 2019-09-05 16:10 Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
                   ` (14 more replies)
  0 siblings, 15 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, Rasesh Mody, Shahed Shaikh, Wenzhuo Lu
  Cc: dev, Ivan Ilchenko

It is the second patch series to get rid of void returning functions
in ethdev in accordance with deprecation notice [1].

It should be applied on top of the first one [2].
It could be applied separately, but few simple conflicts should
be resolved.

Functions which return void are bad since they do not provide explicit
information to the caller if everything is OK or not.
It is especially painful in the case of promiscuous mode since it is
not always supported, there are real cases when it fails to apply and
it affects traffic which is received by the port.

Driver maintainrs are encouraged to review the patch which changes
driver callbacks prototype. Changes are not always trivial when I tried
to provide real status of the operation. I used -EAGAIN when I failed
to choose better error code.

The following two drivers ignore status of internal functions and
definitely could be improved:

net/bnx2x: bnx2x_set_rx_mode() can report failure, but it is used in
other places and should be updated carefully.

net/igbvf: e1000_promisc_set_vf() provides return status, but it is
unclear how handle it properly.

[1] https://patches.dpdk.org/patch/56969/
[2] https://patches.dpdk.org/project/dpdk/list/?series=6222

Andrew Rybchenko (2):
  ethdev: change promiscuous callbacks to return status
  ethdev: do nothing if promiscuous mode is applied again

Ivan Ilchenko (11):
  ethdev: change promiscuous mode controllers to return errors
  net/failsafe: check code of promiscuous mode switch
  net/bonding: check code of promiscuous mode switch
  app/pipeline: check code of promiscuous mode switch
  app/testpmd: check code of promiscuous mode switch
  app/eventdev: check code of promiscuous mode switch
  app/pdump: check code of promiscuous mode switch
  app/test: check code of promiscuous mode switch
  kni: check code of promiscuous mode switch
  test/bonding: check code of promiscuous mode switch
  examples: take promiscuous mode switch result into account

 app/pdump/main.c                              |  8 +-
 app/test-eventdev/test_perf_common.c          |  7 +-
 app/test-eventdev/test_pipeline_common.c      |  7 +-
 app/test-pipeline/init.c                      |  5 +-
 app/test-pmd/cmdline.c                        | 23 +++---
 app/test-pmd/testpmd.c                        | 14 +++-
 app/test-pmd/testpmd.h                        |  2 +
 app/test-pmd/util.c                           | 16 ++++
 app/test/test_event_eth_rx_adapter.c          |  4 +-
 app/test/test_event_eth_tx_adapter.c          |  4 +-
 app/test/test_kni.c                           |  7 +-
 app/test/test_link_bonding.c                  | 55 +++++++++++---
 app/test/test_link_bonding_mode4.c            | 16 +++-
 app/test/test_pmd_perf.c                      |  6 +-
 app/test/virtual_pmd.c                        | 12 ++-
 doc/guides/rel_notes/deprecation.rst          |  1 -
 doc/guides/rel_notes/release_19_11.rst        |  4 +
 doc/guides/sample_app_ug/flow_classify.rst    |  6 +-
 doc/guides/sample_app_ug/flow_filtering.rst   | 15 +++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst   |  5 +-
 doc/guides/sample_app_ug/skeleton.rst         |  6 +-
 drivers/net/af_packet/rte_eth_af_packet.c     | 22 ++++--
 drivers/net/af_xdp/rte_eth_af_xdp.c           | 20 +++--
 drivers/net/atlantic/atl_ethdev.c             | 12 ++-
 drivers/net/avp/avp_ethdev.c                  | 12 ++-
 drivers/net/axgbe/axgbe_ethdev.c              | 12 ++-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  8 +-
 drivers/net/bnxt/bnxt_ethdev.c                | 26 +++++--
 drivers/net/bonding/rte_eth_bond_8023ad.c     | 17 ++++-
 drivers/net/bonding/rte_eth_bond_pmd.c        | 74 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c              | 12 +--
 drivers/net/cxgbe/cxgbe_pfvf.h                |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  8 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              | 12 ++-
 drivers/net/e1000/em_ethdev.c                 | 12 ++-
 drivers/net/e1000/igb_ethdev.c                | 24 ++++--
 drivers/net/enetc/enetc_ethdev.c              |  8 +-
 drivers/net/enic/enic.h                       |  2 +-
 drivers/net/enic/enic_ethdev.c                | 22 ++++--
 drivers/net/enic/enic_main.c                  |  4 +-
 drivers/net/failsafe/failsafe_ether.c         |  8 +-
 drivers/net/failsafe/failsafe_ops.c           | 48 ++++++++++--
 drivers/net/fm10k/fm10k_ethdev.c              | 24 ++++--
 drivers/net/hinic/hinic_pmd_ethdev.c          | 16 +++-
 drivers/net/i40e/i40e_ethdev.c                | 35 ++++++---
 drivers/net/i40e/i40e_ethdev_vf.c             | 20 +++--
 drivers/net/i40e/i40e_vf_representor.c        |  8 +-
 drivers/net/iavf/iavf_ethdev.c                | 20 +++--
 drivers/net/ice/ice_ethdev.c                  | 27 +++++--
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |  8 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              | 50 +++++++++---
 drivers/net/liquidio/lio_ethdev.c             | 30 +++++---
 drivers/net/mlx4/mlx4.h                       |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c                | 24 ++++--
 drivers/net/mlx5/mlx5.h                       |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c                | 40 ++++++++--
 drivers/net/mvneta/mvneta_ethdev.c            | 22 ++++--
 drivers/net/mvpp2/mrvl_ethdev.c               | 28 +++++--
 drivers/net/netvsc/hn_ethdev.c                |  8 +-
 drivers/net/netvsc/hn_var.h                   |  4 +-
 drivers/net/netvsc/hn_vf.c                    | 22 +++++-
 drivers/net/nfb/nfb_rxmode.c                  | 10 ++-
 drivers/net/nfb/nfb_rxmode.h                  |  8 +-
 drivers/net/nfp/nfp_net.c                     | 30 +++++---
 drivers/net/octeontx/octeontx_ethdev.c        | 16 ++--
 drivers/net/octeontx2/otx2_ethdev.h           |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c       |  8 +-
 drivers/net/qede/qede_ethdev.c                | 16 ++--
 drivers/net/sfc/sfc_ethdev.c                  | 14 ++--
 drivers/net/szedata2/rte_eth_szedata2.c       |  6 +-
 drivers/net/tap/rte_eth_tap.c                 | 52 ++++++++++---
 drivers/net/thunderx/nicvf_ethdev.c           |  3 +-
 drivers/net/virtio/virtio_ethdev.c            | 24 ++++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c          | 12 ++-
 examples/bbdev_app/main.c                     |  7 +-
 examples/bond/main.c                          |  8 +-
 examples/distributor/main.c                   |  4 +-
 examples/eventdev_pipeline/main.c             |  4 +-
 examples/exception_path/main.c                |  5 +-
 examples/flow_classify/flow_classify.c        |  4 +-
 examples/flow_filtering/main.c                |  7 +-
 examples/ip_fragmentation/main.c              |  6 +-
 examples/ip_pipeline/link.c                   |  7 +-
 examples/ip_reassembly/main.c                 |  6 +-
 examples/ipsec-secgw/ipsec-secgw.c            |  9 ++-
 examples/kni/main.c                           |  9 ++-
 examples/l2fwd-cat/l2fwd-cat.c                |  4 +-
 examples/l2fwd-crypto/main.c                  |  7 +-
 examples/l2fwd-jobstats/main.c                |  9 ++-
 examples/l2fwd-keepalive/main.c               |  6 +-
 examples/l2fwd/main.c                         |  6 +-
 examples/l3fwd-acl/main.c                     |  9 ++-
 examples/l3fwd-power/main.c                   |  9 ++-
 examples/l3fwd/main.c                         |  9 ++-
 examples/link_status_interrupt/main.c         |  6 +-
 examples/load_balancer/init.c                 |  6 +-
 .../client_server_mp/mp_server/init.c         |  4 +-
 examples/multi_process/symmetric_mp/main.c    |  4 +-
 examples/netmap_compat/bridge/bridge.c        |  6 +-
 examples/packet_ordering/main.c               |  4 +-
 .../performance-thread/l3fwd-thread/main.c    |  9 ++-
 examples/ptpclient/ptpclient.c                |  7 +-
 examples/qos_meter/main.c                     | 12 ++-
 examples/qos_sched/init.c                     |  6 +-
 examples/quota_watermark/qw/init.c            |  6 +-
 examples/rxtx_callbacks/main.c                |  5 +-
 examples/server_node_efd/server/init.c        |  4 +-
 examples/skeleton/basicfwd.c                  |  4 +-
 examples/vhost/main.c                         | 11 ++-
 examples/vm_power_manager/main.c              |  4 +-
 lib/librte_ethdev/rte_ethdev.c                | 76 +++++++++++++++----
 lib/librte_ethdev/rte_ethdev.h                | 14 +++-
 lib/librte_ethdev/rte_ethdev_core.h           |  4 +-
 lib/librte_kni/rte_kni.c                      | 14 +++-
 115 files changed, 1152 insertions(+), 380 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Neil Horman, John McNamara, Marko Kovacevic, Bernard Iremonger,
	Ori Kam, Bruce Richardson, Pablo de Lara, Radu Nicolau,
	Akhil Goyal, Tomasz Kantecki, Harry van Haaren, Xiaoyun Li,
	Thomas Monjalon, Ferruh Yigit
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

Change rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable()
return value from void to int and return negative errno values
in case of error conditions.
Modify usage of these functions across the ethdev according
to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst        |  1 -
 doc/guides/rel_notes/release_19_11.rst      |  4 ++
 doc/guides/sample_app_ug/flow_classify.rst  |  6 ++-
 doc/guides/sample_app_ug/flow_filtering.rst | 15 +++++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst |  5 +-
 doc/guides/sample_app_ug/skeleton.rst       |  6 ++-
 lib/librte_ethdev/rte_ethdev.c              | 52 ++++++++++++++++-----
 lib/librte_ethdev/rte_ethdev.h              | 14 +++++-
 8 files changed, 80 insertions(+), 23 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index cbb4c34efd..b2e0a1fc7c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -88,7 +88,6 @@ Deprecation Notices
   negative errno values to indicate various error conditions (e.g.
   invalid port ID, unsupported operation, failed operation):
 
-  - ``rte_eth_promiscuous_enable`` and ``rte_eth_promiscuous_disable``
   - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable``
   - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
   - ``rte_eth_dev_stop``
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 152f120197..5299157df7 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -97,6 +97,10 @@ API Changes
 * ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` to
   ``int`` to provide a way to report various error conditions.
 
+* ethdev: changed ``rte_eth_promiscuous_enable`` and
+  ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
+  provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst
index 96a5c66d0f..7c2b6dcf83 100644
--- a/doc/guides/sample_app_ug/flow_classify.rst
+++ b/doc/guides/sample_app_ug/flow_classify.rst
@@ -315,7 +315,9 @@ Forwarding application is shown below:
                addr.addr_bytes[4], addr.addr_bytes[5]);
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+                return retval;
 
         return 0;
     }
@@ -343,7 +345,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-    rte_eth_promiscuous_enable(port);
+    retval = rte_eth_promiscuous_enable(port);
 
 The Add Rules function
 ~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst
index 02fc675506..de3e4ab0b6 100644
--- a/doc/guides/sample_app_ug/flow_filtering.rst
+++ b/doc/guides/sample_app_ug/flow_filtering.rst
@@ -193,7 +193,13 @@ application is shown below:
                    }
           }
 
-           rte_eth_promiscuous_enable(port_id);
+           ret = rte_eth_promiscuous_enable(port_id);
+           if (ret != 0) {
+                   rte_exit(EXIT_FAILURE,
+                           ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                           ret, port_id);
+           }
+
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -278,7 +284,12 @@ We are setting the RX port to promiscuous mode:
 
 .. code-block:: c
 
-   rte_eth_promiscuous_enable(port_id);
+   ret = rte_eth_promiscuous_enable(port_id);
+   if (ret != 0) {
+        rte_exit(EXIT_FAILURE,
+                 ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                 ret, port_id);
+   }
 
 The last step is to start the port.
 
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 32c120992f..0a69ec71ab 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -117,8 +117,9 @@ comments:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
-
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         /* Add the callbacks for RX and TX.*/
         rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst
index 59ca511d33..1d0a2760d4 100644
--- a/doc/guides/sample_app_ug/skeleton.rst
+++ b/doc/guides/sample_app_ug/skeleton.rst
@@ -149,7 +149,9 @@ Forwarding application is shown below:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         return 0;
     }
@@ -177,7 +179,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
 
 
 The Lcores Main
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 4b6cbe2343..0f6dedbe23 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1381,24 +1381,41 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev,
 	}
 }
 
-static void
+static int
 rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 			   struct rte_eth_dev_info *dev_info, uint16_t port_id)
 {
+	int ret;
+
 	if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1)
-		rte_eth_promiscuous_enable(port_id);
-	else if (rte_eth_promiscuous_get(port_id) == 0)
-		rte_eth_promiscuous_disable(port_id);
+	if (rte_eth_promiscuous_get(port_id) == 1) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to enable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	} else if (rte_eth_promiscuous_get(port_id) == 0) {
+		ret = rte_eth_promiscuous_disable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to disable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	}
 
 	/* replay all multicast configuration */
 	if (rte_eth_allmulticast_get(port_id) == 1)
 		rte_eth_allmulticast_enable(port_id);
 	else if (rte_eth_allmulticast_get(port_id) == 0)
 		rte_eth_allmulticast_disable(port_id);
+
+	return 0;
 }
 
 int
@@ -1436,7 +1453,14 @@ rte_eth_dev_start(uint16_t port_id)
 	else
 		return eth_err(port_id, diag);
 
-	rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	ret = rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	if (ret != 0) {
+		RTE_ETHDEV_LOG(ERR,
+			"Error during restoring configuration for device (port %u): %s\n",
+			port_id, rte_strerror(-ret));
+		rte_eth_dev_stop(port_id);
+		return ret;
+	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
@@ -1864,30 +1888,34 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	return eth_err(port_id, ret);
 }
 
-void
+int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
+
+	return 0;
 }
 
-void
+int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
+
+	return 0;
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index eda9e5c628..56e47b96be 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2022,16 +2022,26 @@ int rte_eth_dev_reset(uint16_t port_id);
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_enable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_enable(uint16_t port_id);
+int rte_eth_promiscuous_enable(uint16_t port_id);
 
 /**
  * Disable receipt in promiscuous mode for an Ethernet device.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_disable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_disable(uint16_t port_id);
+int rte_eth_promiscuous_disable(uint16_t port_id);
 
 /**
  * Return the value of promiscuous mode for an Ethernet device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:25   ` Gaëtan Rivet
                     ` (2 more replies)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 03/13] net/bonding: " Andrew Rybchenko
                   ` (12 subsequent siblings)
  14 siblings, 3 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Gaetan Rivet; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/failsafe according to new return type.

Try to keep promiscuous mode consistent across all active
devices in the case of failure.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/failsafe/failsafe_ether.c |  8 +++--
 drivers/net/failsafe/failsafe_ops.c   | 44 ++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 504c76edb0..bd38f1c1e4 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
 	if (dev->data->promiscuous != edev->data->promiscuous) {
 		DEBUG("Configuring promiscuous");
 		if (dev->data->promiscuous)
-			rte_eth_promiscuous_enable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
 		else
-			rte_eth_promiscuous_disable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		if (ret != 0) {
+			ERROR("Failed to apply promiscuous mode");
+			return ret;
+		}
 	} else {
 		DEBUG("promiscuous already set");
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index cc14bc2bcc..cbf143fb3c 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -659,11 +659,29 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_enable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+		if (ret != 0) {
+			ERROR("Promiscuous mode enable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+			if (ret != 0)
+				ERROR("Promiscuous mode disable failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
+
+	return;
 }
 
 static void
@@ -671,11 +689,29 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_disable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		if (ret != 0) {
+			ERROR("Promiscuous mode disable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+			if (ret != 0)
+				ERROR("Promiscuous mode enable failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
+
+	return;
 }
 
 static void
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 03/13] net/bonding: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/bonding according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 17 ++++++++++--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 34 +++++++++++++++++++----
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index fbc69051a9..7189a84585 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -913,6 +913,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
 static int
 bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	rte_eth_allmulticast_enable(slave_id);
 	if (rte_eth_allmulticast_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
@@ -922,7 +924,12 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 		return 0;
 	}
 
-	rte_eth_promiscuous_enable(slave_id);
+	ret = rte_eth_promiscuous_enable(slave_id);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"failed to enable promiscuous mode for port %u: %s",
+			slave_id, rte_strerror(-ret));
+	}
 	if (rte_eth_promiscuous_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u",
 			     slave_id);
@@ -937,6 +944,8 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 static void
 bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) {
 	case BOND_8023AD_FORCED_ALLMULTI:
 		RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id);
@@ -945,7 +954,11 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 
 	case BOND_8023AD_FORCED_PROMISC:
 		RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id);
-		rte_eth_promiscuous_disable(slave_id);
+		ret = rte_eth_promiscuous_disable(slave_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"failed to disable promiscuous mode for port %u: %s",
+				slave_id, rte_strerror(-ret));
 		break;
 
 	default:
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a994c9abd2..edf660db34 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2487,6 +2487,8 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
 	int i;
+	int ret = 0;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2495,9 +2497,13 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
-			rte_eth_promiscuous_enable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2508,7 +2514,12 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_enable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
@@ -2517,6 +2528,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
+	int ret;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2525,13 +2538,17 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
 					BOND_8023AD_FORCED_PROMISC)
 				continue;
-			rte_eth_promiscuous_disable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2542,7 +2559,12 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_disable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (2 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 03/13] net/bonding: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: John W. Linville, Xiaolong Ye, Qi Zhang, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Rasesh Mody, Shahed Shaikh, Ajit Khaparde, Somnath Kotur,
	Chas Williams, Rahul Lakkireddy, Hemant Agrawal, Sachin Saxena,
	Wenzhuo Lu, Gagandeep Singh, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon, Ferruh Yigit
  Cc: dev

Enabling/disabling of promiscuous mode is not always successful and
it should be taken into account to be able to handle it properly.

When correct return status is unclear from driver code, -EAGAIN is used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/virtual_pmd.c                    | 12 ++++--
 drivers/net/af_packet/rte_eth_af_packet.c | 22 ++++++----
 drivers/net/af_xdp/rte_eth_af_xdp.c       | 20 ++++++---
 drivers/net/atlantic/atl_ethdev.c         | 12 ++++--
 drivers/net/avp/avp_ethdev.c              | 12 ++++--
 drivers/net/axgbe/axgbe_ethdev.c          | 12 ++++--
 drivers/net/bnx2x/bnx2x_ethdev.c          |  8 +++-
 drivers/net/bnxt/bnxt_ethdev.c            | 26 +++++++++---
 drivers/net/bonding/rte_eth_bond_pmd.c    | 42 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c          | 12 +++---
 drivers/net/cxgbe/cxgbe_pfvf.h            |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c            |  8 +++-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 12 ++++--
 drivers/net/e1000/em_ethdev.c             | 12 ++++--
 drivers/net/e1000/igb_ethdev.c            | 24 +++++++----
 drivers/net/enetc/enetc_ethdev.c          |  8 +++-
 drivers/net/enic/enic.h                   |  2 +-
 drivers/net/enic/enic_ethdev.c            | 22 +++++++---
 drivers/net/enic/enic_main.c              |  4 +-
 drivers/net/failsafe/failsafe_ops.c       |  8 ++--
 drivers/net/fm10k/fm10k_ethdev.c          | 24 +++++++----
 drivers/net/hinic/hinic_pmd_ethdev.c      | 16 ++++++-
 drivers/net/i40e/i40e_ethdev.c            | 35 +++++++++++----
 drivers/net/i40e/i40e_ethdev_vf.c         | 20 ++++++---
 drivers/net/i40e/i40e_vf_representor.c    |  8 ++--
 drivers/net/iavf/iavf_ethdev.c            | 20 ++++++---
 drivers/net/ice/ice_ethdev.c              | 27 +++++++++---
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c   |  8 +++-
 drivers/net/ixgbe/ixgbe_ethdev.c          | 50 +++++++++++++++++-----
 drivers/net/liquidio/lio_ethdev.c         | 30 ++++++++-----
 drivers/net/mlx4/mlx4.h                   |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c            | 24 ++++++++---
 drivers/net/mlx5/mlx5.h                   |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c            | 40 ++++++++++++++---
 drivers/net/mvneta/mvneta_ethdev.c        | 22 +++++++---
 drivers/net/mvpp2/mrvl_ethdev.c           | 28 +++++++++---
 drivers/net/netvsc/hn_ethdev.c            |  8 ++--
 drivers/net/netvsc/hn_var.h               |  4 +-
 drivers/net/netvsc/hn_vf.c                | 22 ++++++++--
 drivers/net/nfb/nfb_rxmode.c              | 10 +++--
 drivers/net/nfb/nfb_rxmode.h              |  8 +++-
 drivers/net/nfp/nfp_net.c                 | 30 ++++++++-----
 drivers/net/octeontx/octeontx_ethdev.c    | 16 ++++---
 drivers/net/octeontx2/otx2_ethdev.h       |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  8 +++-
 drivers/net/qede/qede_ethdev.c            | 16 ++++---
 drivers/net/sfc/sfc_ethdev.c              | 14 +++---
 drivers/net/szedata2/rte_eth_szedata2.c   |  6 ++-
 drivers/net/tap/rte_eth_tap.c             | 52 ++++++++++++++++++-----
 drivers/net/thunderx/nicvf_ethdev.c       |  3 +-
 drivers/net/virtio/virtio_ethdev.c        | 24 +++++++----
 drivers/net/vmxnet3/vmxnet3_ethdev.c      | 12 ++++--
 lib/librte_ethdev/rte_ethdev.c            | 18 +++++---
 lib/librte_ethdev/rte_ethdev_core.h       |  4 +-
 55 files changed, 643 insertions(+), 262 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index e295891c06..b34df416a2 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -210,13 +210,17 @@ virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
 	memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
 }
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_enable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
 static int
 virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev,
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 66131b53e7..0495727281 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -458,41 +458,47 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-static void
+static int
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index aa716f3195..1da22ff866 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -750,37 +750,43 @@ static void
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index b056f8229a..5018529da1 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -24,8 +24,8 @@ static int  atl_dev_set_link_up(struct rte_eth_dev *dev);
 static int  atl_dev_set_link_down(struct rte_eth_dev *dev);
 static void atl_dev_close(struct rte_eth_dev *dev);
 static int  atl_dev_reset(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int  atl_dev_link_update(struct rte_eth_dev *dev, int wait);
@@ -1207,20 +1207,24 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, true);
+
+	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, false);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index c5801f319a..050901990c 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -45,8 +45,8 @@ static int avp_dev_info_get(struct rte_eth_dev *dev,
 			    struct rte_eth_dev_info *dev_info);
 static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
 
 static int avp_dev_rx_queue_setup(struct rte_eth_dev *dev,
 				  uint16_t rx_queue_id,
@@ -2157,7 +2157,7 @@ avp_dev_link_update(struct rte_eth_dev *eth_dev,
 	return -1;
 }
 
-static void
+static int
 avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2169,9 +2169,11 @@ avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
-static void
+static int
 avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2183,6 +2185,8 @@ avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 5a7da75126..c43b5bfb6f 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -15,8 +15,8 @@ static int  axgbe_dev_start(struct rte_eth_dev *dev);
 static void axgbe_dev_stop(struct rte_eth_dev *dev);
 static void axgbe_dev_interrupt_handler(void *param);
 static void axgbe_dev_close(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int axgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -236,7 +236,7 @@ axgbe_dev_close(struct rte_eth_dev *dev)
 	axgbe_dev_clear_queues(dev);
 }
 
-static void
+static int
 axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -244,9 +244,11 @@ axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
+
+	return 0;
 }
 
-static void
+static int
 axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -254,6 +256,8 @@ axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b7359514e5..07168e9a8a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -292,7 +292,7 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 	bnx2x_free_ilt_mem(sc);
 }
 
-static void
+static int
 bnx2x_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -302,9 +302,11 @@ bnx2x_promisc_enable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
-static void
+static int
 bnx2x_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -314,6 +316,8 @@ bnx2x_promisc_disable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b521a72963..7fff5d5b8f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1006,32 +1006,46 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	return rc;
 }
 
-static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
-static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
 static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index edf660db34..f9b7b595df 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1915,7 +1915,7 @@ bond_ethdev_primary_set(struct bond_dev_private *internals,
 		}
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev);
 
 static int
@@ -2482,7 +2482,7 @@ bond_ethdev_stats_reset(struct rte_eth_dev *dev)
 		rte_eth_stats_reset(internals->slaves[i].port_id);
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2495,7 +2495,9 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
@@ -2504,8 +2506,17 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				RTE_BOND_LOG(ERR,
 					"Failed to enable promiscuous mode for port %u: %s",
 					port_id, rte_strerror(-ret));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2521,14 +2532,16 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				"Failed to enable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
-static void
+static int
 bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
-	int ret;
+	int ret = 0;
 	uint16_t port_id;
 
 	switch (internals->mode) {
@@ -2536,21 +2549,34 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
-					BOND_8023AD_FORCED_PROMISC)
+					BOND_8023AD_FORCED_PROMISC) {
+				slave_ok++;
 				continue;
+			}
 			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));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2566,6 +2592,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 				"Failed to disable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 19c2a3c4db..be001a0d24 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -150,22 +150,22 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      1, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     1, -1, 1, -1, false);
 }
 
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      0, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     0, -1, 1, -1, false);
 }
 
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 011ec13860..bfa07ba555 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -12,8 +12,8 @@ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_close(struct rte_eth_dev *eth_dev);
 int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *device_info);
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr);
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 25deadb949..ad28c110d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -514,22 +514,26 @@ dpaa_xstats_get_names_by_id(
 	return limit;
 }
 
-static void dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_enable(dpaa_intf->fif);
+
+	return 0;
 }
 
-static void dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_disable(dpaa_intf->fif);
+
+	return 0;
 }
 
 static void dpaa_eth_multicast_enable(struct rte_eth_dev *dev)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 879bbc120d..d9cc2c3510 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -987,7 +987,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
 	rte_eth_linkstatus_set(dev, &link);
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_enable(
 		struct rte_eth_dev *dev)
 {
@@ -999,7 +999,7 @@ dpaa2_dev_promiscuous_enable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
@@ -1009,9 +1009,11 @@ dpaa2_dev_promiscuous_enable(
 	ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
 	if (ret < 0)
 		DPAA2_PMD_ERR("Unable to enable M promisc mode %d", ret);
+
+	return ret;
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_disable(
 		struct rte_eth_dev *dev)
 {
@@ -1023,7 +1025,7 @@ dpaa2_dev_promiscuous_disable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
@@ -1037,6 +1039,8 @@ dpaa2_dev_promiscuous_disable(
 			DPAA2_PMD_ERR("Unable to disable M promisc mode %d",
 				      ret);
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 305588f9b3..b23e840376 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -35,8 +35,8 @@ static int eth_em_configure(struct rte_eth_dev *dev);
 static int eth_em_start(struct rte_eth_dev *dev);
 static void eth_em_stop(struct rte_eth_dev *dev);
 static void eth_em_close(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_disable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_em_link_update(struct rte_eth_dev *dev,
@@ -1263,7 +1263,7 @@ em_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1273,9 +1273,11 @@ eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1289,6 +1291,8 @@ eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 6172f9ac64..a9f6de5d52 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -79,8 +79,8 @@ static int  eth_igb_dev_set_link_up(struct rte_eth_dev *dev);
 static int  eth_igb_dev_set_link_down(struct rte_eth_dev *dev);
 static void eth_igb_close(struct rte_eth_dev *dev);
 static int eth_igb_reset(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_disable(struct rte_eth_dev *dev);
 static int  eth_igb_link_update(struct rte_eth_dev *dev,
@@ -156,8 +156,8 @@ static int igbvf_dev_configure(struct rte_eth_dev *dev);
 static int igbvf_dev_start(struct rte_eth_dev *dev);
 static void igbvf_dev_stop(struct rte_eth_dev *dev);
 static void igbvf_dev_close(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_enable(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_disable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_enable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_disable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_enable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_igbvf_link_update(struct e1000_hw *hw);
@@ -2519,7 +2519,7 @@ igb_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2529,9 +2529,11 @@ eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2545,6 +2547,8 @@ eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
@@ -3390,16 +3394,18 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 	igbvf_default_mac_addr_set(dev, &addr);
 }
 
-static void
+static int
 igbvf_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	/* Set both unicast and multicast promisc */
 	e1000_promisc_set_vf(hw, e1000_promisc_enabled);
+
+	return 0;
 }
 
-static void
+static int
 igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3409,6 +3415,8 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 		e1000_promisc_set_vf(hw, e1000_promisc_multicast);
 	else
 		e1000_promisc_set_vf(hw, e1000_promisc_disabled);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dec42b9763..1ec66d0baf 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -523,7 +523,7 @@ enetc_dev_close(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 enetc_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -537,9 +537,11 @@ enetc_promiscuous_enable(struct rte_eth_dev *dev)
 	psipmr |= ENETC_PSIPMR_SET_UP(0) | ENETC_PSIPMR_SET_MP(0);
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
-static void
+static int
 enetc_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -555,6 +557,8 @@ enetc_promiscuous_disable(struct rte_eth_dev *dev)
 		psipmr &= (~ENETC_PSIPMR_SET_MP(0));
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 5a92508f00..72b1e7956b 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
 int enic_dev_stats_get(struct enic *enic,
 		       struct rte_eth_stats *r_stats);
 void enic_dev_stats_clear(struct enic *enic);
-void enic_add_packet_filter(struct enic *enic);
+int enic_add_packet_filter(struct enic *enic);
 int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
 int enic_del_mac_address(struct enic *enic, int mac_index);
 unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 90fdeda901..5d48930a9d 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -603,29 +603,39 @@ static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return NULL;
 }
 
-static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -ENOTSUP;
 
 	ENICPMD_FUNC_TRACE();
 
 	enic->promisc = 1;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 0;
+
+	return ret;
 }
 
-static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -ENOTSUP;
 
 	ENICPMD_FUNC_TRACE();
 	enic->promisc = 0;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 1;
+
+	return ret;
 }
 
 static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 40af3781b3..f4e76a057a 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
 			       enic->rss_enable);
 }
 
-void enic_add_packet_filter(struct enic *enic)
+int enic_add_packet_filter(struct enic *enic)
 {
 	/* Args -> directed, multicast, broadcast, promisc, allmulti */
-	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
+	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
 		enic->promisc, enic->allmulti);
 }
 
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index cbf143fb3c..8bc4dcebfd 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -654,7 +654,7 @@ fs_dev_free_queues(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -681,10 +681,10 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 	}
 	fs_unlock(dev, 0);
 
-	return;
+	return ret;
 }
 
-static void
+static int
 fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -711,7 +711,7 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 	}
 	fs_unlock(dev, 0);
 
-	return;
+	return ret;
 }
 
 static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8cb7337ea5..f0f6290089 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -44,8 +44,8 @@ int fm10k_logtype_init;
 int fm10k_logtype_driver;
 
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
-static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static inline int fm10k_glort_valid(struct fm10k_hw *hw);
@@ -908,7 +908,7 @@ static inline int fm10k_glort_valid(struct fm10k_hw *hw)
 		!= FM10K_DGLORTMAP_NONE);
 }
 
-static void
+static int
 fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -918,18 +918,22 @@ fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	fm10k_mbx_lock(hw);
 	status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
 				FM10K_XCAST_MODE_PROMISC);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -940,7 +944,7 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	if (dev->data->all_multicast == 1)
 		mode = FM10K_XCAST_MODE_ALLMULTI;
@@ -952,8 +956,12 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				mode);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 17a3625d63..c50cdd9f81 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1325,8 +1325,12 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1338,6 +1342,8 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, true);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Enable promiscuous failed");
+
+	return rc;
 }
 
 /**
@@ -1345,8 +1351,12 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1358,6 +1368,8 @@ static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, false);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Disable promiscuous failed");
+
+	return rc;
 }
 
 /**
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 390cb21964..79bd3a70c9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -223,8 +223,8 @@ static int i40e_dev_start(struct rte_eth_dev *dev);
 static void i40e_dev_stop(struct rte_eth_dev *dev);
 static void i40e_dev_close(struct rte_eth_dev *dev);
 static int  i40e_dev_reset(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40e_dev_set_link_up(struct rte_eth_dev *dev);
@@ -2564,7 +2564,7 @@ i40e_dev_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
-static void
+static int
 i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2574,17 +2574,25 @@ i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     true, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							TRUE, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    false, NULL, true);
+		return -EAGAIN;
+	}
 
+	return 0;
 }
 
-static void
+static int
 i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2594,17 +2602,26 @@ i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     false, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	/* must remain in all_multicast mode */
 	if (dev->data->all_multicast == 1)
-		return;
+		return 0;
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							false, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    true, NULL, true);
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index eca418522f..2bbbacf00b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -92,8 +92,8 @@ static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
 static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static void i40evf_dev_close(struct rte_eth_dev *dev);
 static int  i40evf_dev_reset(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40evf_init_vlan(struct rte_eth_dev *dev);
@@ -2156,7 +2156,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	return rte_eth_linkstatus_set(dev, &new_link);
 }
 
-static void
+static int
 i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2164,14 +2164,18 @@ i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* If enabled, just return */
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 1, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2179,11 +2183,15 @@ i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* If disabled, just return */
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 0, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 652f0accca..7f69e27a24 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -274,22 +274,22 @@ i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
 		representor->vf_id, &representor->stats_offset);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 1);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 0);
 }
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 99b1f43b82..22a88c88dd 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -43,8 +43,8 @@ static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int iavf_dev_stats_get(struct rte_eth_dev *dev,
 			     struct rte_eth_stats *stats);
 static void iavf_dev_stats_reset(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev,
@@ -634,7 +634,7 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -643,14 +643,18 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, TRUE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -659,11 +663,15 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, FALSE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9d0e339a5d..eecf9c86c2 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -58,8 +58,8 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
 			       struct rte_eth_rss_conf *rss_conf);
 static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 				 struct rte_eth_rss_conf *rss_conf);
-static void ice_promisc_enable(struct rte_eth_dev *dev);
-static void ice_promisc_disable(struct rte_eth_dev *dev);
+static int ice_promisc_enable(struct rte_eth_dev *dev);
+static int ice_promisc_disable(struct rte_eth_dev *dev);
 static void ice_allmulti_enable(struct rte_eth_dev *dev);
 static void ice_allmulti_disable(struct rte_eth_dev *dev);
 static int ice_vlan_filter_set(struct rte_eth_dev *dev,
@@ -2973,7 +2973,7 @@ ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 ice_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2981,18 +2981,26 @@ ice_promisc_enable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status == ICE_ERR_ALREADY_EXISTS)
+	switch (status) {
+	case ICE_ERR_ALREADY_EXISTS:
 		PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled");
-	else if (status != ICE_SUCCESS)
+	case ICE_SUCCESS:
+		break;
+	default:
 		PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
-static void
+static int
 ice_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3000,13 +3008,18 @@ ice_promisc_disable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status != ICE_SUCCESS)
+	if (status != ICE_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index c7b336bbd1..830e717970 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -539,9 +539,9 @@ ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
 int
 ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
 	__rte_unused int wait_to_complete);
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
 void
 ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 476d5e52bd..9079073c95 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2618,7 +2618,7 @@ ipn3ke_rpst_scan_check(void)
 	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2641,9 +2641,11 @@ ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2666,6 +2668,8 @@ ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
 void
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 223f6f0a0c..0db285ea54 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -149,8 +149,8 @@ static int  ixgbe_dev_set_link_up(struct rte_eth_dev *dev);
 static int  ixgbe_dev_set_link_down(struct rte_eth_dev *dev);
 static void ixgbe_dev_close(struct rte_eth_dev *dev);
 static int  ixgbe_dev_reset(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int ixgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -270,8 +270,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -4180,7 +4180,7 @@ ixgbevf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	return ixgbe_dev_link_update_share(dev, wait_to_complete, 1);
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4189,9 +4189,11 @@ ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
 	fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4204,6 +4206,8 @@ ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		fctrl &= (~IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
 static void
@@ -8399,20 +8403,46 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
+
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d97e357e3c..e1eaf9eb8a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -961,8 +961,12 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev,
 /**
  * \brief Net device enable, disable allmulticast
  * @param eth_dev Pointer to the structure rte_eth_dev
+ *
+ * @return
+ *  On success return 0
+ *  On failure return negative errno
  */
-static void
+static int
 lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -987,14 +991,18 @@ lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 
 	if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
 		lio_dev_err(lio_dev, "Failed to send change flag message\n");
-		return;
+		return -EAGAIN;
 	}
 
-	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
+	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
 		lio_dev_err(lio_dev, "Change dev flag command timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
 }
 
-static void
+static int
 lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1002,20 +1010,20 @@ lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
-static void
+static int
 lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1023,17 +1031,17 @@ lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
 static void
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 7730b530af..21517d70a2 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -205,8 +205,8 @@ int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu);
 int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
 int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
-void mlx4_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx4_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_disable(struct rte_eth_dev *dev);
 void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 623ebd88cb..c8a73bc1f4 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -341,13 +341,17 @@ enum rxmode_toggle {
  *   Pointer to Ethernet device structure.
  * @param toggle
  *   Toggle to set.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-static void
+static int
 mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 {
 	struct mlx4_priv *priv = dev->data->dev_private;
 	const char *mode;
 	struct rte_flow_error error;
+	int ret;
 
 	switch (toggle) {
 	case RXMODE_TOGGLE_PROMISC_OFF:
@@ -363,12 +367,16 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 	default:
 		mode = "undefined";
 	}
-	if (!mlx4_flow_sync(priv, &error))
-		return;
+
+	ret = mlx4_flow_sync(priv, &error);
+	if (!ret)
+		return 0;
+
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
 	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
+	return ret;
 }
 
 /**
@@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
@@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index cd08d001e9..0c202d8dd9 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -751,8 +751,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
 
 /* mlx5_rxmode.c */
 
-void mlx5_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx5_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index d5077db0db..c862fc9520 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -28,8 +28,11 @@
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
@@ -41,14 +44,24 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 			"port %u cannot enable promiscuous mode"
 			" in flow isolation mode",
 			dev->data->port_id);
-		return;
+		return 0;
+	}
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 1);
+		if (ret)
+			goto error;
 	}
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 1);
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+error:
+	/*
+	 * rte_eth_dev_promiscuous_enable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
@@ -56,20 +69,33 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	int ret;
 
 	dev->data->promiscuous = 0;
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 0);
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 0);
+		if (ret)
+			goto error;
+	}
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+error:
+	/*
+	 * rte_eth_dev_promiscuous_disable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 3ba0ac76e2..1090af03b1 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -534,25 +534,30 @@ mvneta_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (en) {
 		MVNETA_LOG(INFO, "Promiscuous already enabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 1);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to enable promiscuous mode");
+
+	return 0;
 }
 
 /**
@@ -560,25 +565,30 @@ mvneta_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (!en) {
 		MVNETA_LOG(INFO, "Promiscuous already disabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 0);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to disable promiscuous mode");
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 345c24404d..1e5a1e39aa 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -994,22 +994,29 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	if (priv->isolated)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 1);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
@@ -1018,7 +1025,7 @@ mrvl_promiscuous_enable(struct rte_eth_dev *dev)
  * @param dev
  *   Pointer to Ethernet device structure.
  */
-static void
+static int
 mrvl_allmulticast_enable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
@@ -1040,6 +1047,9 @@ mrvl_allmulticast_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
 static void
 mrvl_promiscuous_disable(struct rte_eth_dev *dev)
@@ -1048,11 +1058,15 @@ mrvl_promiscuous_disable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 0);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 7353211c12..d04a6c8acb 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -416,16 +416,16 @@ static int hn_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
-	hn_vf_promiscuous_enable(dev);
+	return hn_vf_promiscuous_enable(dev);
 }
 
-static void
+static int
 hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
@@ -435,7 +435,7 @@ hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	if (dev->data->all_multicast)
 		filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
 	hn_rndis_set_rxfilter(hv, filter);
-	hn_vf_promiscuous_disable(dev);
+	return hn_vf_promiscuous_disable(dev);
 }
 
 static void
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index e0ebe4e1c8..01f2276482 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -214,8 +214,8 @@ void	hn_vf_close(struct rte_eth_dev *dev);
 
 void	hn_vf_allmulticast_enable(struct rte_eth_dev *dev);
 void	hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
 int	hn_vf_mc_addr_list(struct rte_eth_dev *dev,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr);
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index d53d27bb73..d133438bbd 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -362,6 +362,20 @@ void hn_vf_stop(struct rte_eth_dev *dev)
 		rte_spinlock_unlock(&hv->vf_lock);		\
 	}
 
+/* If VF is present, then cascade configuration down */
+#define VF_ETHDEV_FUNC_RET_STATUS(dev, func)			\
+	{							\
+		struct hn_data *hv = (dev)->data->dev_private;	\
+		struct rte_eth_dev *vf_dev;			\
+		int ret = 0;					\
+		rte_spinlock_lock(&hv->vf_lock);		\
+		vf_dev = hn_get_vf_dev(hv);			\
+		if (vf_dev)					\
+			ret = func(vf_dev->data->port_id);	\
+		rte_spinlock_unlock(&hv->vf_lock);		\
+		return ret;					\
+	}
+
 void hn_vf_reset(struct rte_eth_dev *dev)
 {
 	VF_ETHDEV_FUNC(dev, rte_eth_dev_reset);
@@ -396,14 +410,14 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
 	VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable);
 }
 
-void hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_enable);
 }
 
-void hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_disable);
 }
 
 int hn_vf_mc_addr_list(struct rte_eth_dev *dev,
diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c
index 97bfcb238d..17708c84c6 100644
--- a/drivers/net/nfb/nfb_rxmode.c
+++ b/drivers/net/nfb/nfb_rxmode.c
@@ -7,7 +7,7 @@
 #include "nfb_rxmode.h"
 #include "nfb.h"
 
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -20,9 +20,11 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_PROMISCUOUS);
 	}
+
+	return 0;
 }
 
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -33,12 +35,14 @@ nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* if promisc is not enabled, do nothing */
 	if (!nfb_eth_promiscuous_get(dev))
-		return;
+		return 0;
 
 	for (i = 0; i < internals->max_rxmac; ++i) {
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_TABLE);
 	}
+
+	return 0;
 }
 
 int
diff --git a/drivers/net/nfb/nfb_rxmode.h b/drivers/net/nfb/nfb_rxmode.h
index 4c59651d66..1d5bafa98a 100644
--- a/drivers/net/nfb/nfb_rxmode.h
+++ b/drivers/net/nfb/nfb_rxmode.h
@@ -26,8 +26,10 @@ nfb_eth_promiscuous_get(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
 
 /**
@@ -35,8 +37,10 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev);
 
 /**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 3d5b99c943..a9858036a9 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -85,8 +85,8 @@ static int nfp_net_infos_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
 static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void nfp_net_promisc_enable(struct rte_eth_dev *dev);
-static void nfp_net_promisc_disable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_enable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_disable(struct rte_eth_dev *dev);
 static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
 static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
 				       uint16_t queue_idx);
@@ -931,11 +931,12 @@ nfp_net_close(struct rte_eth_dev *dev)
 	 */
 }
 
-static void
+static int
 nfp_net_promisc_enable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	PMD_DRV_LOG(DEBUG, "Promiscuous mode enable");
 
@@ -943,12 +944,12 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 
 	if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) {
 		PMD_INIT_LOG(INFO, "Promiscuous mode not supported");
-		return;
+		return -ENOTSUP;
 	}
 
 	if (hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already enabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_PROMISC;
@@ -958,23 +959,27 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode on just after this call assuming
 	 * it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
-static void
+static int
 nfp_net_promisc_disable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already disabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_PROMISC;
@@ -984,10 +989,13 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode off just before this call
 	 * assuming it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
 /*
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 1faa7b7c6b..47cea4e9b2 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -174,7 +174,7 @@ octeontx_port_stop(struct octeontx_nic *nic)
 	return octeontx_bgx_port_stop(nic->port_id);
 }
 
-static void
+static int
 octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 {
 	struct rte_eth_dev *dev;
@@ -185,15 +185,19 @@ octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 	dev = nic->dev;
 
 	res = octeontx_bgx_port_promisc_set(nic->port_id, en);
-	if (res < 0)
+	if (res < 0) {
 		octeontx_log_err("failed to set promiscuous mode %d",
 				nic->port_id);
+		return res;
+	}
 
 	/* Set proper flag for the mode */
 	dev->data->promiscuous = (en != 0) ? 1 : 0;
 
 	octeontx_log_dbg("port %d : promiscuous mode %s",
 			nic->port_id, en ? "set" : "unset");
+
+	return 0;
 }
 
 static int
@@ -444,22 +448,22 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 octeontx_dev_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 1);
+	return octeontx_port_promisc_set(nic, 1);
 }
 
-static void
+static int
 octeontx_dev_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 0);
+	return octeontx_port_promisc_set(nic, 0);
 }
 
 static int
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 5de0a1d4d1..8814622e43 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -379,8 +379,8 @@ int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
 int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
-void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
-void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index 024c295aa6..5a97a090ae 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -129,18 +129,22 @@ otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en)
 	otx2_nix_vlan_update_promisc(eth_dev, en);
 }
 
-void
+int
 otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 1);
 	nix_cgx_promisc_config(eth_dev, 1);
+
+	return 0;
 }
 
-void
+int
 otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 0);
 	nix_cgx_promisc_config(eth_dev, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 9eb57fd78e..cfca6c4bc7 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1383,33 +1383,39 @@ qede_link_update(struct rte_eth_dev *eth_dev, __rte_unused int wait_to_complete)
 	return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
-static void qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 	enum qed_filter_rx_mode_type type = QED_FILTER_RX_MODE_TYPE_PROMISC;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
 		type |= QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
 
-	qed_configure_filter_rx_mode(eth_dev, type);
+	ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
-static void qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC);
 	else
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_REGULAR);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
 static void qede_poll_sp_sb_cb(void *param)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 013b6bbd63..5faf14b674 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -366,7 +366,7 @@ sfc_dev_close(struct rte_eth_dev *dev)
 	free(sa);
 }
 
-static void
+static int
 sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 		   boolean_t enabled)
 {
@@ -375,6 +375,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	boolean_t allmulti = (mode == SFC_DEV_FILTER_MODE_ALLMULTI);
 	const char *desc = (allmulti) ? "all-multi" : "promiscuous";
+	int rc = 0;
 
 	sfc_adapter_lock(sa);
 
@@ -390,7 +391,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 				     "start provided that isolated mode is "
 				     "disabled prior the next start");
 		} else if ((sa->state == SFC_ADAPTER_STARTED) &&
-			   (sfc_set_rx_mode(sa) != 0)) {
+			   ((rc = sfc_set_rx_mode(sa)) != 0)) {
 			*toggle = !(enabled);
 			sfc_warn(sa, "Failed to %s %s mode",
 				 ((enabled) ? "enable" : "disable"), desc);
@@ -398,18 +399,19 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	}
 
 	sfc_adapter_unlock(sa);
+	return rc;
 }
 
-static void
+static int
 sfc_dev_promisc_enable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
 }
 
-static void
+static int
 sfc_dev_promisc_disable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
 }
 
 static void
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index ca066a3d3d..2f3811b67f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1344,18 +1344,20 @@ eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused,
 	return 0;
 }
 
-static void
+static int
 eth_promiscuous_enable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Enabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return 0;
 }
 
-static void
+static int
 eth_promiscuous_disable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Disabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return -ENOTSUP;
 }
 
 static void
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index f85458c3cd..41612ce838 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 	return 0;
 }
 
-static void
+static int
 tap_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 1;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 1;
+		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_enable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
-static void
+static int
 tap_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 0;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 0;
+		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_disable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index f3ba07ae37..edc956bb3d 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -401,9 +401,10 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */
-static void
+static int
 nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused)
 {
+	return 0;
 }
 
 static inline uint64_t
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 8fe9dcebda..1ba4aa37e8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -41,8 +41,8 @@ static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  virtio_dev_configure(struct rte_eth_dev *dev);
 static int  virtio_dev_start(struct rte_eth_dev *dev);
 static void virtio_dev_stop(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int virtio_dev_info_get(struct rte_eth_dev *dev,
@@ -746,7 +746,7 @@ virtio_dev_close(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -756,7 +756,7 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -765,11 +765,15 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to enable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -779,7 +783,7 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -788,8 +792,12 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to disable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 551c511943..8bfe16c482 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -65,8 +65,8 @@ static int vmxnet3_dev_start(struct rte_eth_dev *dev);
 static void vmxnet3_dev_stop(struct rte_eth_dev *dev);
 static void vmxnet3_dev_close(struct rte_eth_dev *dev);
 static void vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set);
-static void vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
@@ -1262,7 +1262,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set)
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1273,10 +1273,12 @@ vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1290,6 +1292,8 @@ vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 0f6dedbe23..73521fe5b0 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1892,30 +1892,38 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int ret;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	(*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = 1;
+	old_promiscuous = dev->data->promiscuous;
+	ret = (*dev->dev_ops->promiscuous_enable)(dev);
+	dev->data->promiscuous = (ret == 0) ? 1 : old_promiscuous;
 
-	return 0;
+	return ret;
 }
 
 int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int ret;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	old_promiscuous = dev->data->promiscuous;
 	dev->data->promiscuous = 0;
-	(*dev->dev_ops->promiscuous_disable)(dev);
+	ret = (*dev->dev_ops->promiscuous_disable)(dev);
+	if (ret != 0)
+		dev->data->promiscuous = old_promiscuous;
 
-	return 0;
+	return ret;
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 2394b32c83..6322348d17 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -52,10 +52,10 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to detect an Ethernet device removal. */
 
-typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
+typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
 
-typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
+typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
 
 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 05/13] ethdev: do nothing if promiscuous mode is applied again
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (3 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev

Since driver callbacks return status code now, there is no necessity
to enable or disable promiscuous mode once again if it is already
successfully enabled or disabled.

Configuration restore at startup tries to ensure that configured
promiscuous mode is applied and start will return error if it fails.

Also it avoids theoretical cases when already configured promiscuous
mode is applied once again and fails. In this cases it is unclear
which value should be reported on get (configured or opposite).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 40 ++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 73521fe5b0..091e7184aa 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1391,16 +1391,22 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1) {
-		ret = rte_eth_promiscuous_enable(port_id);
+	/*
+	 * use callbacks directly since we don't need port_id check and
+	 * would like to bypass the same value set
+	 */
+	if (rte_eth_promiscuous_get(port_id) == 1 &&
+	    *dev->dev_ops->promiscuous_enable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_enable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to enable promiscuous mode for device (port %u): %s\n",
 				port_id, rte_strerror(-ret));
 			return ret;
 		}
-	} else if (rte_eth_promiscuous_get(port_id) == 0) {
-		ret = rte_eth_promiscuous_disable(port_id);
+	} else if (rte_eth_promiscuous_get(port_id) == 0 &&
+		   *dev->dev_ops->promiscuous_disable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_disable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to disable promiscuous mode for device (port %u): %s\n",
@@ -1892,16 +1898,17 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int ret;
+	int ret = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	ret = (*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = (ret == 0) ? 1 : old_promiscuous;
+
+	if (dev->data->promiscuous == 0) {
+		ret = (*dev->dev_ops->promiscuous_enable)(dev);
+		dev->data->promiscuous = (ret == 0) ? 1 : 0;
+	}
 
 	return ret;
 }
@@ -1910,18 +1917,19 @@ int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int ret;
+	int ret = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	dev->data->promiscuous = 0;
-	ret = (*dev->dev_ops->promiscuous_disable)(dev);
-	if (ret != 0)
-		dev->data->promiscuous = old_promiscuous;
+
+	if (dev->data->promiscuous == 1) {
+		dev->data->promiscuous = 0;
+		ret = (*dev->dev_ops->promiscuous_disable)(dev);
+		if (ret != 0)
+			dev->data->promiscuous = 1;
+	}
 
 	return ret;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 06/13] app/pipeline: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (4 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 07/13] app/testpmd: " Andrew Rybchenko
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pipeline
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pipeline/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index b75688a87a..871d9fa2d2 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -200,7 +200,10 @@ app_init_ports(void)
 		if (ret < 0)
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 
-		rte_eth_promiscuous_enable(port);
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode for port %u: %s\n",
+				port, rte_strerror(-ret));
 
 		/* Init RX queues */
 		ret = rte_eth_rx_queue_setup(
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 07/13] app/testpmd: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (5 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 08/13] app/eventdev: " Andrew Rybchenko
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/testpmd
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pmd/cmdline.c | 23 ++++++++++-------------
 app/test-pmd/testpmd.c | 14 +++++++++++---
 app/test-pmd/testpmd.h |  2 ++
 app/test-pmd/util.c    | 16 ++++++++++++++++
 4 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b1be6b4c82..6b9444f42d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6082,6 +6082,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 	struct cmd_create_bonded_device_result *res = parsed_result;
 	char ethdev_name[RTE_ETH_NAME_MAX_LEN];
 	int port_id;
+	int ret;
 
 	if (test_done == 0) {
 		printf("Please stop forwarding first\n");
@@ -6103,7 +6104,11 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 		/* Update number of ports */
 		nb_ports = rte_eth_dev_count_avail();
 		reconfig(port_id, res->socket);
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Failed to enable promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+
 		ports[port_id].need_setup = 0;
 		ports[port_id].port_status = RTE_PORT_STOPPED;
 	}
@@ -6525,18 +6530,10 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
 
 	/* all ports */
 	if (allports) {
-		RTE_ETH_FOREACH_DEV(i) {
-			if (enable)
-				rte_eth_promiscuous_enable(i);
-			else
-				rte_eth_promiscuous_disable(i);
-		}
-	}
-	else {
-		if (enable)
-			rte_eth_promiscuous_enable(res->port_num);
-		else
-			rte_eth_promiscuous_disable(res->port_num);
+		RTE_ETH_FOREACH_DEV(i)
+			eth_set_promisc_mode(i, enable);
+	} else {
+		eth_set_promisc_mode(res->port_num, enable);
 	}
 }
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index cbf73e6853..6476f97e8d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2432,13 +2432,17 @@ static void
 setup_attached_port(portid_t pi)
 {
 	unsigned int socket_id;
+	int ret;
 
 	socket_id = (unsigned)rte_eth_dev_socket_id(pi);
 	/* if socket_id is invalid, set to the first available socket. */
 	if (check_socket_id(socket_id) < 0)
 		socket_id = socket_ids[0];
 	reconfig(pi, socket_id);
-	rte_eth_promiscuous_enable(pi);
+	ret = rte_eth_promiscuous_enable(pi);
+	if (ret != 0)
+		printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+			pi, rte_strerror(-ret));
 
 	ports_ids[nb_ports++] = pi;
 	fwd_ports_ids[nb_fwd_ports++] = pi;
@@ -3372,8 +3376,12 @@ main(int argc, char** argv)
 		rte_exit(EXIT_FAILURE, "Start ports failed\n");
 
 	/* set all ports to promiscuous mode by default */
-	RTE_ETH_FOREACH_DEV(port_id)
-		rte_eth_promiscuous_enable(port_id);
+	RTE_ETH_FOREACH_DEV(port_id) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+	}
 
 	/* Init metrics library */
 	rte_metrics_init(rte_socket_id());
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d73955da14..9bdbd6dafe 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -824,6 +824,8 @@ void show_gro(portid_t port_id);
 void setup_gso(const char *mode, portid_t port_id);
 int eth_dev_info_get_print_err(uint16_t port_id,
 			struct rte_eth_dev_info *dev_info);
+void eth_set_promisc_mode(uint16_t port_id,
+			int enable);
 
 
 /* Functions to manage the set of filtered Multicast MAC addresses */
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 009d226764..4626751343 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -245,3 +245,19 @@ eth_dev_info_get_print_err(uint16_t port_id,
 
 	return ret;
 }
+
+void
+eth_set_promisc_mode(uint16_t port, int enable)
+{
+	int ret;
+
+	if (enable)
+		ret = rte_eth_promiscuous_enable(port);
+	else
+		ret = rte_eth_promiscuous_disable(port);
+
+	if (ret != 0)
+		printf("Error during %s promiscuous mode for port %u: %s\n",
+			enable ? "enabling" : "disabling",
+			port, rte_strerror(-ret));
+}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 08/13] app/eventdev: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (6 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 07/13] app/testpmd: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 09/13] app/pdump: " Andrew Rybchenko
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/eventdev
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-eventdev/test_perf_common.c     | 7 ++++++-
 app/test-eventdev/test_pipeline_common.c | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index e75582b1a2..e245191797 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -726,7 +726,12 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index ef8ae28c93..6166516817 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -233,7 +233,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 09/13] app/pdump: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (7 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 08/13] app/eventdev: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 10/13] app/test: " Andrew Rybchenko
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Reshma Pattan; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pdump
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/pdump/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index c1b901279f..9d6be8ed1b 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -614,7 +614,13 @@ configure_vdev(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		rte_exit(EXIT_FAILURE,
+			 "promiscuous mode enable failed: %s\n",
+			 rte_strerror(-ret));
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 10/13] app/test: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (8 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 09/13] app/pdump: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 11/13] kni: " Andrew Rybchenko
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/test/test_event_eth_rx_adapter.c
and app/test/test_event_eth_tx_adapter.c according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_event_eth_rx_adapter.c | 4 +++-
 app/test/test_event_eth_tx_adapter.c | 4 +++-
 app/test/test_pmd_perf.c             | 6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 950bc67c2f..6254fcd33a 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -90,7 +90,9 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index 208d20c538..73f6afea20 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -94,7 +94,9 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 4f9fc0d876..85ef11899b 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -745,7 +745,11 @@ test_pmd_perf(void)
 				ret, portid);
 
 		/* always eanble promiscuous */
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				 rte_strerror(-ret), portid);
 
 		lcore_conf[slave_id].portlist[num++] = portid;
 		lcore_conf[slave_id].nb_ports++;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 11/13] kni: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (9 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 10/13] app/test: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 12/13] test/bonding: " Andrew Rybchenko
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so modify usage of these
functions across lib/librte_kni according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_kni.c      |  7 ++++++-
 examples/kni/main.c      |  9 +++++++--
 lib/librte_kni/rte_kni.c | 14 +++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 2c333748db..e47ab36e02 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -601,7 +601,12 @@ test_kni(void)
 		printf("fail to start port %d\n", port_id);
 		return -1;
 	}
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("fail to enable promiscuous mode for port %d: %s\n",
+			port_id, rte_strerror(-ret));
+		return -1;
+	}
 
 	/* basic test of kni processing */
 	fd = fopen(KNI_MODULE_PARAM_LO, "r");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index e43f174479..1069fd08bb 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -636,8 +636,13 @@ init_port(uint16_t port)
 		rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n",
 						(unsigned)port, ret);
 
-	if (promiscuous_on)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous_on) {
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"Could not enable promiscuous mode for port%u: %s\n",
+				port, rte_strerror(-ret));
+	}
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 4b51fb4fed..04806ebb40 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -472,6 +472,8 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 static int
 kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 {
+	int ret;
+
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
 		return -EINVAL;
@@ -481,11 +483,17 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 		port_id, to_on);
 
 	if (to_on)
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
 	else
-		rte_eth_promiscuous_disable(port_id);
+		ret = rte_eth_promiscuous_disable(port_id);
 
-	return 0;
+	if (ret != 0)
+		RTE_LOG(ERR, KNI,
+			"Failed to %s promiscuous mode for port %u: %s\n",
+			to_on ? "enable" : "disable", port_id,
+			rte_strerror(-ret));
+
+	return ret;
 }
 
 int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 12/13] test/bonding: check code of promiscuous mode switch
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (10 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 11/13] kni: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across test/bonding
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_link_bonding.c       | 55 ++++++++++++++++++++++++------
 app/test/test_link_bonding_mode4.c | 16 +++++++--
 2 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 938fafca3a..cbbbc98a16 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1760,13 +1760,17 @@ static int
 test_roundrobin_verify_promiscuous_enable_disable(void)
 {
 	int i, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_ROUND_ROBIN, 0, 4, 1),
 			"Failed to initialize bonded device with slaves");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 1,
@@ -1781,7 +1785,10 @@ test_roundrobin_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 0,
@@ -2200,6 +2207,7 @@ static int
 test_activebackup_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
@@ -2211,7 +2219,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -2232,7 +2243,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled\n",
@@ -3110,13 +3124,17 @@ static int
 test_balance_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BALANCE, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -3129,7 +3147,10 @@ test_balance_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -3696,13 +3717,17 @@ static int
 test_broadcast_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BROADCAST, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
@@ -3716,7 +3741,10 @@ test_broadcast_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -4174,6 +4202,7 @@ static int
 test_tlb_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in transmit load balancing mode */
 	TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
@@ -4185,7 +4214,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)1,
@@ -4206,7 +4238,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s\n",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)0,
diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c
index bbb4e9cce1..70b95d0405 100644
--- a/app/test/test_link_bonding_mode4.c
+++ b/app/test/test_link_bonding_mode4.c
@@ -312,6 +312,7 @@ static int
 initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 {
 	uint8_t i;
+	int ret;
 
 	RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
 
@@ -323,7 +324,10 @@ initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 
 	/* Reset mode 4 configuration */
 	rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-ret));
 
 	if (external_sm) {
 		struct rte_eth_bond_8023ad_conf conf;
@@ -824,7 +828,10 @@ test_mode4_rx(void)
 	/* First try with promiscuous mode enabled.
 	 * Add 2 packets to each slave. First with bonding MAC address, second with
 	 * different. Check if we received all of them. */
-	rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+			"Failed to enable promiscuous mode for port %d: %s",
+			test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
@@ -869,7 +876,10 @@ test_mode4_rx(void)
 
 	/* Now, disable promiscuous mode. When promiscuous mode is disabled we
 	 * expect to receive only packets that are directed to bonding port. */
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH 13/13] examples: take promiscuous mode switch result into account
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (11 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 12/13] test/bonding: " Andrew Rybchenko
@ 2019-09-05 16:10 ` Andrew Rybchenko
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
  14 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:10 UTC (permalink / raw)
  To: Nicolas Chautru, Chas Williams, David Hunt, Harry van Haaren,
	Marko Kovacevic, Ori Kam, Bruce Richardson, Pablo de Lara,
	Radu Nicolau, Akhil Goyal, Tomasz Kantecki, Bernard Iremonger,
	Konstantin Ananyev, Cristian Dumitrescu, Declan Doherty,
	Anatoly Burakov, Reshma Pattan, John McNamara, Xiaoyun Li,
	Jasvinder Singh, Byron Marohn, Maxime Coquelin, Tiwei Bie,
	Zhihong Wang
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across examples according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/bbdev_app/main.c                            |  7 ++++++-
 examples/bond/main.c                                 |  8 +++++++-
 examples/distributor/main.c                          |  4 +++-
 examples/eventdev_pipeline/main.c                    |  4 +++-
 examples/exception_path/main.c                       |  5 ++++-
 examples/flow_classify/flow_classify.c               |  4 +++-
 examples/flow_filtering/main.c                       |  7 ++++++-
 examples/ip_fragmentation/main.c                     |  6 +++++-
 examples/ip_pipeline/link.c                          |  7 +++++--
 examples/ip_reassembly/main.c                        |  6 +++++-
 examples/ipsec-secgw/ipsec-secgw.c                   |  9 +++++++--
 examples/l2fwd-cat/l2fwd-cat.c                       |  4 +++-
 examples/l2fwd-crypto/main.c                         |  7 ++++++-
 examples/l2fwd-jobstats/main.c                       |  9 ++++++++-
 examples/l2fwd-keepalive/main.c                      |  6 +++++-
 examples/l2fwd/main.c                                |  6 +++++-
 examples/l3fwd-acl/main.c                            |  9 +++++++--
 examples/l3fwd-power/main.c                          |  9 +++++++--
 examples/l3fwd/main.c                                |  9 +++++++--
 examples/link_status_interrupt/main.c                |  6 +++++-
 examples/load_balancer/init.c                        |  6 +++++-
 .../multi_process/client_server_mp/mp_server/init.c  |  4 +++-
 examples/multi_process/symmetric_mp/main.c           |  4 +++-
 examples/netmap_compat/bridge/bridge.c               |  6 +++++-
 examples/packet_ordering/main.c                      |  4 +++-
 examples/performance-thread/l3fwd-thread/main.c      |  9 +++++++--
 examples/ptpclient/ptpclient.c                       |  7 ++++++-
 examples/qos_meter/main.c                            | 12 ++++++++++--
 examples/qos_sched/init.c                            |  6 +++++-
 examples/quota_watermark/qw/init.c                   |  6 +++++-
 examples/rxtx_callbacks/main.c                       |  5 ++++-
 examples/server_node_efd/server/init.c               |  4 +++-
 examples/skeleton/basicfwd.c                         |  4 +++-
 examples/vhost/main.c                                | 11 +++++++++--
 examples/vm_power_manager/main.c                     |  4 +++-
 35 files changed, 181 insertions(+), 43 deletions(-)

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 9acf666dc9..3d36629a1b 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -477,7 +477,12 @@ initialize_ports(struct app_config_params *app_params,
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("Cannot enable promiscuous mode: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+		return ret;
+	}
 
 	rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
 	print_mac(port_id, &bbdev_port_eth_addr);
diff --git a/examples/bond/main.c b/examples/bond/main.c
index be62c1713a..39214cfeeb 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -299,7 +299,13 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 			rte_exit(-1, "\nFailed to activate slaves\n");
 	}
 
-	rte_eth_promiscuous_enable(BOND_PORT);
+	retval = rte_eth_promiscuous_enable(BOND_PORT);
+	if (retval != 0) {
+		rte_exit(EXIT_FAILURE,
+				"port %u: promiscuous mode enable failed: %s\n",
+				BOND_PORT, rte_strerror(-retval));
+		return;
+	}
 
 	struct rte_ether_addr addr;
 
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8942f3607c..125ee877f3 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -194,7 +194,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 3789fbfd7b..c734c7750c 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -333,7 +333,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index d7f3598afb..f3c0206b53 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -473,7 +473,10 @@ init_port(uint16_t port)
 	if (ret < 0)
 		FATAL_ERROR("Could not start port%u (%d)", port, ret);
 
-	rte_eth_promiscuous_enable(port);
+	ret = rte_eth_promiscuous_enable(port);
+	if (ret != 0)
+		FATAL_ERROR("Could not enable promiscuous mode for port%u (%s)",
+			    port, rte_strerror(-ret));
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index 2130c13d85..ae0faf621c 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -251,7 +251,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index fe064fa022..c40cfd098b 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -180,7 +180,12 @@ init_port(void)
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			":: promiscuous mode enable failed: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+
 	ret = rte_eth_dev_start(port_id);
 	if (ret < 0) {
 		rte_exit(EXIT_FAILURE,
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 6b832445aa..70139ee4d2 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -1038,7 +1038,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 
 		if (check_ptype(portid) == 0) {
 			rte_eth_add_rx_callback(portid, 0, cb_parse_ptype, NULL);
diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 4e3a40b5a8..744abf394f 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -176,8 +176,11 @@ link_create(const char *name, struct link_params *params)
 	if (status < 0)
 		return NULL;
 
-	if (params->promiscuous)
-		rte_eth_promiscuous_enable(port_id);
+	if (params->promiscuous) {
+		status = rte_eth_promiscuous_enable(port_id);
+		if (status != 0)
+			return NULL;
+	}
 
 	/* Port RX */
 	for (i = 0; i < params->rx.n_queues; i++) {
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 87d4b5c01f..e810e9f3f4 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1169,7 +1169,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 	}
 
 	if (init_routing_table() < 0)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 534830a8e0..8154fc76af 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -2467,8 +2467,13 @@ main(int32_t argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+					rte_strerror(-ret), portid);
+		}
 
 		rte_eth_dev_callback_register(portid,
 			RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL);
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index b34b40a006..b15f0330b8 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -83,7 +83,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 9a370f2dea..c4ef310312 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2574,7 +2574,12 @@ initialize_ports(struct l2fwd_crypto_options *options)
 			return -1;
 		}
 
-		rte_eth_promiscuous_enable(portid);
+		retval = rte_eth_promiscuous_enable(portid);
+		if (retval != 0) {
+			printf("rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				rte_strerror(-retval), portid);
+			return -1;
+		}
 
 		rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
 
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 5fcba5c88c..3dd6e45b86 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -916,7 +916,14 @@ main(int argc, char **argv)
 
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0) {
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
+			return ret;
+
+		}
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index a051390688..708f44ee0d 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -709,7 +709,11 @@ main(int argc, char **argv)
 				"rte_eth_dev_start:err=%d, port=%u\n",
 				  ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: "
 			"%02X:%02X:%02X:%02X:%02X:%02X\n\n",
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 8d4c539810..db070a18be 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -708,7 +708,11 @@ main(int argc, char **argv)
 
 		printf("done: \n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 60531ce0ec..c974a357be 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -2085,8 +2085,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	check_all_ports_link_status(enabled_port_mask);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index bfcaa46c58..8ddc9ceb1e 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2453,8 +2453,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 		/* initialize spinlock for each port */
 		rte_spinlock_init(&(locks[portid]));
 	}
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 3294ac2dab..9ed495ee01 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1035,8 +1035,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	printf("\n");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 0c3dfc6912..be57e6a982 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -689,7 +689,11 @@ main(int argc, char **argv)
 				  ret, (unsigned) portid);
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+				rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				(unsigned) portid,
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index 660f5a8edd..4d49c9514a 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -440,7 +440,11 @@ app_init_nics(void)
 		if (ret < 0) {
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 		}
-		rte_eth_promiscuous_enable(port);
+
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode on port %u (%s)\n",
+				port, rte_strerror(-ret));
 
 		nic_rx_ring_size = app.nic_rx_ring_size;
 		nic_tx_ring_size = app.nic_tx_ring_size;
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 3af5dc6994..e55def84b5 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -132,7 +132,9 @@ init_port(uint16_t port_num)
 		if (retval < 0) return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval < 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port_num);
 	if (retval < 0) return retval;
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 9ae8efb0ba..95058a5dc5 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -261,7 +261,9 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port);
 	if (retval < 0)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index d40e163b0e..f3819d2224 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -261,7 +261,11 @@ int main(int argc, char *argv[])
 			rte_exit(EXIT_FAILURE, "Couldn't setup port %hhu\n",
 				ports.p[i].id);
 
-		rte_eth_promiscuous_enable(ports.p[i].id);
+		err = rte_eth_promiscuous_enable(ports.p[i].id);
+		if (err != 0)
+			rte_exit(EXIT_FAILURE,
+				"Couldn't enable promiscuous mode on port %u: %s\n",
+				ports.p[i].id, rte_strerror(-err));
 	}
 
 	for (i = 0; i != ports.num; i++) {
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index a99961f821..132f582a95 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -330,7 +330,9 @@ configure_eth_port(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		return ret;
 
 	return 0;
 }
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 00f535053c..9e25f064ed 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3706,8 +3706,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	for (i = 0; i < n_rx_thread; i++) {
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index bc427a526c..6e273f644f 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -247,7 +247,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	}
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0) {
+		printf("Promiscuous mode enable failed: %s\n",
+			rte_strerror(-retval));
+		return retval;
+	}
 
 	return 0;
 }
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index 13c85e9406..e8112c83a2 100644
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -439,9 +439,17 @@ main(int argc, char **argv)
 	if (ret < 0)
 		rte_exit(EXIT_FAILURE, "Port %d start error (%d)\n", port_tx, ret);
 
-	rte_eth_promiscuous_enable(port_rx);
+	ret = rte_eth_promiscuous_enable(port_rx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
-	rte_eth_promiscuous_enable(port_tx);
+	ret = rte_eth_promiscuous_enable(port_tx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
 	/* App configuration */
 	ret = app_configure_flow_table();
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index cf9e8f4ac7..dbdbdefea7 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -163,7 +163,11 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
 	} else {
 		printf(" Link Down\n");
 	}
-	rte_eth_promiscuous_enable(portid);
+	ret = rte_eth_promiscuous_enable(portid);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+			rte_strerror(-ret), portid);
 
 	/* mark port as initialized */
 	app_inited_port_mask |= 1u << portid;
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index 5a0f64f454..5ebcc83ac3 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -103,7 +103,11 @@ void configure_eth_port(uint16_t port_id)
 				(unsigned int) port_id, ret);
 
 	/* Put it in promiscuous mode */
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Failed to enable promiscuous mode for port %u: %s\n",
+			port_id, rte_strerror(-ret));
 }
 
 void
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 9fd4b8efd5..5d545115c4 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -196,7 +196,10 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
+
 	rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
 	rte_eth_add_tx_callback(port, 0, calc_latency, NULL);
 
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 773780b4d2..335741a8fc 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -150,7 +150,9 @@ init_port(uint16_t port_num)
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval != 0)
+		return retval;
 
 	retval = rte_eth_dev_start(port_num);
 	if (retval < 0)
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index 171ebde7bd..8f1805aeb5 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -98,7 +98,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 794d12ba7e..b5632d771d 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -336,8 +336,15 @@ port_init(uint16_t port)
 		return retval;
 	}
 
-	if (promiscuous)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous) {
+		retval = rte_eth_promiscuous_enable(port);
+		if (retval != 0) {
+			RTE_LOG(ERR, VHOST_PORT,
+				"Failed to enable promiscuous mode on port %u: %s\n",
+				port, rte_strerror(-retval));
+			return retval;
+		}
+	}
 
 	rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
 	RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices);
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 0f48ae926c..a3a7478296 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -121,7 +121,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (ret != 0)
+		return retval;
 
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-05 16:25   ` Gaëtan Rivet
  2019-09-05 16:32     ` Andrew Rybchenko
  2019-09-05 16:36   ` Stephen Hemminger
  2019-09-05 16:40   ` Stephen Hemminger
  2 siblings, 1 reply; 77+ messages in thread
From: Gaëtan Rivet @ 2019-09-05 16:25 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: dev, Ivan Ilchenko

Hi,

On Thu, Sep 05, 2019 at 05:10:40PM +0100, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> value was changed from void to int, so this patch modify usage
> of these functions across net/failsafe according to new return type.
> 
> Try to keep promiscuous mode consistent across all active
> devices in the case of failure.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  drivers/net/failsafe/failsafe_ether.c |  8 +++--
>  drivers/net/failsafe/failsafe_ops.c   | 44 ++++++++++++++++++++++++---
>  2 files changed, 46 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
> index 504c76edb0..bd38f1c1e4 100644
> --- a/drivers/net/failsafe/failsafe_ether.c
> +++ b/drivers/net/failsafe/failsafe_ether.c
> @@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
>  	if (dev->data->promiscuous != edev->data->promiscuous) {
>  		DEBUG("Configuring promiscuous");
>  		if (dev->data->promiscuous)
> -			rte_eth_promiscuous_enable(PORT_ID(sdev));
> +			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
>  		else
> -			rte_eth_promiscuous_disable(PORT_ID(sdev));
> +			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
> +		if (ret != 0) {
> +			ERROR("Failed to apply promiscuous mode");
> +			return ret;
> +		}
>  	} else {
>  		DEBUG("promiscuous already set");
>  	}
> diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
> index cc14bc2bcc..cbf143fb3c 100644
> --- a/drivers/net/failsafe/failsafe_ops.c
> +++ b/drivers/net/failsafe/failsafe_ops.c
> @@ -659,11 +659,29 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
>  {
>  	struct sub_device *sdev;
>  	uint8_t i;
> +	int ret = 0;
>  
>  	fs_lock(dev, 0);
> -	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
> -		rte_eth_promiscuous_enable(PORT_ID(sdev));
> +	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
> +		ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
> +		if (ret != 0) {
> +			ERROR("Promiscuous mode enable failed for subdevice %d",
> +				PORT_ID(sdev));
> +			break;
> +		}
> +	}
> +	if (ret != 0) {
> +		/* Rollback in the case of failure */
> +		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
> +			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
> +			if (ret != 0)
> +				ERROR("Promiscuous mode disable failed for subdevice %d",
> +					PORT_ID(sdev));
> +		}
> +	}
>  	fs_unlock(dev, 0);
> +
> +	return;

This patch should be applied after the ethdev change to avoid breaking
the build, I think?

You should be able to change the ethdev API, leaving the fail-safe
internals ignore the return value, then apply this patch and fix it.
This way the patchset should not break the build mid-series.

Otherwise good implementation with the rollback.

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:25   ` Gaëtan Rivet
@ 2019-09-05 16:32     ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:32 UTC (permalink / raw)
  To: Gaëtan Rivet; +Cc: dev, Ivan Ilchenko

On 9/5/19 7:25 PM, Gaëtan Rivet wrote:
> Hi,
>
> On Thu, Sep 05, 2019 at 05:10:40PM +0100, Andrew Rybchenko wrote:
>> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>>
>> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
>> value was changed from void to int, so this patch modify usage
>> of these functions across net/failsafe according to new return type.
>>
>> Try to keep promiscuous mode consistent across all active
>> devices in the case of failure.
>>
>> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> ---
>>   drivers/net/failsafe/failsafe_ether.c |  8 +++--
>>   drivers/net/failsafe/failsafe_ops.c   | 44 ++++++++++++++++++++++++---
>>   2 files changed, 46 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
>> index 504c76edb0..bd38f1c1e4 100644
>> --- a/drivers/net/failsafe/failsafe_ether.c
>> +++ b/drivers/net/failsafe/failsafe_ether.c
>> @@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
>>   	if (dev->data->promiscuous != edev->data->promiscuous) {
>>   		DEBUG("Configuring promiscuous");
>>   		if (dev->data->promiscuous)
>> -			rte_eth_promiscuous_enable(PORT_ID(sdev));
>> +			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
>>   		else
>> -			rte_eth_promiscuous_disable(PORT_ID(sdev));
>> +			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
>> +		if (ret != 0) {
>> +			ERROR("Failed to apply promiscuous mode");
>> +			return ret;
>> +		}
>>   	} else {
>>   		DEBUG("promiscuous already set");
>>   	}
>> diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
>> index cc14bc2bcc..cbf143fb3c 100644
>> --- a/drivers/net/failsafe/failsafe_ops.c
>> +++ b/drivers/net/failsafe/failsafe_ops.c
>> @@ -659,11 +659,29 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
>>   {
>>   	struct sub_device *sdev;
>>   	uint8_t i;
>> +	int ret = 0;
>>   
>>   	fs_lock(dev, 0);
>> -	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
>> -		rte_eth_promiscuous_enable(PORT_ID(sdev));
>> +	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
>> +		ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
>> +		if (ret != 0) {
>> +			ERROR("Promiscuous mode enable failed for subdevice %d",
>> +				PORT_ID(sdev));
>> +			break;
>> +		}
>> +	}
>> +	if (ret != 0) {
>> +		/* Rollback in the case of failure */
>> +		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
>> +			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
>> +			if (ret != 0)
>> +				ERROR("Promiscuous mode disable failed for subdevice %d",
>> +					PORT_ID(sdev));
>> +		}
>> +	}
>>   	fs_unlock(dev, 0);
>> +
>> +	return;
> This patch should be applied after the ethdev change to avoid breaking
> the build, I think?

As far as I tested it does not break the build. Sorry for confusing
return at the end of function without return value.
The function is still void and it is updated to forward ret when
callback has return value.

> You should be able to change the ethdev API, leaving the fail-safe
> internals ignore the return value, then apply this patch and fix it.
> This way the patchset should not break the build mid-series.
>
> Otherwise good implementation with the rollback.

Thanks.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
  2019-09-05 16:25   ` Gaëtan Rivet
@ 2019-09-05 16:36   ` Stephen Hemminger
  2019-09-05 16:38     ` Andrew Rybchenko
  2019-09-05 16:40   ` Stephen Hemminger
  2 siblings, 1 reply; 77+ messages in thread
From: Stephen Hemminger @ 2019-09-05 16:36 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: Gaetan Rivet, dev, Ivan Ilchenko

On Thu, 5 Sep 2019 17:10:40 +0100
Andrew Rybchenko <arybchenko@solarflare.com> wrote:

> +		if (ret != 0) {
> +			ERROR("Failed to apply promiscuous mode");
> +			return ret;
> +		}

Just return the error as normal and let caller deal with it.
Additional logging is not necessary.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:36   ` Stephen Hemminger
@ 2019-09-05 16:38     ` Andrew Rybchenko
  2019-09-06  9:24       ` Gaëtan Rivet
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Gaetan Rivet, dev, Ivan Ilchenko

On 9/5/19 7:36 PM, Stephen Hemminger wrote:
> On Thu, 5 Sep 2019 17:10:40 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> +		if (ret != 0) {
>> +			ERROR("Failed to apply promiscuous mode");
>> +			return ret;
>> +		}
> Just return the error as normal and let caller deal with it.
> Additional logging is not necessary.

In this particular case we simply follow style around.
No strong opinion. Up to Gaetan.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
  2019-09-05 16:25   ` Gaëtan Rivet
  2019-09-05 16:36   ` Stephen Hemminger
@ 2019-09-05 16:40   ` Stephen Hemminger
  2019-09-05 16:49     ` Andrew Rybchenko
  2 siblings, 1 reply; 77+ messages in thread
From: Stephen Hemminger @ 2019-09-05 16:40 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: Gaetan Rivet, dev, Ivan Ilchenko

On Thu, 5 Sep 2019 17:10:40 +0100
Andrew Rybchenko <arybchenko@solarflare.com> wrote:

> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> value was changed from void to int, so this patch modify usage
> of these functions across net/failsafe according to new return type.
> 
> Try to keep promiscuous mode consistent across all active
> devices in the case of failure.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

In reality, failsafe's promiscious mode is actually a lie.
The only common use case of failsafe is on Azure/Hyper-V and in a guest
setting promiscuous is not allowed. That is why there is no promiscuous
setting in netvsc PMD.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:40   ` Stephen Hemminger
@ 2019-09-05 16:49     ` Andrew Rybchenko
  2019-09-05 17:13       ` Stephen Hemminger
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-05 16:49 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Gaetan Rivet, dev, Ivan Ilchenko

On 9/5/19 7:40 PM, Stephen Hemminger wrote:
> On Thu, 5 Sep 2019 17:10:40 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>>
>> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
>> value was changed from void to int, so this patch modify usage
>> of these functions across net/failsafe according to new return type.
>>
>> Try to keep promiscuous mode consistent across all active
>> devices in the case of failure.
>>
>> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> In reality, failsafe's promiscious mode is actually a lie.
> The only common use case of failsafe is on Azure/Hyper-V and in a guest
> setting promiscuous is not allowed. That is why there is no promiscuous
> setting in netvsc PMD.

Confused
$ git grep promiscuous drivers/net/netvsc/
drivers/net/netvsc/hn_ethdev.c:hn_dev_promiscuous_enable(struct 
rte_eth_dev *dev)
drivers/net/netvsc/hn_ethdev.c: return hn_vf_promiscuous_enable(dev);
drivers/net/netvsc/hn_ethdev.c:hn_dev_promiscuous_disable(struct 
rte_eth_dev *dev)
drivers/net/netvsc/hn_ethdev.c: return hn_vf_promiscuous_disable(dev);
drivers/net/netvsc/hn_ethdev.c: .promiscuous_enable     = 
hn_dev_promiscuous_enable,
drivers/net/netvsc/hn_ethdev.c: .promiscuous_disable    = 
hn_dev_promiscuous_disable,
drivers/net/netvsc/hn_var.h:int hn_vf_promiscuous_enable(struct 
rte_eth_dev *dev);
drivers/net/netvsc/hn_var.h:int hn_vf_promiscuous_disable(struct 
rte_eth_dev *dev);
drivers/net/netvsc/hn_vf.c:int hn_vf_promiscuous_enable(struct 
rte_eth_dev *dev)
drivers/net/netvsc/hn_vf.c:     VF_ETHDEV_FUNC_RET_STATUS(dev, 
rte_eth_promiscuous_enable);
drivers/net/netvsc/hn_vf.c:int hn_vf_promiscuous_disable(struct 
rte_eth_dev *dev)
drivers/net/netvsc/hn_vf.c:     VF_ETHDEV_FUNC_RET_STATUS(dev, 
rte_eth_promiscuous_disable);


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:49     ` Andrew Rybchenko
@ 2019-09-05 17:13       ` Stephen Hemminger
  0 siblings, 0 replies; 77+ messages in thread
From: Stephen Hemminger @ 2019-09-05 17:13 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: Gaetan Rivet, dev, Ivan Ilchenko

On Thu, 5 Sep 2019 19:49:09 +0300
Andrew Rybchenko <arybchenko@solarflare.com> wrote:

> On 9/5/19 7:40 PM, Stephen Hemminger wrote:
> > On Thu, 5 Sep 2019 17:10:40 +0100
> > Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> >  
> >> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> >>
> >> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> >> value was changed from void to int, so this patch modify usage
> >> of these functions across net/failsafe according to new return type.
> >>
> >> Try to keep promiscuous mode consistent across all active
> >> devices in the case of failure.
> >>
> >> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>  
> > In reality, failsafe's promiscious mode is actually a lie.
> > The only common use case of failsafe is on Azure/Hyper-V and in a guest
> > setting promiscuous is not allowed. That is why there is no promiscuous
> > setting in netvsc PMD.  

I forgot Hyper-V is not same as Azure.
It will always fail on Azure, but will work be allowed on Hyper-V (if enabled on host).

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-05 16:38     ` Andrew Rybchenko
@ 2019-09-06  9:24       ` Gaëtan Rivet
  2019-09-06 10:08         ` Andrew Rybchenko
  0 siblings, 1 reply; 77+ messages in thread
From: Gaëtan Rivet @ 2019-09-06  9:24 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: Stephen Hemminger, dev, Ivan Ilchenko

On Thu, Sep 05, 2019 at 07:38:23PM +0300, Andrew Rybchenko wrote:
> On 9/5/19 7:36 PM, Stephen Hemminger wrote:
> > On Thu, 5 Sep 2019 17:10:40 +0100
> > Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> > 
> > > +		if (ret != 0) {
> > > +			ERROR("Failed to apply promiscuous mode");
> > > +			return ret;
> > > +		}
> > Just return the error as normal and let caller deal with it.
> > Additional logging is not necessary.
> 
> In this particular case we simply follow style around.
> No strong opinion. Up to Gaetan.
> 

Ok, actually I missed a few things.
You should leave the error message in and keep it consistent with the rest.

However, you should test ret against fs_err(sdev, ret), you can find
other uses of it elsewhere in the file. When rte_eth_promiscuous_enable
returns -ENODEV, it is not an error for failsafe (as an absent device is
expected at some point).

Stephen if you would prefer never to have messages, it should be changed
all throughout the driver instead. If prefer it I would accept
a patch about it. Just want to keep it consistent.

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-06  9:24       ` Gaëtan Rivet
@ 2019-09-06 10:08         ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-06 10:08 UTC (permalink / raw)
  To: Gaëtan Rivet; +Cc: Stephen Hemminger, dev, Ivan Ilchenko

On 9/6/19 12:24 PM, Gaëtan Rivet wrote:
> On Thu, Sep 05, 2019 at 07:38:23PM +0300, Andrew Rybchenko wrote:
>> On 9/5/19 7:36 PM, Stephen Hemminger wrote:
>>> On Thu, 5 Sep 2019 17:10:40 +0100
>>> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>>>
>>>> +		if (ret != 0) {
>>>> +			ERROR("Failed to apply promiscuous mode");
>>>> +			return ret;
>>>> +		}
>>> Just return the error as normal and let caller deal with it.
>>> Additional logging is not necessary.
>> In this particular case we simply follow style around.
>> No strong opinion. Up to Gaetan.
>>
> Ok, actually I missed a few things.
> You should leave the error message in and keep it consistent with the rest.
>
> However, you should test ret against fs_err(sdev, ret), you can find
> other uses of it elsewhere in the file. When rte_eth_promiscuous_enable
> returns -ENODEV, it is not an error for failsafe (as an absent device is
> expected at some point).

I see. Will fix in the next version.

> Stephen if you would prefer never to have messages, it should be changed
> all throughout the driver instead. If prefer it I would accept
> a patch about it. Just want to keep it consistent.
>


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (12 preceding siblings ...)
  2019-09-05 16:10 ` [dpdk-dev] [PATCH 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
@ 2019-09-09 11:58 ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
                     ` (13 more replies)
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
  14 siblings, 14 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, Rasesh Mody, Shahed Shaikh, Wenzhuo Lu
  Cc: dev, Ivan Ilchenko

It is the second patch series to get rid of void returning functions
in ethdev in accordance with deprecation notice [1].

It should be applied on top of the first one [2].
It could be applied separately, but few simple conflicts should
be resolved.

Functions which return void are bad since they do not provide explicit
information to the caller if everything is OK or not.
It is especially painful in the case of promiscuous mode since it is
not always supported, there are real cases when it fails to apply and
it affects traffic which is received by the port.

Driver maintainrs are encouraged to review the patch which changes
driver callbacks prototype. Changes are not always trivial when I tried
to provide real status of the operation. I used -EAGAIN when I failed
to choose better error code.

The following two drivers ignore status of internal functions and
definitely could be improved:

net/bnx2x: bnx2x_set_rx_mode() can report failure, but it is used in
other places and should be updated carefully.

net/igbvf: e1000_promisc_set_vf() provides return status, but it is
unclear how handle it properly.

[1] https://patches.dpdk.org/patch/56969/
[2] https://patches.dpdk.org/project/dpdk/list/?series=6279

v2:
 - minor style fix in app/testpmd
 - use fs_err() in net/failsafe in accordance with review from Gaetan
 - fix net/mvpp2 build
 - use eth_err() in ethdev

Andrew Rybchenko (2):
  ethdev: change promiscuous callbacks to return status
  ethdev: do nothing if promiscuous mode is applied again

Ivan Ilchenko (11):
  ethdev: change promiscuous mode controllers to return errors
  net/failsafe: check code of promiscuous mode switch
  net/bonding: check code of promiscuous mode switch
  app/pipeline: check code of promiscuous mode switch
  app/testpmd: check code of promiscuous mode switch
  app/eventdev: check code of promiscuous mode switch
  app/pdump: check code of promiscuous mode switch
  app/test: check code of promiscuous mode switch
  kni: check code of promiscuous mode switch
  test/bonding: check code of promiscuous mode switch
  examples: take promiscuous mode switch result into account

 app/pdump/main.c                              |  8 +-
 app/test-eventdev/test_perf_common.c          |  7 +-
 app/test-eventdev/test_pipeline_common.c      |  7 +-
 app/test-pipeline/init.c                      |  5 +-
 app/test-pmd/cmdline.c                        | 23 +++---
 app/test-pmd/testpmd.c                        | 14 +++-
 app/test-pmd/testpmd.h                        |  1 +
 app/test-pmd/util.c                           | 16 ++++
 app/test/test_event_eth_rx_adapter.c          |  4 +-
 app/test/test_event_eth_tx_adapter.c          |  4 +-
 app/test/test_kni.c                           |  7 +-
 app/test/test_link_bonding.c                  | 55 +++++++++++---
 app/test/test_link_bonding_mode4.c            | 16 +++-
 app/test/test_pmd_perf.c                      |  6 +-
 app/test/virtual_pmd.c                        | 12 ++-
 doc/guides/rel_notes/deprecation.rst          |  1 -
 doc/guides/rel_notes/release_19_11.rst        |  4 +
 doc/guides/sample_app_ug/flow_classify.rst    |  6 +-
 doc/guides/sample_app_ug/flow_filtering.rst   | 15 +++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst   |  5 +-
 doc/guides/sample_app_ug/skeleton.rst         |  6 +-
 drivers/net/af_packet/rte_eth_af_packet.c     | 22 ++++--
 drivers/net/af_xdp/rte_eth_af_xdp.c           | 20 +++--
 drivers/net/atlantic/atl_ethdev.c             | 12 ++-
 drivers/net/avp/avp_ethdev.c                  | 12 ++-
 drivers/net/axgbe/axgbe_ethdev.c              | 12 ++-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  8 +-
 drivers/net/bnxt/bnxt_ethdev.c                | 26 +++++--
 drivers/net/bonding/rte_eth_bond_8023ad.c     | 17 ++++-
 drivers/net/bonding/rte_eth_bond_pmd.c        | 74 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c              | 12 +--
 drivers/net/cxgbe/cxgbe_pfvf.h                |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  8 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              | 12 ++-
 drivers/net/e1000/em_ethdev.c                 | 12 ++-
 drivers/net/e1000/igb_ethdev.c                | 24 ++++--
 drivers/net/enetc/enetc_ethdev.c              |  8 +-
 drivers/net/enic/enic.h                       |  2 +-
 drivers/net/enic/enic_ethdev.c                | 22 ++++--
 drivers/net/enic/enic_main.c                  |  4 +-
 drivers/net/failsafe/failsafe_ether.c         |  8 +-
 drivers/net/failsafe/failsafe_ops.c           | 52 +++++++++++--
 drivers/net/fm10k/fm10k_ethdev.c              | 24 ++++--
 drivers/net/hinic/hinic_pmd_ethdev.c          | 16 +++-
 drivers/net/i40e/i40e_ethdev.c                | 35 ++++++---
 drivers/net/i40e/i40e_ethdev_vf.c             | 20 +++--
 drivers/net/i40e/i40e_vf_representor.c        |  8 +-
 drivers/net/iavf/iavf_ethdev.c                | 20 +++--
 drivers/net/ice/ice_ethdev.c                  | 27 +++++--
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |  8 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              | 50 +++++++++---
 drivers/net/liquidio/lio_ethdev.c             | 30 +++++---
 drivers/net/mlx4/mlx4.h                       |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c                | 24 ++++--
 drivers/net/mlx5/mlx5.h                       |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c                | 40 ++++++++--
 drivers/net/mvneta/mvneta_ethdev.c            | 22 ++++--
 drivers/net/mvpp2/mrvl_ethdev.c               | 28 +++++--
 drivers/net/netvsc/hn_ethdev.c                |  8 +-
 drivers/net/netvsc/hn_var.h                   |  4 +-
 drivers/net/netvsc/hn_vf.c                    | 22 +++++-
 drivers/net/nfb/nfb_rxmode.c                  | 10 ++-
 drivers/net/nfb/nfb_rxmode.h                  |  8 +-
 drivers/net/nfp/nfp_net.c                     | 30 +++++---
 drivers/net/octeontx/octeontx_ethdev.c        | 16 ++--
 drivers/net/octeontx2/otx2_ethdev.h           |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c       |  8 +-
 drivers/net/qede/qede_ethdev.c                | 16 ++--
 drivers/net/sfc/sfc_ethdev.c                  | 14 ++--
 drivers/net/szedata2/rte_eth_szedata2.c       |  6 +-
 drivers/net/tap/rte_eth_tap.c                 | 52 ++++++++++---
 drivers/net/thunderx/nicvf_ethdev.c           |  3 +-
 drivers/net/virtio/virtio_ethdev.c            | 24 ++++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c          | 12 ++-
 examples/bbdev_app/main.c                     |  7 +-
 examples/bond/main.c                          |  8 +-
 examples/distributor/main.c                   |  4 +-
 examples/eventdev_pipeline/main.c             |  4 +-
 examples/exception_path/main.c                |  5 +-
 examples/flow_classify/flow_classify.c        |  4 +-
 examples/flow_filtering/main.c                |  7 +-
 examples/ip_fragmentation/main.c              |  6 +-
 examples/ip_pipeline/link.c                   |  7 +-
 examples/ip_reassembly/main.c                 |  6 +-
 examples/ipsec-secgw/ipsec-secgw.c            |  9 ++-
 examples/kni/main.c                           |  9 ++-
 examples/l2fwd-cat/l2fwd-cat.c                |  4 +-
 examples/l2fwd-crypto/main.c                  |  7 +-
 examples/l2fwd-jobstats/main.c                |  9 ++-
 examples/l2fwd-keepalive/main.c               |  6 +-
 examples/l2fwd/main.c                         |  6 +-
 examples/l3fwd-acl/main.c                     |  9 ++-
 examples/l3fwd-power/main.c                   |  9 ++-
 examples/l3fwd/main.c                         |  9 ++-
 examples/link_status_interrupt/main.c         |  6 +-
 examples/load_balancer/init.c                 |  6 +-
 .../client_server_mp/mp_server/init.c         |  4 +-
 examples/multi_process/symmetric_mp/main.c    |  4 +-
 examples/netmap_compat/bridge/bridge.c        |  6 +-
 examples/packet_ordering/main.c               |  4 +-
 .../performance-thread/l3fwd-thread/main.c    |  9 ++-
 examples/ptpclient/ptpclient.c                |  7 +-
 examples/qos_meter/main.c                     | 12 ++-
 examples/qos_sched/init.c                     |  6 +-
 examples/quota_watermark/qw/init.c            |  6 +-
 examples/rxtx_callbacks/main.c                |  5 +-
 examples/server_node_efd/server/init.c        |  4 +-
 examples/skeleton/basicfwd.c                  |  4 +-
 examples/vhost/main.c                         | 11 ++-
 examples/vm_power_manager/main.c              |  4 +-
 lib/librte_ethdev/rte_ethdev.c                | 76 +++++++++++++++----
 lib/librte_ethdev/rte_ethdev.h                | 14 +++-
 lib/librte_ethdev/rte_ethdev_core.h           |  4 +-
 lib/librte_kni/rte_kni.c                      | 14 +++-
 115 files changed, 1155 insertions(+), 380 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-13 15:35     ` Ferruh Yigit
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
                     ` (12 subsequent siblings)
  13 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Neil Horman, John McNamara, Marko Kovacevic, Bernard Iremonger,
	Ori Kam, Bruce Richardson, Pablo de Lara, Radu Nicolau,
	Akhil Goyal, Tomasz Kantecki, Harry van Haaren, Xiaoyun Li,
	Thomas Monjalon, Ferruh Yigit
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

Change rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable()
return value from void to int and return negative errno values
in case of error conditions.
Modify usage of these functions across the ethdev according
to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst        |  1 -
 doc/guides/rel_notes/release_19_11.rst      |  4 ++
 doc/guides/sample_app_ug/flow_classify.rst  |  6 ++-
 doc/guides/sample_app_ug/flow_filtering.rst | 15 +++++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst |  5 +-
 doc/guides/sample_app_ug/skeleton.rst       |  6 ++-
 lib/librte_ethdev/rte_ethdev.c              | 52 ++++++++++++++++-----
 lib/librte_ethdev/rte_ethdev.h              | 14 +++++-
 8 files changed, 80 insertions(+), 23 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index cbb4c34efd..b2e0a1fc7c 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -88,7 +88,6 @@ Deprecation Notices
   negative errno values to indicate various error conditions (e.g.
   invalid port ID, unsupported operation, failed operation):
 
-  - ``rte_eth_promiscuous_enable`` and ``rte_eth_promiscuous_disable``
   - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable``
   - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
   - ``rte_eth_dev_stop``
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 152f120197..5299157df7 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -97,6 +97,10 @@ API Changes
 * ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` to
   ``int`` to provide a way to report various error conditions.
 
+* ethdev: changed ``rte_eth_promiscuous_enable`` and
+  ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
+  provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst
index 96a5c66d0f..7c2b6dcf83 100644
--- a/doc/guides/sample_app_ug/flow_classify.rst
+++ b/doc/guides/sample_app_ug/flow_classify.rst
@@ -315,7 +315,9 @@ Forwarding application is shown below:
                addr.addr_bytes[4], addr.addr_bytes[5]);
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+                return retval;
 
         return 0;
     }
@@ -343,7 +345,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-    rte_eth_promiscuous_enable(port);
+    retval = rte_eth_promiscuous_enable(port);
 
 The Add Rules function
 ~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst
index 02fc675506..de3e4ab0b6 100644
--- a/doc/guides/sample_app_ug/flow_filtering.rst
+++ b/doc/guides/sample_app_ug/flow_filtering.rst
@@ -193,7 +193,13 @@ application is shown below:
                    }
           }
 
-           rte_eth_promiscuous_enable(port_id);
+           ret = rte_eth_promiscuous_enable(port_id);
+           if (ret != 0) {
+                   rte_exit(EXIT_FAILURE,
+                           ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                           ret, port_id);
+           }
+
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -278,7 +284,12 @@ We are setting the RX port to promiscuous mode:
 
 .. code-block:: c
 
-   rte_eth_promiscuous_enable(port_id);
+   ret = rte_eth_promiscuous_enable(port_id);
+   if (ret != 0) {
+        rte_exit(EXIT_FAILURE,
+                 ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                 ret, port_id);
+   }
 
 The last step is to start the port.
 
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 32c120992f..0a69ec71ab 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -117,8 +117,9 @@ comments:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
-
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         /* Add the callbacks for RX and TX.*/
         rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst
index 59ca511d33..1d0a2760d4 100644
--- a/doc/guides/sample_app_ug/skeleton.rst
+++ b/doc/guides/sample_app_ug/skeleton.rst
@@ -149,7 +149,9 @@ Forwarding application is shown below:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         return 0;
     }
@@ -177,7 +179,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
 
 
 The Lcores Main
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 30b0c7803f..b97dd8aa85 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1381,24 +1381,41 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev,
 	}
 }
 
-static void
+static int
 rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 			   struct rte_eth_dev_info *dev_info, uint16_t port_id)
 {
+	int ret;
+
 	if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1)
-		rte_eth_promiscuous_enable(port_id);
-	else if (rte_eth_promiscuous_get(port_id) == 0)
-		rte_eth_promiscuous_disable(port_id);
+	if (rte_eth_promiscuous_get(port_id) == 1) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to enable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	} else if (rte_eth_promiscuous_get(port_id) == 0) {
+		ret = rte_eth_promiscuous_disable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to disable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	}
 
 	/* replay all multicast configuration */
 	if (rte_eth_allmulticast_get(port_id) == 1)
 		rte_eth_allmulticast_enable(port_id);
 	else if (rte_eth_allmulticast_get(port_id) == 0)
 		rte_eth_allmulticast_disable(port_id);
+
+	return 0;
 }
 
 int
@@ -1436,7 +1453,14 @@ rte_eth_dev_start(uint16_t port_id)
 	else
 		return eth_err(port_id, diag);
 
-	rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	ret = rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	if (ret != 0) {
+		RTE_ETHDEV_LOG(ERR,
+			"Error during restoring configuration for device (port %u): %s\n",
+			port_id, rte_strerror(-ret));
+		rte_eth_dev_stop(port_id);
+		return ret;
+	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
@@ -1864,30 +1888,34 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	return eth_err(port_id, ret);
 }
 
-void
+int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
+
+	return 0;
 }
 
-void
+int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
+
+	return 0;
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 475dbdae17..f07a829b29 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2022,16 +2022,26 @@ int rte_eth_dev_reset(uint16_t port_id);
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_enable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_enable(uint16_t port_id);
+int rte_eth_promiscuous_enable(uint16_t port_id);
 
 /**
  * Disable receipt in promiscuous mode for an Ethernet device.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_disable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_disable(uint16_t port_id);
+int rte_eth_promiscuous_disable(uint16_t port_id);
 
 /**
  * Return the value of promiscuous mode for an Ethernet device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 12:48     ` Gaëtan Rivet
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 03/13] net/bonding: " Andrew Rybchenko
                     ` (11 subsequent siblings)
  13 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Gaetan Rivet; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/failsafe according to new return type.

Try to keep promiscuous mode consistent across all active
devices in the case of failure.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/failsafe/failsafe_ether.c |  8 +++--
 drivers/net/failsafe/failsafe_ops.c   | 44 ++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 504c76edb0..bd38f1c1e4 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
 	if (dev->data->promiscuous != edev->data->promiscuous) {
 		DEBUG("Configuring promiscuous");
 		if (dev->data->promiscuous)
-			rte_eth_promiscuous_enable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
 		else
-			rte_eth_promiscuous_disable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		if (ret != 0) {
+			ERROR("Failed to apply promiscuous mode");
+			return ret;
+		}
 	} else {
 		DEBUG("promiscuous already set");
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 1e57633374..114d6a09f6 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -659,10 +659,28 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_enable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+		ret = fs_err(sdev, ret);
+		if (ret != 0) {
+			ERROR("Promiscuous mode enable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+			ret = fs_err(sdev, ret);
+			if (ret != 0)
+				ERROR("Promiscuous mode disable failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
 }
 
@@ -671,10 +689,28 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_disable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		ret = fs_err(sdev, ret);
+		if (ret != 0) {
+			ERROR("Promiscuous mode disable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+			ret = fs_err(sdev, ret);
+			if (ret != 0)
+				ERROR("Promiscuous mode enable failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 03/13] net/bonding: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                     ` (10 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/bonding according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 17 ++++++++++--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 34 +++++++++++++++++++----
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index fbc69051a9..7189a84585 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -913,6 +913,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
 static int
 bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	rte_eth_allmulticast_enable(slave_id);
 	if (rte_eth_allmulticast_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
@@ -922,7 +924,12 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 		return 0;
 	}
 
-	rte_eth_promiscuous_enable(slave_id);
+	ret = rte_eth_promiscuous_enable(slave_id);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"failed to enable promiscuous mode for port %u: %s",
+			slave_id, rte_strerror(-ret));
+	}
 	if (rte_eth_promiscuous_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u",
 			     slave_id);
@@ -937,6 +944,8 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 static void
 bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) {
 	case BOND_8023AD_FORCED_ALLMULTI:
 		RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id);
@@ -945,7 +954,11 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 
 	case BOND_8023AD_FORCED_PROMISC:
 		RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id);
-		rte_eth_promiscuous_disable(slave_id);
+		ret = rte_eth_promiscuous_disable(slave_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"failed to disable promiscuous mode for port %u: %s",
+				slave_id, rte_strerror(-ret));
 		break;
 
 	default:
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a994c9abd2..edf660db34 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2487,6 +2487,8 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
 	int i;
+	int ret = 0;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2495,9 +2497,13 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
-			rte_eth_promiscuous_enable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2508,7 +2514,12 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_enable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
@@ -2517,6 +2528,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
+	int ret;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2525,13 +2538,17 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
 					BOND_8023AD_FORCED_PROMISC)
 				continue;
-			rte_eth_promiscuous_disable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2542,7 +2559,12 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_disable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (2 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 03/13] net/bonding: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-10  7:53     ` Matan Azrad
                       ` (5 more replies)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
                     ` (9 subsequent siblings)
  13 siblings, 6 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: John W. Linville, Xiaolong Ye, Qi Zhang, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Rasesh Mody, Shahed Shaikh, Ajit Khaparde, Somnath Kotur,
	Chas Williams, Rahul Lakkireddy, Hemant Agrawal, Sachin Saxena,
	Wenzhuo Lu, Gagandeep Singh, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon, Ferruh Yigit
  Cc: dev

Enabling/disabling of promiscuous mode is not always successful and
it should be taken into account to be able to handle it properly.

When correct return status is unclear from driver code, -EAGAIN is used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/virtual_pmd.c                    | 12 ++++--
 drivers/net/af_packet/rte_eth_af_packet.c | 22 ++++++----
 drivers/net/af_xdp/rte_eth_af_xdp.c       | 20 ++++++---
 drivers/net/atlantic/atl_ethdev.c         | 12 ++++--
 drivers/net/avp/avp_ethdev.c              | 12 ++++--
 drivers/net/axgbe/axgbe_ethdev.c          | 12 ++++--
 drivers/net/bnx2x/bnx2x_ethdev.c          |  8 +++-
 drivers/net/bnxt/bnxt_ethdev.c            | 26 +++++++++---
 drivers/net/bonding/rte_eth_bond_pmd.c    | 42 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c          | 12 +++---
 drivers/net/cxgbe/cxgbe_pfvf.h            |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c            |  8 +++-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 12 ++++--
 drivers/net/e1000/em_ethdev.c             | 12 ++++--
 drivers/net/e1000/igb_ethdev.c            | 24 +++++++----
 drivers/net/enetc/enetc_ethdev.c          |  8 +++-
 drivers/net/enic/enic.h                   |  2 +-
 drivers/net/enic/enic_ethdev.c            | 22 +++++++---
 drivers/net/enic/enic_main.c              |  4 +-
 drivers/net/failsafe/failsafe_ops.c       |  8 +++-
 drivers/net/fm10k/fm10k_ethdev.c          | 24 +++++++----
 drivers/net/hinic/hinic_pmd_ethdev.c      | 16 ++++++-
 drivers/net/i40e/i40e_ethdev.c            | 35 +++++++++++----
 drivers/net/i40e/i40e_ethdev_vf.c         | 20 ++++++---
 drivers/net/i40e/i40e_vf_representor.c    |  8 ++--
 drivers/net/iavf/iavf_ethdev.c            | 20 ++++++---
 drivers/net/ice/ice_ethdev.c              | 27 +++++++++---
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c   |  8 +++-
 drivers/net/ixgbe/ixgbe_ethdev.c          | 50 +++++++++++++++++-----
 drivers/net/liquidio/lio_ethdev.c         | 30 ++++++++-----
 drivers/net/mlx4/mlx4.h                   |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c            | 24 ++++++++---
 drivers/net/mlx5/mlx5.h                   |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c            | 40 ++++++++++++++---
 drivers/net/mvneta/mvneta_ethdev.c        | 22 +++++++---
 drivers/net/mvpp2/mrvl_ethdev.c           | 28 +++++++++---
 drivers/net/netvsc/hn_ethdev.c            |  8 ++--
 drivers/net/netvsc/hn_var.h               |  4 +-
 drivers/net/netvsc/hn_vf.c                | 22 ++++++++--
 drivers/net/nfb/nfb_rxmode.c              | 10 +++--
 drivers/net/nfb/nfb_rxmode.h              |  8 +++-
 drivers/net/nfp/nfp_net.c                 | 30 ++++++++-----
 drivers/net/octeontx/octeontx_ethdev.c    | 16 ++++---
 drivers/net/octeontx2/otx2_ethdev.h       |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  8 +++-
 drivers/net/qede/qede_ethdev.c            | 16 ++++---
 drivers/net/sfc/sfc_ethdev.c              | 14 +++---
 drivers/net/szedata2/rte_eth_szedata2.c   |  6 ++-
 drivers/net/tap/rte_eth_tap.c             | 52 ++++++++++++++++++-----
 drivers/net/thunderx/nicvf_ethdev.c       |  3 +-
 drivers/net/virtio/virtio_ethdev.c        | 24 +++++++----
 drivers/net/vmxnet3/vmxnet3_ethdev.c      | 12 ++++--
 lib/librte_ethdev/rte_ethdev.c            | 18 +++++---
 lib/librte_ethdev/rte_ethdev_core.h       |  4 +-
 55 files changed, 645 insertions(+), 260 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index e295891c06..b34df416a2 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -210,13 +210,17 @@ virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
 	memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
 }
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_enable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
 static int
 virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev,
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 66131b53e7..0495727281 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -458,41 +458,47 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-static void
+static int
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index aa716f3195..1da22ff866 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -750,37 +750,43 @@ static void
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index b056f8229a..5018529da1 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -24,8 +24,8 @@ static int  atl_dev_set_link_up(struct rte_eth_dev *dev);
 static int  atl_dev_set_link_down(struct rte_eth_dev *dev);
 static void atl_dev_close(struct rte_eth_dev *dev);
 static int  atl_dev_reset(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int  atl_dev_link_update(struct rte_eth_dev *dev, int wait);
@@ -1207,20 +1207,24 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, true);
+
+	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, false);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index c5801f319a..050901990c 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -45,8 +45,8 @@ static int avp_dev_info_get(struct rte_eth_dev *dev,
 			    struct rte_eth_dev_info *dev_info);
 static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
 
 static int avp_dev_rx_queue_setup(struct rte_eth_dev *dev,
 				  uint16_t rx_queue_id,
@@ -2157,7 +2157,7 @@ avp_dev_link_update(struct rte_eth_dev *eth_dev,
 	return -1;
 }
 
-static void
+static int
 avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2169,9 +2169,11 @@ avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
-static void
+static int
 avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2183,6 +2185,8 @@ avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 5a7da75126..c43b5bfb6f 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -15,8 +15,8 @@ static int  axgbe_dev_start(struct rte_eth_dev *dev);
 static void axgbe_dev_stop(struct rte_eth_dev *dev);
 static void axgbe_dev_interrupt_handler(void *param);
 static void axgbe_dev_close(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int axgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -236,7 +236,7 @@ axgbe_dev_close(struct rte_eth_dev *dev)
 	axgbe_dev_clear_queues(dev);
 }
 
-static void
+static int
 axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -244,9 +244,11 @@ axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
+
+	return 0;
 }
 
-static void
+static int
 axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -254,6 +256,8 @@ axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b7359514e5..07168e9a8a 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -292,7 +292,7 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 	bnx2x_free_ilt_mem(sc);
 }
 
-static void
+static int
 bnx2x_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -302,9 +302,11 @@ bnx2x_promisc_enable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
-static void
+static int
 bnx2x_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -314,6 +316,8 @@ bnx2x_promisc_disable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b521a72963..7fff5d5b8f 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1006,32 +1006,46 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	return rc;
 }
 
-static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
-static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
 static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index edf660db34..f9b7b595df 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1915,7 +1915,7 @@ bond_ethdev_primary_set(struct bond_dev_private *internals,
 		}
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev);
 
 static int
@@ -2482,7 +2482,7 @@ bond_ethdev_stats_reset(struct rte_eth_dev *dev)
 		rte_eth_stats_reset(internals->slaves[i].port_id);
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2495,7 +2495,9 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
@@ -2504,8 +2506,17 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				RTE_BOND_LOG(ERR,
 					"Failed to enable promiscuous mode for port %u: %s",
 					port_id, rte_strerror(-ret));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2521,14 +2532,16 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				"Failed to enable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
-static void
+static int
 bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
-	int ret;
+	int ret = 0;
 	uint16_t port_id;
 
 	switch (internals->mode) {
@@ -2536,21 +2549,34 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
-					BOND_8023AD_FORCED_PROMISC)
+					BOND_8023AD_FORCED_PROMISC) {
+				slave_ok++;
 				continue;
+			}
 			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));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2566,6 +2592,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 				"Failed to disable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 19c2a3c4db..be001a0d24 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -150,22 +150,22 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      1, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     1, -1, 1, -1, false);
 }
 
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      0, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     0, -1, 1, -1, false);
 }
 
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 011ec13860..bfa07ba555 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -12,8 +12,8 @@ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_close(struct rte_eth_dev *eth_dev);
 int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *device_info);
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr);
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 25deadb949..ad28c110d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -514,22 +514,26 @@ dpaa_xstats_get_names_by_id(
 	return limit;
 }
 
-static void dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_enable(dpaa_intf->fif);
+
+	return 0;
 }
 
-static void dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_disable(dpaa_intf->fif);
+
+	return 0;
 }
 
 static void dpaa_eth_multicast_enable(struct rte_eth_dev *dev)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 879bbc120d..d9cc2c3510 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -987,7 +987,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
 	rte_eth_linkstatus_set(dev, &link);
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_enable(
 		struct rte_eth_dev *dev)
 {
@@ -999,7 +999,7 @@ dpaa2_dev_promiscuous_enable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
@@ -1009,9 +1009,11 @@ dpaa2_dev_promiscuous_enable(
 	ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
 	if (ret < 0)
 		DPAA2_PMD_ERR("Unable to enable M promisc mode %d", ret);
+
+	return ret;
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_disable(
 		struct rte_eth_dev *dev)
 {
@@ -1023,7 +1025,7 @@ dpaa2_dev_promiscuous_disable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
@@ -1037,6 +1039,8 @@ dpaa2_dev_promiscuous_disable(
 			DPAA2_PMD_ERR("Unable to disable M promisc mode %d",
 				      ret);
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 305588f9b3..b23e840376 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -35,8 +35,8 @@ static int eth_em_configure(struct rte_eth_dev *dev);
 static int eth_em_start(struct rte_eth_dev *dev);
 static void eth_em_stop(struct rte_eth_dev *dev);
 static void eth_em_close(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_disable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_em_link_update(struct rte_eth_dev *dev,
@@ -1263,7 +1263,7 @@ em_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1273,9 +1273,11 @@ eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1289,6 +1291,8 @@ eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 6172f9ac64..a9f6de5d52 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -79,8 +79,8 @@ static int  eth_igb_dev_set_link_up(struct rte_eth_dev *dev);
 static int  eth_igb_dev_set_link_down(struct rte_eth_dev *dev);
 static void eth_igb_close(struct rte_eth_dev *dev);
 static int eth_igb_reset(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_disable(struct rte_eth_dev *dev);
 static int  eth_igb_link_update(struct rte_eth_dev *dev,
@@ -156,8 +156,8 @@ static int igbvf_dev_configure(struct rte_eth_dev *dev);
 static int igbvf_dev_start(struct rte_eth_dev *dev);
 static void igbvf_dev_stop(struct rte_eth_dev *dev);
 static void igbvf_dev_close(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_enable(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_disable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_enable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_disable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_enable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_igbvf_link_update(struct e1000_hw *hw);
@@ -2519,7 +2519,7 @@ igb_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2529,9 +2529,11 @@ eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2545,6 +2547,8 @@ eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
@@ -3390,16 +3394,18 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 	igbvf_default_mac_addr_set(dev, &addr);
 }
 
-static void
+static int
 igbvf_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	/* Set both unicast and multicast promisc */
 	e1000_promisc_set_vf(hw, e1000_promisc_enabled);
+
+	return 0;
 }
 
-static void
+static int
 igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3409,6 +3415,8 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 		e1000_promisc_set_vf(hw, e1000_promisc_multicast);
 	else
 		e1000_promisc_set_vf(hw, e1000_promisc_disabled);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dec42b9763..1ec66d0baf 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -523,7 +523,7 @@ enetc_dev_close(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 enetc_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -537,9 +537,11 @@ enetc_promiscuous_enable(struct rte_eth_dev *dev)
 	psipmr |= ENETC_PSIPMR_SET_UP(0) | ENETC_PSIPMR_SET_MP(0);
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
-static void
+static int
 enetc_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -555,6 +557,8 @@ enetc_promiscuous_disable(struct rte_eth_dev *dev)
 		psipmr &= (~ENETC_PSIPMR_SET_MP(0));
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 5a92508f00..72b1e7956b 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
 int enic_dev_stats_get(struct enic *enic,
 		       struct rte_eth_stats *r_stats);
 void enic_dev_stats_clear(struct enic *enic);
-void enic_add_packet_filter(struct enic *enic);
+int enic_add_packet_filter(struct enic *enic);
 int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
 int enic_del_mac_address(struct enic *enic, int mac_index);
 unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 90fdeda901..5d48930a9d 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -603,29 +603,39 @@ static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return NULL;
 }
 
-static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -ENOTSUP;
 
 	ENICPMD_FUNC_TRACE();
 
 	enic->promisc = 1;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 0;
+
+	return ret;
 }
 
-static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -ENOTSUP;
 
 	ENICPMD_FUNC_TRACE();
 	enic->promisc = 0;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 1;
+
+	return ret;
 }
 
 static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 40af3781b3..f4e76a057a 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
 			       enic->rss_enable);
 }
 
-void enic_add_packet_filter(struct enic *enic)
+int enic_add_packet_filter(struct enic *enic)
 {
 	/* Args -> directed, multicast, broadcast, promisc, allmulti */
-	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
+	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
 		enic->promisc, enic->allmulti);
 }
 
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 114d6a09f6..fee783ad07 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -654,7 +654,7 @@ fs_dev_free_queues(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -682,9 +682,11 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 		}
 	}
 	fs_unlock(dev, 0);
+
+	return ret;
 }
 
-static void
+static int
 fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -712,6 +714,8 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 		}
 	}
 	fs_unlock(dev, 0);
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8cb7337ea5..f0f6290089 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -44,8 +44,8 @@ int fm10k_logtype_init;
 int fm10k_logtype_driver;
 
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
-static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static inline int fm10k_glort_valid(struct fm10k_hw *hw);
@@ -908,7 +908,7 @@ static inline int fm10k_glort_valid(struct fm10k_hw *hw)
 		!= FM10K_DGLORTMAP_NONE);
 }
 
-static void
+static int
 fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -918,18 +918,22 @@ fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	fm10k_mbx_lock(hw);
 	status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
 				FM10K_XCAST_MODE_PROMISC);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -940,7 +944,7 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	if (dev->data->all_multicast == 1)
 		mode = FM10K_XCAST_MODE_ALLMULTI;
@@ -952,8 +956,12 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				mode);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 17a3625d63..c50cdd9f81 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1325,8 +1325,12 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1338,6 +1342,8 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, true);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Enable promiscuous failed");
+
+	return rc;
 }
 
 /**
@@ -1345,8 +1351,12 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1358,6 +1368,8 @@ static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, false);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Disable promiscuous failed");
+
+	return rc;
 }
 
 /**
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 390cb21964..79bd3a70c9 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -223,8 +223,8 @@ static int i40e_dev_start(struct rte_eth_dev *dev);
 static void i40e_dev_stop(struct rte_eth_dev *dev);
 static void i40e_dev_close(struct rte_eth_dev *dev);
 static int  i40e_dev_reset(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40e_dev_set_link_up(struct rte_eth_dev *dev);
@@ -2564,7 +2564,7 @@ i40e_dev_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
-static void
+static int
 i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2574,17 +2574,25 @@ i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     true, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							TRUE, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    false, NULL, true);
+		return -EAGAIN;
+	}
 
+	return 0;
 }
 
-static void
+static int
 i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2594,17 +2602,26 @@ i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     false, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	/* must remain in all_multicast mode */
 	if (dev->data->all_multicast == 1)
-		return;
+		return 0;
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							false, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    true, NULL, true);
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index eca418522f..2bbbacf00b 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -92,8 +92,8 @@ static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
 static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static void i40evf_dev_close(struct rte_eth_dev *dev);
 static int  i40evf_dev_reset(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40evf_init_vlan(struct rte_eth_dev *dev);
@@ -2156,7 +2156,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	return rte_eth_linkstatus_set(dev, &new_link);
 }
 
-static void
+static int
 i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2164,14 +2164,18 @@ i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* If enabled, just return */
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 1, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2179,11 +2183,15 @@ i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* If disabled, just return */
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 0, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 652f0accca..7f69e27a24 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -274,22 +274,22 @@ i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
 		representor->vf_id, &representor->stats_offset);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 1);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 0);
 }
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 99b1f43b82..22a88c88dd 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -43,8 +43,8 @@ static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int iavf_dev_stats_get(struct rte_eth_dev *dev,
 			     struct rte_eth_stats *stats);
 static void iavf_dev_stats_reset(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev,
@@ -634,7 +634,7 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -643,14 +643,18 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, TRUE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -659,11 +663,15 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, FALSE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9d0e339a5d..eecf9c86c2 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -58,8 +58,8 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
 			       struct rte_eth_rss_conf *rss_conf);
 static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 				 struct rte_eth_rss_conf *rss_conf);
-static void ice_promisc_enable(struct rte_eth_dev *dev);
-static void ice_promisc_disable(struct rte_eth_dev *dev);
+static int ice_promisc_enable(struct rte_eth_dev *dev);
+static int ice_promisc_disable(struct rte_eth_dev *dev);
 static void ice_allmulti_enable(struct rte_eth_dev *dev);
 static void ice_allmulti_disable(struct rte_eth_dev *dev);
 static int ice_vlan_filter_set(struct rte_eth_dev *dev,
@@ -2973,7 +2973,7 @@ ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 ice_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2981,18 +2981,26 @@ ice_promisc_enable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status == ICE_ERR_ALREADY_EXISTS)
+	switch (status) {
+	case ICE_ERR_ALREADY_EXISTS:
 		PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled");
-	else if (status != ICE_SUCCESS)
+	case ICE_SUCCESS:
+		break;
+	default:
 		PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
-static void
+static int
 ice_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3000,13 +3008,18 @@ ice_promisc_disable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status != ICE_SUCCESS)
+	if (status != ICE_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index c7b336bbd1..830e717970 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -539,9 +539,9 @@ ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
 int
 ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
 	__rte_unused int wait_to_complete);
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
 void
 ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 476d5e52bd..9079073c95 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2618,7 +2618,7 @@ ipn3ke_rpst_scan_check(void)
 	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2641,9 +2641,11 @@ ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2666,6 +2668,8 @@ ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
 void
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0108db890b..023b267d74 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -149,8 +149,8 @@ static int  ixgbe_dev_set_link_up(struct rte_eth_dev *dev);
 static int  ixgbe_dev_set_link_down(struct rte_eth_dev *dev);
 static void ixgbe_dev_close(struct rte_eth_dev *dev);
 static int  ixgbe_dev_reset(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int ixgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -270,8 +270,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -4181,7 +4181,7 @@ ixgbevf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	return ixgbe_dev_link_update_share(dev, wait_to_complete, 1);
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4190,9 +4190,11 @@ ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
 	fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4205,6 +4207,8 @@ ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		fctrl &= (~IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
 static void
@@ -8402,20 +8406,46 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
+
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d97e357e3c..e1eaf9eb8a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -961,8 +961,12 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev,
 /**
  * \brief Net device enable, disable allmulticast
  * @param eth_dev Pointer to the structure rte_eth_dev
+ *
+ * @return
+ *  On success return 0
+ *  On failure return negative errno
  */
-static void
+static int
 lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -987,14 +991,18 @@ lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 
 	if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
 		lio_dev_err(lio_dev, "Failed to send change flag message\n");
-		return;
+		return -EAGAIN;
 	}
 
-	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
+	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
 		lio_dev_err(lio_dev, "Change dev flag command timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
 }
 
-static void
+static int
 lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1002,20 +1010,20 @@ lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
-static void
+static int
 lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1023,17 +1031,17 @@ lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
 static void
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 7730b530af..21517d70a2 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -205,8 +205,8 @@ int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu);
 int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
 int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
-void mlx4_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx4_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_disable(struct rte_eth_dev *dev);
 void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 623ebd88cb..c8a73bc1f4 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -341,13 +341,17 @@ enum rxmode_toggle {
  *   Pointer to Ethernet device structure.
  * @param toggle
  *   Toggle to set.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-static void
+static int
 mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 {
 	struct mlx4_priv *priv = dev->data->dev_private;
 	const char *mode;
 	struct rte_flow_error error;
+	int ret;
 
 	switch (toggle) {
 	case RXMODE_TOGGLE_PROMISC_OFF:
@@ -363,12 +367,16 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 	default:
 		mode = "undefined";
 	}
-	if (!mlx4_flow_sync(priv, &error))
-		return;
+
+	ret = mlx4_flow_sync(priv, &error);
+	if (!ret)
+		return 0;
+
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
 	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
+	return ret;
 }
 
 /**
@@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
@@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 8ddbb7a17c..11d540c3a5 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -752,8 +752,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
 
 /* mlx5_rxmode.c */
 
-void mlx5_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx5_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index d5077db0db..c862fc9520 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -28,8 +28,11 @@
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
@@ -41,14 +44,24 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 			"port %u cannot enable promiscuous mode"
 			" in flow isolation mode",
 			dev->data->port_id);
-		return;
+		return 0;
+	}
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 1);
+		if (ret)
+			goto error;
 	}
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 1);
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+error:
+	/*
+	 * rte_eth_dev_promiscuous_enable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
@@ -56,20 +69,33 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	int ret;
 
 	dev->data->promiscuous = 0;
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 0);
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 0);
+		if (ret)
+			goto error;
+	}
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+error:
+	/*
+	 * rte_eth_dev_promiscuous_disable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 3ba0ac76e2..1090af03b1 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -534,25 +534,30 @@ mvneta_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (en) {
 		MVNETA_LOG(INFO, "Promiscuous already enabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 1);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to enable promiscuous mode");
+
+	return 0;
 }
 
 /**
@@ -560,25 +565,30 @@ mvneta_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (!en) {
 		MVNETA_LOG(INFO, "Promiscuous already disabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 0);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to disable promiscuous mode");
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 345c24404d..7babc891ae 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -994,22 +994,29 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	if (priv->isolated)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 1);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
@@ -1040,19 +1047,26 @@ mrvl_allmulticast_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 0);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 7353211c12..d04a6c8acb 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -416,16 +416,16 @@ static int hn_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
-	hn_vf_promiscuous_enable(dev);
+	return hn_vf_promiscuous_enable(dev);
 }
 
-static void
+static int
 hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
@@ -435,7 +435,7 @@ hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	if (dev->data->all_multicast)
 		filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
 	hn_rndis_set_rxfilter(hv, filter);
-	hn_vf_promiscuous_disable(dev);
+	return hn_vf_promiscuous_disable(dev);
 }
 
 static void
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index e0ebe4e1c8..01f2276482 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -214,8 +214,8 @@ void	hn_vf_close(struct rte_eth_dev *dev);
 
 void	hn_vf_allmulticast_enable(struct rte_eth_dev *dev);
 void	hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
 int	hn_vf_mc_addr_list(struct rte_eth_dev *dev,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr);
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index d53d27bb73..d133438bbd 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -362,6 +362,20 @@ void hn_vf_stop(struct rte_eth_dev *dev)
 		rte_spinlock_unlock(&hv->vf_lock);		\
 	}
 
+/* If VF is present, then cascade configuration down */
+#define VF_ETHDEV_FUNC_RET_STATUS(dev, func)			\
+	{							\
+		struct hn_data *hv = (dev)->data->dev_private;	\
+		struct rte_eth_dev *vf_dev;			\
+		int ret = 0;					\
+		rte_spinlock_lock(&hv->vf_lock);		\
+		vf_dev = hn_get_vf_dev(hv);			\
+		if (vf_dev)					\
+			ret = func(vf_dev->data->port_id);	\
+		rte_spinlock_unlock(&hv->vf_lock);		\
+		return ret;					\
+	}
+
 void hn_vf_reset(struct rte_eth_dev *dev)
 {
 	VF_ETHDEV_FUNC(dev, rte_eth_dev_reset);
@@ -396,14 +410,14 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
 	VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable);
 }
 
-void hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_enable);
 }
 
-void hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_disable);
 }
 
 int hn_vf_mc_addr_list(struct rte_eth_dev *dev,
diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c
index 97bfcb238d..17708c84c6 100644
--- a/drivers/net/nfb/nfb_rxmode.c
+++ b/drivers/net/nfb/nfb_rxmode.c
@@ -7,7 +7,7 @@
 #include "nfb_rxmode.h"
 #include "nfb.h"
 
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -20,9 +20,11 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_PROMISCUOUS);
 	}
+
+	return 0;
 }
 
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -33,12 +35,14 @@ nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* if promisc is not enabled, do nothing */
 	if (!nfb_eth_promiscuous_get(dev))
-		return;
+		return 0;
 
 	for (i = 0; i < internals->max_rxmac; ++i) {
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_TABLE);
 	}
+
+	return 0;
 }
 
 int
diff --git a/drivers/net/nfb/nfb_rxmode.h b/drivers/net/nfb/nfb_rxmode.h
index 4c59651d66..1d5bafa98a 100644
--- a/drivers/net/nfb/nfb_rxmode.h
+++ b/drivers/net/nfb/nfb_rxmode.h
@@ -26,8 +26,10 @@ nfb_eth_promiscuous_get(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
 
 /**
@@ -35,8 +37,10 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev);
 
 /**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 3d5b99c943..a9858036a9 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -85,8 +85,8 @@ static int nfp_net_infos_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
 static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void nfp_net_promisc_enable(struct rte_eth_dev *dev);
-static void nfp_net_promisc_disable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_enable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_disable(struct rte_eth_dev *dev);
 static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
 static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
 				       uint16_t queue_idx);
@@ -931,11 +931,12 @@ nfp_net_close(struct rte_eth_dev *dev)
 	 */
 }
 
-static void
+static int
 nfp_net_promisc_enable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	PMD_DRV_LOG(DEBUG, "Promiscuous mode enable");
 
@@ -943,12 +944,12 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 
 	if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) {
 		PMD_INIT_LOG(INFO, "Promiscuous mode not supported");
-		return;
+		return -ENOTSUP;
 	}
 
 	if (hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already enabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_PROMISC;
@@ -958,23 +959,27 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode on just after this call assuming
 	 * it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
-static void
+static int
 nfp_net_promisc_disable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already disabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_PROMISC;
@@ -984,10 +989,13 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode off just before this call
 	 * assuming it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
 /*
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 1faa7b7c6b..47cea4e9b2 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -174,7 +174,7 @@ octeontx_port_stop(struct octeontx_nic *nic)
 	return octeontx_bgx_port_stop(nic->port_id);
 }
 
-static void
+static int
 octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 {
 	struct rte_eth_dev *dev;
@@ -185,15 +185,19 @@ octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 	dev = nic->dev;
 
 	res = octeontx_bgx_port_promisc_set(nic->port_id, en);
-	if (res < 0)
+	if (res < 0) {
 		octeontx_log_err("failed to set promiscuous mode %d",
 				nic->port_id);
+		return res;
+	}
 
 	/* Set proper flag for the mode */
 	dev->data->promiscuous = (en != 0) ? 1 : 0;
 
 	octeontx_log_dbg("port %d : promiscuous mode %s",
 			nic->port_id, en ? "set" : "unset");
+
+	return 0;
 }
 
 static int
@@ -444,22 +448,22 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 octeontx_dev_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 1);
+	return octeontx_port_promisc_set(nic, 1);
 }
 
-static void
+static int
 octeontx_dev_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 0);
+	return octeontx_port_promisc_set(nic, 0);
 }
 
 static int
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 5de0a1d4d1..8814622e43 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -379,8 +379,8 @@ int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
 int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
-void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
-void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index 024c295aa6..5a97a090ae 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -129,18 +129,22 @@ otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en)
 	otx2_nix_vlan_update_promisc(eth_dev, en);
 }
 
-void
+int
 otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 1);
 	nix_cgx_promisc_config(eth_dev, 1);
+
+	return 0;
 }
 
-void
+int
 otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 0);
 	nix_cgx_promisc_config(eth_dev, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 9eb57fd78e..cfca6c4bc7 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1383,33 +1383,39 @@ qede_link_update(struct rte_eth_dev *eth_dev, __rte_unused int wait_to_complete)
 	return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
-static void qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 	enum qed_filter_rx_mode_type type = QED_FILTER_RX_MODE_TYPE_PROMISC;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
 		type |= QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
 
-	qed_configure_filter_rx_mode(eth_dev, type);
+	ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
-static void qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC);
 	else
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_REGULAR);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
 static void qede_poll_sp_sb_cb(void *param)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 013b6bbd63..5faf14b674 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -366,7 +366,7 @@ sfc_dev_close(struct rte_eth_dev *dev)
 	free(sa);
 }
 
-static void
+static int
 sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 		   boolean_t enabled)
 {
@@ -375,6 +375,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	boolean_t allmulti = (mode == SFC_DEV_FILTER_MODE_ALLMULTI);
 	const char *desc = (allmulti) ? "all-multi" : "promiscuous";
+	int rc = 0;
 
 	sfc_adapter_lock(sa);
 
@@ -390,7 +391,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 				     "start provided that isolated mode is "
 				     "disabled prior the next start");
 		} else if ((sa->state == SFC_ADAPTER_STARTED) &&
-			   (sfc_set_rx_mode(sa) != 0)) {
+			   ((rc = sfc_set_rx_mode(sa)) != 0)) {
 			*toggle = !(enabled);
 			sfc_warn(sa, "Failed to %s %s mode",
 				 ((enabled) ? "enable" : "disable"), desc);
@@ -398,18 +399,19 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	}
 
 	sfc_adapter_unlock(sa);
+	return rc;
 }
 
-static void
+static int
 sfc_dev_promisc_enable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
 }
 
-static void
+static int
 sfc_dev_promisc_disable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
 }
 
 static void
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index ca066a3d3d..2f3811b67f 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1344,18 +1344,20 @@ eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused,
 	return 0;
 }
 
-static void
+static int
 eth_promiscuous_enable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Enabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return 0;
 }
 
-static void
+static int
 eth_promiscuous_disable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Disabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return -ENOTSUP;
 }
 
 static void
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index f85458c3cd..41612ce838 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 	return 0;
 }
 
-static void
+static int
 tap_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 1;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 1;
+		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_enable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
-static void
+static int
 tap_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 0;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 0;
+		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_disable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index f3ba07ae37..edc956bb3d 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -401,9 +401,10 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */
-static void
+static int
 nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused)
 {
+	return 0;
 }
 
 static inline uint64_t
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 8fe9dcebda..1ba4aa37e8 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -41,8 +41,8 @@ static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  virtio_dev_configure(struct rte_eth_dev *dev);
 static int  virtio_dev_start(struct rte_eth_dev *dev);
 static void virtio_dev_stop(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int virtio_dev_info_get(struct rte_eth_dev *dev,
@@ -746,7 +746,7 @@ virtio_dev_close(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -756,7 +756,7 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -765,11 +765,15 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to enable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -779,7 +783,7 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -788,8 +792,12 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to disable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 551c511943..8bfe16c482 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -65,8 +65,8 @@ static int vmxnet3_dev_start(struct rte_eth_dev *dev);
 static void vmxnet3_dev_stop(struct rte_eth_dev *dev);
 static void vmxnet3_dev_close(struct rte_eth_dev *dev);
 static void vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set);
-static void vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
@@ -1262,7 +1262,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set)
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1273,10 +1273,12 @@ vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1290,6 +1292,8 @@ vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b97dd8aa85..f2e6b4c83b 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1892,30 +1892,38 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int diag;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	(*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = 1;
+	old_promiscuous = dev->data->promiscuous;
+	diag = (*dev->dev_ops->promiscuous_enable)(dev);
+	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
 
-	return 0;
+	return eth_err(port_id, diag);
 }
 
 int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int diag;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	old_promiscuous = dev->data->promiscuous;
 	dev->data->promiscuous = 0;
-	(*dev->dev_ops->promiscuous_disable)(dev);
+	diag = (*dev->dev_ops->promiscuous_disable)(dev);
+	if (diag != 0)
+		dev->data->promiscuous = old_promiscuous;
 
-	return 0;
+	return eth_err(port_id, diag);
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 2394b32c83..6322348d17 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -52,10 +52,10 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to detect an Ethernet device removal. */
 
-typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
+typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
 
-typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
+typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
 
 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 05/13] ethdev: do nothing if promiscuous mode is applied again
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (3 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
                     ` (8 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev

Since driver callbacks return status code now, there is no necessity
to enable or disable promiscuous mode once again if it is already
successfully enabled or disabled.

Configuration restore at startup tries to ensure that configured
promiscuous mode is applied and start will return error if it fails.

Also it avoids theoretical cases when already configured promiscuous
mode is applied once again and fails. In this cases it is unclear
which value should be reported on get (configured or opposite).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 40 ++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index f2e6b4c83b..98fe533c5a 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1391,16 +1391,22 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1) {
-		ret = rte_eth_promiscuous_enable(port_id);
+	/*
+	 * use callbacks directly since we don't need port_id check and
+	 * would like to bypass the same value set
+	 */
+	if (rte_eth_promiscuous_get(port_id) == 1 &&
+	    *dev->dev_ops->promiscuous_enable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_enable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to enable promiscuous mode for device (port %u): %s\n",
 				port_id, rte_strerror(-ret));
 			return ret;
 		}
-	} else if (rte_eth_promiscuous_get(port_id) == 0) {
-		ret = rte_eth_promiscuous_disable(port_id);
+	} else if (rte_eth_promiscuous_get(port_id) == 0 &&
+		   *dev->dev_ops->promiscuous_disable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_disable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to disable promiscuous mode for device (port %u): %s\n",
@@ -1892,16 +1898,17 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int diag;
+	int diag = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	diag = (*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
+
+	if (dev->data->promiscuous == 0) {
+		diag = (*dev->dev_ops->promiscuous_enable)(dev);
+		dev->data->promiscuous = (diag == 0) ? 1 : 0;
+	}
 
 	return eth_err(port_id, diag);
 }
@@ -1910,18 +1917,19 @@ int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int diag;
+	int diag = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	dev->data->promiscuous = 0;
-	diag = (*dev->dev_ops->promiscuous_disable)(dev);
-	if (diag != 0)
-		dev->data->promiscuous = old_promiscuous;
+
+	if (dev->data->promiscuous == 1) {
+		dev->data->promiscuous = 0;
+		diag = (*dev->dev_ops->promiscuous_disable)(dev);
+		if (diag != 0)
+			dev->data->promiscuous = 1;
+	}
 
 	return eth_err(port_id, diag);
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 06/13] app/pipeline: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (4 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 07/13] app/testpmd: " Andrew Rybchenko
                     ` (7 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pipeline
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pipeline/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index b75688a87a..871d9fa2d2 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -200,7 +200,10 @@ app_init_ports(void)
 		if (ret < 0)
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 
-		rte_eth_promiscuous_enable(port);
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode for port %u: %s\n",
+				port, rte_strerror(-ret));
 
 		/* Init RX queues */
 		ret = rte_eth_rx_queue_setup(
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 07/13] app/testpmd: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (5 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 08/13] app/eventdev: " Andrew Rybchenko
                     ` (6 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/testpmd
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pmd/cmdline.c | 23 ++++++++++-------------
 app/test-pmd/testpmd.c | 14 +++++++++++---
 app/test-pmd/testpmd.h |  1 +
 app/test-pmd/util.c    | 16 ++++++++++++++++
 4 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b1be6b4c82..6b9444f42d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6082,6 +6082,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 	struct cmd_create_bonded_device_result *res = parsed_result;
 	char ethdev_name[RTE_ETH_NAME_MAX_LEN];
 	int port_id;
+	int ret;
 
 	if (test_done == 0) {
 		printf("Please stop forwarding first\n");
@@ -6103,7 +6104,11 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 		/* Update number of ports */
 		nb_ports = rte_eth_dev_count_avail();
 		reconfig(port_id, res->socket);
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Failed to enable promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+
 		ports[port_id].need_setup = 0;
 		ports[port_id].port_status = RTE_PORT_STOPPED;
 	}
@@ -6525,18 +6530,10 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
 
 	/* all ports */
 	if (allports) {
-		RTE_ETH_FOREACH_DEV(i) {
-			if (enable)
-				rte_eth_promiscuous_enable(i);
-			else
-				rte_eth_promiscuous_disable(i);
-		}
-	}
-	else {
-		if (enable)
-			rte_eth_promiscuous_enable(res->port_num);
-		else
-			rte_eth_promiscuous_disable(res->port_num);
+		RTE_ETH_FOREACH_DEV(i)
+			eth_set_promisc_mode(i, enable);
+	} else {
+		eth_set_promisc_mode(res->port_num, enable);
 	}
 }
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index de91e1b72d..2a57978fdb 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2433,13 +2433,17 @@ static void
 setup_attached_port(portid_t pi)
 {
 	unsigned int socket_id;
+	int ret;
 
 	socket_id = (unsigned)rte_eth_dev_socket_id(pi);
 	/* if socket_id is invalid, set to the first available socket. */
 	if (check_socket_id(socket_id) < 0)
 		socket_id = socket_ids[0];
 	reconfig(pi, socket_id);
-	rte_eth_promiscuous_enable(pi);
+	ret = rte_eth_promiscuous_enable(pi);
+	if (ret != 0)
+		printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+			pi, rte_strerror(-ret));
 
 	ports_ids[nb_ports++] = pi;
 	fwd_ports_ids[nb_fwd_ports++] = pi;
@@ -3373,8 +3377,12 @@ main(int argc, char** argv)
 		rte_exit(EXIT_FAILURE, "Start ports failed\n");
 
 	/* set all ports to promiscuous mode by default */
-	RTE_ETH_FOREACH_DEV(port_id)
-		rte_eth_promiscuous_enable(port_id);
+	RTE_ETH_FOREACH_DEV(port_id) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+	}
 
 	/* Init metrics library */
 	rte_metrics_init(rte_socket_id());
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d73955da14..ab93062923 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -824,6 +824,7 @@ void show_gro(portid_t port_id);
 void setup_gso(const char *mode, portid_t port_id);
 int eth_dev_info_get_print_err(uint16_t port_id,
 			struct rte_eth_dev_info *dev_info);
+void eth_set_promisc_mode(uint16_t port_id, int enable);
 
 
 /* Functions to manage the set of filtered Multicast MAC addresses */
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 009d226764..4626751343 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -245,3 +245,19 @@ eth_dev_info_get_print_err(uint16_t port_id,
 
 	return ret;
 }
+
+void
+eth_set_promisc_mode(uint16_t port, int enable)
+{
+	int ret;
+
+	if (enable)
+		ret = rte_eth_promiscuous_enable(port);
+	else
+		ret = rte_eth_promiscuous_disable(port);
+
+	if (ret != 0)
+		printf("Error during %s promiscuous mode for port %u: %s\n",
+			enable ? "enabling" : "disabling",
+			port, rte_strerror(-ret));
+}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 08/13] app/eventdev: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (6 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 07/13] app/testpmd: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 09/13] app/pdump: " Andrew Rybchenko
                     ` (5 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/eventdev
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-eventdev/test_perf_common.c     | 7 ++++++-
 app/test-eventdev/test_pipeline_common.c | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index e75582b1a2..e245191797 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -726,7 +726,12 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index ef8ae28c93..6166516817 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -233,7 +233,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 09/13] app/pdump: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (7 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 08/13] app/eventdev: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 10/13] app/test: " Andrew Rybchenko
                     ` (4 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Reshma Pattan; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pdump
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/pdump/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index c1b901279f..9d6be8ed1b 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -614,7 +614,13 @@ configure_vdev(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		rte_exit(EXIT_FAILURE,
+			 "promiscuous mode enable failed: %s\n",
+			 rte_strerror(-ret));
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 10/13] app/test: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (8 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 09/13] app/pdump: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 11/13] kni: " Andrew Rybchenko
                     ` (3 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/test/test_event_eth_rx_adapter.c
and app/test/test_event_eth_tx_adapter.c according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_event_eth_rx_adapter.c | 4 +++-
 app/test/test_event_eth_tx_adapter.c | 4 +++-
 app/test/test_pmd_perf.c             | 6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 950bc67c2f..6254fcd33a 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -90,7 +90,9 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index 208d20c538..73f6afea20 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -94,7 +94,9 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 4f9fc0d876..85ef11899b 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -745,7 +745,11 @@ test_pmd_perf(void)
 				ret, portid);
 
 		/* always eanble promiscuous */
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				 rte_strerror(-ret), portid);
 
 		lcore_conf[slave_id].portlist[num++] = portid;
 		lcore_conf[slave_id].nb_ports++;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 11/13] kni: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (9 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 10/13] app/test: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 12/13] test/bonding: " Andrew Rybchenko
                     ` (2 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so modify usage of these
functions across lib/librte_kni according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_kni.c      |  7 ++++++-
 examples/kni/main.c      |  9 +++++++--
 lib/librte_kni/rte_kni.c | 14 +++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 2c333748db..e47ab36e02 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -601,7 +601,12 @@ test_kni(void)
 		printf("fail to start port %d\n", port_id);
 		return -1;
 	}
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("fail to enable promiscuous mode for port %d: %s\n",
+			port_id, rte_strerror(-ret));
+		return -1;
+	}
 
 	/* basic test of kni processing */
 	fd = fopen(KNI_MODULE_PARAM_LO, "r");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index e43f174479..1069fd08bb 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -636,8 +636,13 @@ init_port(uint16_t port)
 		rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n",
 						(unsigned)port, ret);
 
-	if (promiscuous_on)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous_on) {
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"Could not enable promiscuous mode for port%u: %s\n",
+				port, rte_strerror(-ret));
+	}
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 4b51fb4fed..04806ebb40 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -472,6 +472,8 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 static int
 kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 {
+	int ret;
+
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
 		return -EINVAL;
@@ -481,11 +483,17 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 		port_id, to_on);
 
 	if (to_on)
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
 	else
-		rte_eth_promiscuous_disable(port_id);
+		ret = rte_eth_promiscuous_disable(port_id);
 
-	return 0;
+	if (ret != 0)
+		RTE_LOG(ERR, KNI,
+			"Failed to %s promiscuous mode for port %u: %s\n",
+			to_on ? "enable" : "disable", port_id,
+			rte_strerror(-ret));
+
+	return ret;
 }
 
 int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 12/13] test/bonding: check code of promiscuous mode switch
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (10 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 11/13] kni: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
  2019-09-13 16:37   ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across test/bonding
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_link_bonding.c       | 55 ++++++++++++++++++++++++------
 app/test/test_link_bonding_mode4.c | 16 +++++++--
 2 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 938fafca3a..cbbbc98a16 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1760,13 +1760,17 @@ static int
 test_roundrobin_verify_promiscuous_enable_disable(void)
 {
 	int i, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_ROUND_ROBIN, 0, 4, 1),
 			"Failed to initialize bonded device with slaves");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 1,
@@ -1781,7 +1785,10 @@ test_roundrobin_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 0,
@@ -2200,6 +2207,7 @@ static int
 test_activebackup_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
@@ -2211,7 +2219,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -2232,7 +2243,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled\n",
@@ -3110,13 +3124,17 @@ static int
 test_balance_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BALANCE, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -3129,7 +3147,10 @@ test_balance_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -3696,13 +3717,17 @@ static int
 test_broadcast_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BROADCAST, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
@@ -3716,7 +3741,10 @@ test_broadcast_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -4174,6 +4202,7 @@ static int
 test_tlb_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in transmit load balancing mode */
 	TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
@@ -4185,7 +4214,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)1,
@@ -4206,7 +4238,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s\n",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)0,
diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c
index bbb4e9cce1..70b95d0405 100644
--- a/app/test/test_link_bonding_mode4.c
+++ b/app/test/test_link_bonding_mode4.c
@@ -312,6 +312,7 @@ static int
 initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 {
 	uint8_t i;
+	int ret;
 
 	RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
 
@@ -323,7 +324,10 @@ initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 
 	/* Reset mode 4 configuration */
 	rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-ret));
 
 	if (external_sm) {
 		struct rte_eth_bond_8023ad_conf conf;
@@ -824,7 +828,10 @@ test_mode4_rx(void)
 	/* First try with promiscuous mode enabled.
 	 * Add 2 packets to each slave. First with bonding MAC address, second with
 	 * different. Check if we received all of them. */
-	rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+			"Failed to enable promiscuous mode for port %d: %s",
+			test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
@@ -869,7 +876,10 @@ test_mode4_rx(void)
 
 	/* Now, disable promiscuous mode. When promiscuous mode is disabled we
 	 * expect to receive only packets that are directed to bonding port. */
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (11 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 12/13] test/bonding: " Andrew Rybchenko
@ 2019-09-09 11:58   ` Andrew Rybchenko
  2019-09-13 16:40     ` Ferruh Yigit
  2019-09-13 16:37   ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
  13 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-09 11:58 UTC (permalink / raw)
  To: Nicolas Chautru, Chas Williams, David Hunt, Harry van Haaren,
	Marko Kovacevic, Ori Kam, Bruce Richardson, Pablo de Lara,
	Radu Nicolau, Akhil Goyal, Tomasz Kantecki, Bernard Iremonger,
	Konstantin Ananyev, Cristian Dumitrescu, Declan Doherty,
	Anatoly Burakov, Reshma Pattan, John McNamara, Xiaoyun Li,
	Jasvinder Singh, Byron Marohn, Maxime Coquelin, Tiwei Bie,
	Zhihong Wang
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across examples according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/bbdev_app/main.c                            |  7 ++++++-
 examples/bond/main.c                                 |  8 +++++++-
 examples/distributor/main.c                          |  4 +++-
 examples/eventdev_pipeline/main.c                    |  4 +++-
 examples/exception_path/main.c                       |  5 ++++-
 examples/flow_classify/flow_classify.c               |  4 +++-
 examples/flow_filtering/main.c                       |  7 ++++++-
 examples/ip_fragmentation/main.c                     |  6 +++++-
 examples/ip_pipeline/link.c                          |  7 +++++--
 examples/ip_reassembly/main.c                        |  6 +++++-
 examples/ipsec-secgw/ipsec-secgw.c                   |  9 +++++++--
 examples/l2fwd-cat/l2fwd-cat.c                       |  4 +++-
 examples/l2fwd-crypto/main.c                         |  7 ++++++-
 examples/l2fwd-jobstats/main.c                       |  9 ++++++++-
 examples/l2fwd-keepalive/main.c                      |  6 +++++-
 examples/l2fwd/main.c                                |  6 +++++-
 examples/l3fwd-acl/main.c                            |  9 +++++++--
 examples/l3fwd-power/main.c                          |  9 +++++++--
 examples/l3fwd/main.c                                |  9 +++++++--
 examples/link_status_interrupt/main.c                |  6 +++++-
 examples/load_balancer/init.c                        |  6 +++++-
 .../multi_process/client_server_mp/mp_server/init.c  |  4 +++-
 examples/multi_process/symmetric_mp/main.c           |  4 +++-
 examples/netmap_compat/bridge/bridge.c               |  6 +++++-
 examples/packet_ordering/main.c                      |  4 +++-
 examples/performance-thread/l3fwd-thread/main.c      |  9 +++++++--
 examples/ptpclient/ptpclient.c                       |  7 ++++++-
 examples/qos_meter/main.c                            | 12 ++++++++++--
 examples/qos_sched/init.c                            |  6 +++++-
 examples/quota_watermark/qw/init.c                   |  6 +++++-
 examples/rxtx_callbacks/main.c                       |  5 ++++-
 examples/server_node_efd/server/init.c               |  4 +++-
 examples/skeleton/basicfwd.c                         |  4 +++-
 examples/vhost/main.c                                | 11 +++++++++--
 examples/vm_power_manager/main.c                     |  4 +++-
 35 files changed, 181 insertions(+), 43 deletions(-)

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 9acf666dc9..3d36629a1b 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -477,7 +477,12 @@ initialize_ports(struct app_config_params *app_params,
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("Cannot enable promiscuous mode: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+		return ret;
+	}
 
 	rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
 	print_mac(port_id, &bbdev_port_eth_addr);
diff --git a/examples/bond/main.c b/examples/bond/main.c
index be62c1713a..39214cfeeb 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -299,7 +299,13 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 			rte_exit(-1, "\nFailed to activate slaves\n");
 	}
 
-	rte_eth_promiscuous_enable(BOND_PORT);
+	retval = rte_eth_promiscuous_enable(BOND_PORT);
+	if (retval != 0) {
+		rte_exit(EXIT_FAILURE,
+				"port %u: promiscuous mode enable failed: %s\n",
+				BOND_PORT, rte_strerror(-retval));
+		return;
+	}
 
 	struct rte_ether_addr addr;
 
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8942f3607c..125ee877f3 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -194,7 +194,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 3789fbfd7b..c734c7750c 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -333,7 +333,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index d7f3598afb..f3c0206b53 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -473,7 +473,10 @@ init_port(uint16_t port)
 	if (ret < 0)
 		FATAL_ERROR("Could not start port%u (%d)", port, ret);
 
-	rte_eth_promiscuous_enable(port);
+	ret = rte_eth_promiscuous_enable(port);
+	if (ret != 0)
+		FATAL_ERROR("Could not enable promiscuous mode for port%u (%s)",
+			    port, rte_strerror(-ret));
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index 2130c13d85..ae0faf621c 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -251,7 +251,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index fe064fa022..c40cfd098b 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -180,7 +180,12 @@ init_port(void)
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			":: promiscuous mode enable failed: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+
 	ret = rte_eth_dev_start(port_id);
 	if (ret < 0) {
 		rte_exit(EXIT_FAILURE,
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 6b832445aa..70139ee4d2 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -1038,7 +1038,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 
 		if (check_ptype(portid) == 0) {
 			rte_eth_add_rx_callback(portid, 0, cb_parse_ptype, NULL);
diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 4e3a40b5a8..744abf394f 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -176,8 +176,11 @@ link_create(const char *name, struct link_params *params)
 	if (status < 0)
 		return NULL;
 
-	if (params->promiscuous)
-		rte_eth_promiscuous_enable(port_id);
+	if (params->promiscuous) {
+		status = rte_eth_promiscuous_enable(port_id);
+		if (status != 0)
+			return NULL;
+	}
 
 	/* Port RX */
 	for (i = 0; i < params->rx.n_queues; i++) {
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 87d4b5c01f..e810e9f3f4 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1169,7 +1169,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 	}
 
 	if (init_routing_table() < 0)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 534830a8e0..8154fc76af 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -2467,8 +2467,13 @@ main(int32_t argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+					rte_strerror(-ret), portid);
+		}
 
 		rte_eth_dev_callback_register(portid,
 			RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL);
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index b34b40a006..b15f0330b8 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -83,7 +83,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 9a370f2dea..c4ef310312 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2574,7 +2574,12 @@ initialize_ports(struct l2fwd_crypto_options *options)
 			return -1;
 		}
 
-		rte_eth_promiscuous_enable(portid);
+		retval = rte_eth_promiscuous_enable(portid);
+		if (retval != 0) {
+			printf("rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				rte_strerror(-retval), portid);
+			return -1;
+		}
 
 		rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
 
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 5fcba5c88c..3dd6e45b86 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -916,7 +916,14 @@ main(int argc, char **argv)
 
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0) {
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
+			return ret;
+
+		}
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index a051390688..708f44ee0d 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -709,7 +709,11 @@ main(int argc, char **argv)
 				"rte_eth_dev_start:err=%d, port=%u\n",
 				  ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: "
 			"%02X:%02X:%02X:%02X:%02X:%02X\n\n",
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 8d4c539810..db070a18be 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -708,7 +708,11 @@ main(int argc, char **argv)
 
 		printf("done: \n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 60531ce0ec..c974a357be 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -2085,8 +2085,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	check_all_ports_link_status(enabled_port_mask);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index bfcaa46c58..8ddc9ceb1e 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2453,8 +2453,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 		/* initialize spinlock for each port */
 		rte_spinlock_init(&(locks[portid]));
 	}
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 3294ac2dab..9ed495ee01 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1035,8 +1035,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	printf("\n");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 0c3dfc6912..be57e6a982 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -689,7 +689,11 @@ main(int argc, char **argv)
 				  ret, (unsigned) portid);
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+				rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				(unsigned) portid,
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index 660f5a8edd..4d49c9514a 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -440,7 +440,11 @@ app_init_nics(void)
 		if (ret < 0) {
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 		}
-		rte_eth_promiscuous_enable(port);
+
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode on port %u (%s)\n",
+				port, rte_strerror(-ret));
 
 		nic_rx_ring_size = app.nic_rx_ring_size;
 		nic_tx_ring_size = app.nic_tx_ring_size;
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 3af5dc6994..e55def84b5 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -132,7 +132,9 @@ init_port(uint16_t port_num)
 		if (retval < 0) return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval < 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port_num);
 	if (retval < 0) return retval;
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 9ae8efb0ba..95058a5dc5 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -261,7 +261,9 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port);
 	if (retval < 0)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index d40e163b0e..f3819d2224 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -261,7 +261,11 @@ int main(int argc, char *argv[])
 			rte_exit(EXIT_FAILURE, "Couldn't setup port %hhu\n",
 				ports.p[i].id);
 
-		rte_eth_promiscuous_enable(ports.p[i].id);
+		err = rte_eth_promiscuous_enable(ports.p[i].id);
+		if (err != 0)
+			rte_exit(EXIT_FAILURE,
+				"Couldn't enable promiscuous mode on port %u: %s\n",
+				ports.p[i].id, rte_strerror(-err));
 	}
 
 	for (i = 0; i != ports.num; i++) {
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index a99961f821..132f582a95 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -330,7 +330,9 @@ configure_eth_port(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		return ret;
 
 	return 0;
 }
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 00f535053c..9e25f064ed 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3706,8 +3706,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	for (i = 0; i < n_rx_thread; i++) {
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index bc427a526c..6e273f644f 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -247,7 +247,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	}
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0) {
+		printf("Promiscuous mode enable failed: %s\n",
+			rte_strerror(-retval));
+		return retval;
+	}
 
 	return 0;
 }
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index 13c85e9406..e8112c83a2 100644
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -439,9 +439,17 @@ main(int argc, char **argv)
 	if (ret < 0)
 		rte_exit(EXIT_FAILURE, "Port %d start error (%d)\n", port_tx, ret);
 
-	rte_eth_promiscuous_enable(port_rx);
+	ret = rte_eth_promiscuous_enable(port_rx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
-	rte_eth_promiscuous_enable(port_tx);
+	ret = rte_eth_promiscuous_enable(port_tx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
 	/* App configuration */
 	ret = app_configure_flow_table();
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index cf9e8f4ac7..dbdbdefea7 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -163,7 +163,11 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
 	} else {
 		printf(" Link Down\n");
 	}
-	rte_eth_promiscuous_enable(portid);
+	ret = rte_eth_promiscuous_enable(portid);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+			rte_strerror(-ret), portid);
 
 	/* mark port as initialized */
 	app_inited_port_mask |= 1u << portid;
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index 5a0f64f454..5ebcc83ac3 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -103,7 +103,11 @@ void configure_eth_port(uint16_t port_id)
 				(unsigned int) port_id, ret);
 
 	/* Put it in promiscuous mode */
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Failed to enable promiscuous mode for port %u: %s\n",
+			port_id, rte_strerror(-ret));
 }
 
 void
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 9fd4b8efd5..5d545115c4 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -196,7 +196,10 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
+
 	rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
 	rte_eth_add_tx_callback(port, 0, calc_latency, NULL);
 
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 773780b4d2..335741a8fc 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -150,7 +150,9 @@ init_port(uint16_t port_num)
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval != 0)
+		return retval;
 
 	retval = rte_eth_dev_start(port_num);
 	if (retval < 0)
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index 171ebde7bd..8f1805aeb5 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -98,7 +98,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 794d12ba7e..b5632d771d 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -336,8 +336,15 @@ port_init(uint16_t port)
 		return retval;
 	}
 
-	if (promiscuous)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous) {
+		retval = rte_eth_promiscuous_enable(port);
+		if (retval != 0) {
+			RTE_LOG(ERR, VHOST_PORT,
+				"Failed to enable promiscuous mode on port %u: %s\n",
+				port, rte_strerror(-retval));
+			return retval;
+		}
+	}
 
 	rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
 	RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices);
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 0f48ae926c..a3a7478296 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -121,7 +121,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (ret != 0)
+		return retval;
 
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-09 12:48     ` Gaëtan Rivet
  0 siblings, 0 replies; 77+ messages in thread
From: Gaëtan Rivet @ 2019-09-09 12:48 UTC (permalink / raw)
  To: Andrew Rybchenko; +Cc: dev, Ivan Ilchenko

Hi,

On Mon, Sep 09, 2019 at 12:58:39PM +0100, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> value was changed from void to int, so this patch modify usage
> of these functions across net/failsafe according to new return type.
> 
> Try to keep promiscuous mode consistent across all active
> devices in the case of failure.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

LGTM,
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Thanks,

-- 
Gaëtan Rivet
6WIND

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
@ 2019-09-10  7:53     ` Matan Azrad
  2019-09-13 21:05       ` Andrew Rybchenko
  2019-09-11  8:46     ` Hyong Youb Kim (hyonkim)
                       ` (4 subsequent siblings)
  5 siblings, 1 reply; 77+ messages in thread
From: Matan Azrad @ 2019-09-10  7:53 UTC (permalink / raw)
  To: Andrew Rybchenko, Slava Ovsiienko; +Cc: dev

Hi

Review for mlx5 part:

Added not very important comment below.
You can stay it as is if no new version will be created.

Acked-by: Matan Azrad <matan@mellanox.com>

Thanks.

From: Andrew Rybchenko
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
>  drivers/net/mlx4/mlx4.h                   |  4 +-
>  drivers/net/mlx4/mlx4_ethdev.c            | 24 ++++++++---
>  drivers/net/mlx5/mlx5.h                   |  4 +-
>  drivers/net/mlx5/mlx5_rxmode.c            | 40 ++++++++++++++---
> 
>  static void
> diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
> index 7730b530af..21517d70a2 100644
> --- a/drivers/net/mlx4/mlx4.h
> +++ b/drivers/net/mlx4/mlx4.h
> @@ -205,8 +205,8 @@ int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t
> *mtu);
>  int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
>  int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
>  int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
> -void mlx4_promiscuous_enable(struct rte_eth_dev *dev);
> -void mlx4_promiscuous_disable(struct rte_eth_dev *dev);
> +int mlx4_promiscuous_enable(struct rte_eth_dev *dev);
> +int mlx4_promiscuous_disable(struct rte_eth_dev *dev);
>  void mlx4_allmulticast_enable(struct rte_eth_dev *dev);
>  void mlx4_allmulticast_disable(struct rte_eth_dev *dev);
>  void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
> diff --git a/drivers/net/mlx4/mlx4_ethdev.c
> b/drivers/net/mlx4/mlx4_ethdev.c
> index 623ebd88cb..c8a73bc1f4 100644
> --- a/drivers/net/mlx4/mlx4_ethdev.c
> +++ b/drivers/net/mlx4/mlx4_ethdev.c
> @@ -341,13 +341,17 @@ enum rxmode_toggle {
>   *   Pointer to Ethernet device structure.
>   * @param toggle
>   *   Toggle to set.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -static void
> +static int
>  mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle
> toggle)
>  {
>  	struct mlx4_priv *priv = dev->data->dev_private;
>  	const char *mode;
>  	struct rte_flow_error error;
> +	int ret;
> 
>  	switch (toggle) {
>  	case RXMODE_TOGGLE_PROMISC_OFF:
> @@ -363,12 +367,16 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev,
> enum rxmode_toggle toggle)
>  	default:
>  		mode = "undefined";
>  	}
> -	if (!mlx4_flow_sync(priv, &error))
> -		return;
> +
> +	ret = mlx4_flow_sync(priv, &error);
> +	if (!ret)
> +		return 0;
> +
>  	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
>  	      " flow error type %d, cause %p, message: %s",
>  	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
>  	      error.message ? error.message : "(unspecified)");
> +	return ret;
>  }
> 
>  /**
> @@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev,
> enum rxmode_toggle toggle)
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>  {
>  	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
> @@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev
> *dev)
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx4_promiscuous_disable(struct rte_eth_dev *dev)
>  {
>  	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
> index 8ddbb7a17c..11d540c3a5 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -752,8 +752,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev
> *dev,
> 
>  /* mlx5_rxmode.c */
> 
> -void mlx5_promiscuous_enable(struct rte_eth_dev *dev);
> -void mlx5_promiscuous_disable(struct rte_eth_dev *dev);
> +int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
> +int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
>  void mlx5_allmulticast_enable(struct rte_eth_dev *dev);
>  void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
> 
> diff --git a/drivers/net/mlx5/mlx5_rxmode.c
> b/drivers/net/mlx5/mlx5_rxmode.c
> index d5077db0db..c862fc9520 100644
> --- a/drivers/net/mlx5/mlx5_rxmode.c
> +++ b/drivers/net/mlx5/mlx5_rxmode.c
> @@ -28,8 +28,11 @@
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>  {
>  	struct mlx5_priv *priv = dev->data->dev_private;
> @@ -41,14 +44,24 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>  			"port %u cannot enable promiscuous mode"
>  			" in flow isolation mode",
>  			dev->data->port_id);
> -		return;
> +		return 0;
> +	}
> +	if (priv->config.vf) {
> +		ret = mlx5_nl_promisc(dev, 1);
> +		if (ret)
> +			goto error;

No need the jump, just return ret here and below.

>  	}
> -	if (priv->config.vf)
> -		mlx5_nl_promisc(dev, 1);
>  	ret = mlx5_traffic_restart(dev);
>  	if (ret)
>  		DRV_LOG(ERR, "port %u cannot enable promiscuous mode:
> %s",
>  			dev->data->port_id, strerror(rte_errno));
> +
> +error:
> +	/*
> +	 * rte_eth_dev_promiscuous_enable() rollback
> +	 * dev->data->promiscuous in the case of failure.
> +	 */
> +	return ret;
>  }
> 
>  /**
> @@ -56,20 +69,33 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx5_promiscuous_disable(struct rte_eth_dev *dev)
>  {
>  	struct mlx5_priv *priv = dev->data->dev_private;
>  	int ret;
> 
>  	dev->data->promiscuous = 0;
> -	if (priv->config.vf)
> -		mlx5_nl_promisc(dev, 0);
> +	if (priv->config.vf) {
> +		ret = mlx5_nl_promisc(dev, 0);
> +		if (ret)
> +			goto error;

Same here.

> +	}
>  	ret = mlx5_traffic_restart(dev);
>  	if (ret)
>  		DRV_LOG(ERR, "port %u cannot disable promiscuous mode:
> %s",
>  			dev->data->port_id, strerror(rte_errno));
> +
> +error:
> +	/*
> +	 * rte_eth_dev_promiscuous_disable() rollback
> +	 * dev->data->promiscuous in the case of failure.
> +	 */
> +	return ret;
>  }
> 
>  /**

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
  2019-09-10  7:53     ` Matan Azrad
@ 2019-09-11  8:46     ` Hyong Youb Kim (hyonkim)
  2019-09-13 21:06       ` Andrew Rybchenko
  2019-09-13 15:34     ` Ferruh Yigit
                       ` (3 subsequent siblings)
  5 siblings, 1 reply; 77+ messages in thread
From: Hyong Youb Kim (hyonkim) @ 2019-09-11  8:46 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley (johndale),
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon, Ferruh Yigit
  Cc: dev

> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Monday, September 9, 2019 8:59 PM
[...]
> Subject: [PATCH v2 04/13] ethdev: change promiscuous callbacks to return
> status
> 
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
[...]
>  drivers/net/enic/enic.h                   |  2 +-
>  drivers/net/enic/enic_ethdev.c            | 22 +++++++---
>  drivers/net/enic/enic_main.c              |  4 +-
[...]
>  static void
> diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
> index 5a92508f00..72b1e7956b 100644
> --- a/drivers/net/enic/enic.h
> +++ b/drivers/net/enic/enic.h
> @@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
>  int enic_dev_stats_get(struct enic *enic,
>  		       struct rte_eth_stats *r_stats);
>  void enic_dev_stats_clear(struct enic *enic);
> -void enic_add_packet_filter(struct enic *enic);
> +int enic_add_packet_filter(struct enic *enic);
>  int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
>  int enic_del_mac_address(struct enic *enic, int mac_index);
>  unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
> index 90fdeda901..5d48930a9d 100644
> --- a/drivers/net/enic/enic_ethdev.c
> +++ b/drivers/net/enic/enic_ethdev.c
> @@ -603,29 +603,39 @@ static const uint32_t
> *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
>  	return NULL;
>  }
> 
> -static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev
> *eth_dev)
> +static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
>  {
>  	struct enic *enic = pmd_priv(eth_dev);
> +	int ret;
> 
>  	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> -		return;
> +		return -ENOTSUP;

Should return -E_RTE_SECONDARY to be consistent with other handlers
that check primary/secondary.

> 
>  	ENICPMD_FUNC_TRACE();
> 
>  	enic->promisc = 1;
> -	enic_add_packet_filter(enic);
> +	ret = enic_add_packet_filter(enic);
> +	if (ret != 0)
> +		enic->promisc = 0;
> +
> +	return ret;
>  }
> 
> -static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev
> *eth_dev)
> +static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
>  {
>  	struct enic *enic = pmd_priv(eth_dev);
> +	int ret;
> 
>  	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> -		return;
> +		return -ENOTSUP;

Should return -E_RTE_SECONDARY here too.

>  	ENICPMD_FUNC_TRACE();
>  	enic->promisc = 0;
> -	enic_add_packet_filter(enic);
> +	ret = enic_add_packet_filter(enic);
> +	if (ret != 0)
> +		enic->promisc = 1;
> +
> +	return ret;
>  }
> 
>  static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index 40af3781b3..f4e76a057a 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
>  			       enic->rss_enable);
>  }
> 
> -void enic_add_packet_filter(struct enic *enic)
> +int enic_add_packet_filter(struct enic *enic)
>  {
>  	/* Args -> directed, multicast, broadcast, promisc, allmulti */
> -	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
> +	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
>  		enic->promisc, enic->allmulti);
>  }
> 

A couple minor comments above. Other than those, patch works fine for enic.
Feel free to add my ack on v2..

Acked-by: Hyong Youb Kim <hyonkim@cisco.com>

Thanks.
-Hyong


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
  2019-09-10  7:53     ` Matan Azrad
  2019-09-11  8:46     ` Hyong Youb Kim (hyonkim)
@ 2019-09-13 15:34     ` Ferruh Yigit
  2019-09-13 15:54       ` Andrew Rybchenko
  2019-09-13 15:39     ` Ferruh Yigit
                       ` (2 subsequent siblings)
  5 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 15:34 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index b97dd8aa85..f2e6b4c83b 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -1892,30 +1892,38 @@ int
>  rte_eth_promiscuous_enable(uint16_t port_id)
>  {
>  	struct rte_eth_dev *dev;
> +	uint8_t old_promiscuous;
> +	int diag;
>  
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
>  
>  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
> -	(*dev->dev_ops->promiscuous_enable)(dev);
> -	dev->data->promiscuous = 1;
> +	old_promiscuous = dev->data->promiscuous;
> +	diag = (*dev->dev_ops->promiscuous_enable)(dev);
> +	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
>  
> -	return 0;
> +	return eth_err(port_id, diag);
>  }
>  
>  int
>  rte_eth_promiscuous_disable(uint16_t port_id)
>  {
>  	struct rte_eth_dev *dev;
> +	uint8_t old_promiscuous;
> +	int diag;
>  
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>  	dev = &rte_eth_devices[port_id];
>  
>  	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
> +	old_promiscuous = dev->data->promiscuous;
>  	dev->data->promiscuous = 0;
> -	(*dev->dev_ops->promiscuous_disable)(dev);
> +	diag = (*dev->dev_ops->promiscuous_disable)(dev);
> +	if (diag != 0)
> +		dev->data->promiscuous = old_promiscuous;

Not a real issue, but the enable/disable does exact same thing, slightly
different way, it makes double check if logic is different,
can you adapt one of them for both please.

"
diag = foo();
dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
"
vs

"
dev->data->promiscuous = 0;
diag = bar();
if (diag != 0)
	dev->data->promiscuous = old_promiscuous;
"

>  
> -	return 0;
> +	return eth_err(port_id, diag);
>  }
>  
>  int
> diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
> index 2394b32c83..6322348d17 100644
> --- a/lib/librte_ethdev/rte_ethdev_core.h
> +++ b/lib/librte_ethdev/rte_ethdev_core.h
> @@ -52,10 +52,10 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
>  typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
>  /**< @internal Function used to detect an Ethernet device removal. */
>  
> -typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
> +typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
>  /**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
>  
> -typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
> +typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
>  /**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */

Should we add a note what is expected return value? This information is not
available anyplace, it may help driver developers.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
@ 2019-09-13 15:35     ` Ferruh Yigit
  0 siblings, 0 replies; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 15:35 UTC (permalink / raw)
  To: Andrew Rybchenko, Neil Horman, John McNamara, Marko Kovacevic,
	Bernard Iremonger, Ori Kam, Bruce Richardson, Pablo de Lara,
	Radu Nicolau, Akhil Goyal, Tomasz Kantecki, Harry van Haaren,
	Xiaoyun Li, Thomas Monjalon
  Cc: dev, Ivan Ilchenko

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> Change rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable()
> return value from void to int and return negative errno values
> in case of error conditions.
> Modify usage of these functions across the ethdev according
> to new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst
> index 02fc675506..de3e4ab0b6 100644
> --- a/doc/guides/sample_app_ug/flow_filtering.rst
> +++ b/doc/guides/sample_app_ug/flow_filtering.rst
> @@ -193,7 +193,13 @@ application is shown below:
>                     }
>            }
>  
> -           rte_eth_promiscuous_enable(port_id);
> +           ret = rte_eth_promiscuous_enable(port_id);
> +           if (ret != 0) {
> +                   rte_exit(EXIT_FAILURE,
> +                           ":: cannot enable promiscuous mode: err=%d, port=%u\n",
> +                           ret, port_id);
> +           }
> +

Not for this patch, for future, I am for not putting code into the documents...



^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                       ` (2 preceding siblings ...)
  2019-09-13 15:34     ` Ferruh Yigit
@ 2019-09-13 15:39     ` Ferruh Yigit
  2019-09-13 16:05       ` Andrew Rybchenko
  2019-09-13 16:43     ` Ferruh Yigit
  2019-09-13 16:56     ` Ferruh Yigit
  5 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 15:39 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
> index f85458c3cd..41612ce838 100644
> --- a/drivers/net/tap/rte_eth_tap.c
> +++ b/drivers/net/tap/rte_eth_tap.c
> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>  	return 0;
>  }
>  
> -static void
> +static int
>  tap_promisc_enable(struct rte_eth_dev *dev)
>  {
>  	struct pmd_internals *pmd = dev->data->dev_private;
>  	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
> +	int ret;
>  
> -	dev->data->promiscuous = 1;
> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
> -	if (pmd->remote_if_index && !pmd->flow_isolate)
> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
> +	if (ret != 0)
> +		return ret;
> +
> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
> +		dev->data->promiscuous = 1;

I think PMD shouldn't be setting this variable, it is already set by the API.
I quickly checked if an internal function requires this but it looks like it has
been set by mistake, I think we can remove this.

> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
> +		if (ret != 0) {
> +			/* Rollback promisc flag */
> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
> +			/*
> +			 * rte_eth_dev_promiscuous_enable() rollback
> +			 * dev->data->promiscuous in the case of failure.
> +			 */
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
>  }
>  
> -static void
> +static int
>  tap_promisc_disable(struct rte_eth_dev *dev)
>  {
>  	struct pmd_internals *pmd = dev->data->dev_private;
>  	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
> +	int ret;
>  
> -	dev->data->promiscuous = 0;
> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
> -	if (pmd->remote_if_index && !pmd->flow_isolate)
> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
> +	if (ret != 0)
> +		return ret;
> +
> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
> +		dev->data->promiscuous = 0;

Ditto

> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
> +		if (ret != 0) {
> +			/* Rollback promisc flag */
> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
> +			/*
> +			 * rte_eth_dev_promiscuous_disable() rollback
> +			 * dev->data->promiscuous in the case of failure.
> +			 */
> +			return ret;
> +		}
> +	}
> +
> +	return 0;
>  }

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 15:34     ` Ferruh Yigit
@ 2019-09-13 15:54       ` Andrew Rybchenko
  2019-09-13 16:33         ` Ferruh Yigit
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 15:54 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/19 6:34 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> <...>
>
>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>> index b97dd8aa85..f2e6b4c83b 100644
>> --- a/lib/librte_ethdev/rte_ethdev.c
>> +++ b/lib/librte_ethdev/rte_ethdev.c
>> @@ -1892,30 +1892,38 @@ int
>>   rte_eth_promiscuous_enable(uint16_t port_id)
>>   {
>>   	struct rte_eth_dev *dev;
>> +	uint8_t old_promiscuous;
>> +	int diag;
>>   
>>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>   	dev = &rte_eth_devices[port_id];
>>   
>>   	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
>> -	(*dev->dev_ops->promiscuous_enable)(dev);
>> -	dev->data->promiscuous = 1;
>> +	old_promiscuous = dev->data->promiscuous;
>> +	diag = (*dev->dev_ops->promiscuous_enable)(dev);
>> +	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
>>   
>> -	return 0;
>> +	return eth_err(port_id, diag);
>>   }
>>   
>>   int
>>   rte_eth_promiscuous_disable(uint16_t port_id)
>>   {
>>   	struct rte_eth_dev *dev;
>> +	uint8_t old_promiscuous;
>> +	int diag;
>>   
>>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>   	dev = &rte_eth_devices[port_id];
>>   
>>   	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
>> +	old_promiscuous = dev->data->promiscuous;
>>   	dev->data->promiscuous = 0;
>> -	(*dev->dev_ops->promiscuous_disable)(dev);
>> +	diag = (*dev->dev_ops->promiscuous_disable)(dev);
>> +	if (diag != 0)
>> +		dev->data->promiscuous = old_promiscuous;
> Not a real issue, but the enable/disable does exact same thing, slightly
> different way, it makes double check if logic is different,
> can you adapt one of them for both please.
>
> "
> diag = foo();
> dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
> "
> vs
>
> "
> dev->data->promiscuous = 0;
> diag = bar();
> if (diag != 0)
> 	dev->data->promiscuous = old_promiscuous;
> "

I simply did not want to touch the logic in big patch series.
Don't know why, but enable sets promiscuous=1 after callback,
but disable does it before callback. That's why the difference.
Logically it is a separate change and I definitely don't want to
mix it.

>>   
>> -	return 0;
>> +	return eth_err(port_id, diag);
>>   }
>>   
>>   int
>> diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
>> index 2394b32c83..6322348d17 100644
>> --- a/lib/librte_ethdev/rte_ethdev_core.h
>> +++ b/lib/librte_ethdev/rte_ethdev_core.h
>> @@ -52,10 +52,10 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
>>   typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
>>   /**< @internal Function used to detect an Ethernet device removal. */
>>   
>> -typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
>> +typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
>>   /**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
>>   
>> -typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
>> +typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
>>   /**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
> Should we add a note what is expected return value? This information is not
> available anyplace, it may help driver developers.

Makes sense.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 15:39     ` Ferruh Yigit
@ 2019-09-13 16:05       ` Andrew Rybchenko
  2019-09-13 16:34         ` Ferruh Yigit
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 16:05 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/19 6:39 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> <...>
>
>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>> index f85458c3cd..41612ce838 100644
>> --- a/drivers/net/tap/rte_eth_tap.c
>> +++ b/drivers/net/tap/rte_eth_tap.c
>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>   	return 0;
>>   }
>>   
>> -static void
>> +static int
>>   tap_promisc_enable(struct rte_eth_dev *dev)
>>   {
>>   	struct pmd_internals *pmd = dev->data->dev_private;
>>   	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>> +	int ret;
>>   
>> -	dev->data->promiscuous = 1;
>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>> +	if (ret != 0)
>> +		return ret;
>> +
>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>> +		dev->data->promiscuous = 1;
> I think PMD shouldn't be setting this variable, it is already set by the API.
> I quickly checked if an internal function requires this but it looks like it has
> been set by mistake, I think we can remove this.

It is set after callback in the case of enable.

>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>> +		if (ret != 0) {
>> +			/* Rollback promisc flag */
>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>> +			/*
>> +			 * rte_eth_dev_promiscuous_enable() rollback
>> +			 * dev->data->promiscuous in the case of failure.
>> +			 */
>> +			return ret;
>> +		}
>> +	}
>> +
>> +	return 0;
>>   }
>>   
>> -static void
>> +static int
>>   tap_promisc_disable(struct rte_eth_dev *dev)
>>   {
>>   	struct pmd_internals *pmd = dev->data->dev_private;
>>   	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>> +	int ret;
>>   
>> -	dev->data->promiscuous = 0;
>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>> +	if (ret != 0)
>> +		return ret;
>> +
>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>> +		dev->data->promiscuous = 0;
> Ditto
>
>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>> +		if (ret != 0) {
>> +			/* Rollback promisc flag */
>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>> +			/*
>> +			 * rte_eth_dev_promiscuous_disable() rollback
>> +			 * dev->data->promiscuous in the case of failure.
>> +			 */
>> +			return ret;
>> +		}
>> +	}
>> +
>> +	return 0;
>>   }


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 15:54       ` Andrew Rybchenko
@ 2019-09-13 16:33         ` Ferruh Yigit
  0 siblings, 0 replies; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:33 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/2019 4:54 PM, Andrew Rybchenko wrote:
> On 9/13/19 6:34 PM, Ferruh Yigit wrote:
>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>> Enabling/disabling of promiscuous mode is not always successful and
>>> it should be taken into account to be able to handle it properly.
>>>
>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>
>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> <...>
>>
>>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
>>> index b97dd8aa85..f2e6b4c83b 100644
>>> --- a/lib/librte_ethdev/rte_ethdev.c
>>> +++ b/lib/librte_ethdev/rte_ethdev.c
>>> @@ -1892,30 +1892,38 @@ int
>>>   rte_eth_promiscuous_enable(uint16_t port_id)
>>>   {
>>>   	struct rte_eth_dev *dev;
>>> +	uint8_t old_promiscuous;
>>> +	int diag;
>>>   
>>>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>   	dev = &rte_eth_devices[port_id];
>>>   
>>>   	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
>>> -	(*dev->dev_ops->promiscuous_enable)(dev);
>>> -	dev->data->promiscuous = 1;
>>> +	old_promiscuous = dev->data->promiscuous;
>>> +	diag = (*dev->dev_ops->promiscuous_enable)(dev);
>>> +	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
>>>   
>>> -	return 0;
>>> +	return eth_err(port_id, diag);
>>>   }
>>>   
>>>   int
>>>   rte_eth_promiscuous_disable(uint16_t port_id)
>>>   {
>>>   	struct rte_eth_dev *dev;
>>> +	uint8_t old_promiscuous;
>>> +	int diag;
>>>   
>>>   	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>>>   	dev = &rte_eth_devices[port_id];
>>>   
>>>   	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
>>> +	old_promiscuous = dev->data->promiscuous;
>>>   	dev->data->promiscuous = 0;
>>> -	(*dev->dev_ops->promiscuous_disable)(dev);
>>> +	diag = (*dev->dev_ops->promiscuous_disable)(dev);
>>> +	if (diag != 0)
>>> +		dev->data->promiscuous = old_promiscuous;
>> Not a real issue, but the enable/disable does exact same thing, slightly
>> different way, it makes double check if logic is different,
>> can you adapt one of them for both please.
>>
>> "
>> diag = foo();
>> dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
>> "
>> vs
>>
>> "
>> dev->data->promiscuous = 0;
>> diag = bar();
>> if (diag != 0)
>> 	dev->data->promiscuous = old_promiscuous;
>> "
> 
> I simply did not want to touch the logic in big patch series.
> Don't know why, but enable sets promiscuous=1 after callback,
> but disable does it before callback. That's why the difference.

Ahh, so there is a difference indeed.

> Logically it is a separate change and I definitely don't want to
> mix it.

Ok, fair enough.

> 
>>>   
>>> -	return 0;
>>> +	return eth_err(port_id, diag);
>>>   }
>>>   
>>>   int
>>> diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
>>> index 2394b32c83..6322348d17 100644
>>> --- a/lib/librte_ethdev/rte_ethdev_core.h
>>> +++ b/lib/librte_ethdev/rte_ethdev_core.h
>>> @@ -52,10 +52,10 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
>>>   typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
>>>   /**< @internal Function used to detect an Ethernet device removal. */
>>>   
>>> -typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
>>> +typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
>>>   /**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
>>>   
>>> -typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
>>> +typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
>>>   /**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
>> Should we add a note what is expected return value? This information is not
>> available anyplace, it may help driver developers.
> 
> Makes sense.
> 
> 


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 16:05       ` Andrew Rybchenko
@ 2019-09-13 16:34         ` Ferruh Yigit
  2019-09-13 19:57           ` Andrew Rybchenko
  0 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:34 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/2019 5:05 PM, Andrew Rybchenko wrote:
> On 9/13/19 6:39 PM, Ferruh Yigit wrote:
>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>> Enabling/disabling of promiscuous mode is not always successful and
>>> it should be taken into account to be able to handle it properly.
>>>
>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>
>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> <...>
>>
>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>> index f85458c3cd..41612ce838 100644
>>> --- a/drivers/net/tap/rte_eth_tap.c
>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>>   	return 0;
>>>   }
>>>   
>>> -static void
>>> +static int
>>>   tap_promisc_enable(struct rte_eth_dev *dev)
>>>   {
>>>   	struct pmd_internals *pmd = dev->data->dev_private;
>>>   	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>> +	int ret;
>>>   
>>> -	dev->data->promiscuous = 1;
>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>> +	if (ret != 0)
>>> +		return ret;
>>> +
>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>> +		dev->data->promiscuous = 1;
>> I think PMD shouldn't be setting this variable, it is already set by the API.
>> I quickly checked if an internal function requires this but it looks like it has
>> been set by mistake, I think we can remove this.
> 
> It is set after callback in the case of enable.

I see, but do we need it enabled earlier?

> 
>>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>> +		if (ret != 0) {
>>> +			/* Rollback promisc flag */
>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>> +			/*
>>> +			 * rte_eth_dev_promiscuous_enable() rollback
>>> +			 * dev->data->promiscuous in the case of failure.
>>> +			 */
>>> +			return ret;
>>> +		}
>>> +	}
>>> +
>>> +	return 0;
>>>   }
>>>   
>>> -static void
>>> +static int
>>>   tap_promisc_disable(struct rte_eth_dev *dev)
>>>   {
>>>   	struct pmd_internals *pmd = dev->data->dev_private;
>>>   	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>> +	int ret;
>>>   
>>> -	dev->data->promiscuous = 0;
>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>> +	if (ret != 0)
>>> +		return ret;
>>> +
>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>> +		dev->data->promiscuous = 0;
>> Ditto
>>
>>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>> +		if (ret != 0) {
>>> +			/* Rollback promisc flag */
>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>> +			/*
>>> +			 * rte_eth_dev_promiscuous_disable() rollback
>>> +			 * dev->data->promiscuous in the case of failure.
>>> +			 */
>>> +			return ret;
>>> +		}
>>> +	}
>>> +
>>> +	return 0;
>>>   }
> 
> 


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                     ` (12 preceding siblings ...)
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
@ 2019-09-13 16:37   ` Ferruh Yigit
  13 siblings, 0 replies; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:37 UTC (permalink / raw)
  To: Andrew Rybchenko, Thomas Monjalon, Rasesh Mody, Shahed Shaikh,
	Wenzhuo Lu
  Cc: dev, Ivan Ilchenko

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> It is the second patch series to get rid of void returning functions
> in ethdev in accordance with deprecation notice [1].
> 
> It should be applied on top of the first one [2].
> It could be applied separately, but few simple conflicts should
> be resolved.
> 
> Functions which return void are bad since they do not provide explicit
> information to the caller if everything is OK or not.
> It is especially painful in the case of promiscuous mode since it is
> not always supported, there are real cases when it fails to apply and
> it affects traffic which is received by the port.
> 
> Driver maintainrs are encouraged to review the patch which changes
> driver callbacks prototype. Changes are not always trivial when I tried
> to provide real status of the operation. I used -EAGAIN when I failed
> to choose better error code.
> 
> The following two drivers ignore status of internal functions and
> definitely could be improved:
> 
> net/bnx2x: bnx2x_set_rx_mode() can report failure, but it is used in
> other places and should be updated carefully.
> 
> net/igbvf: e1000_promisc_set_vf() provides return status, but it is
> unclear how handle it properly.
> 
> [1] https://patches.dpdk.org/patch/56969/
> [2] https://patches.dpdk.org/project/dpdk/list/?series=6279
> 
> v2:
>  - minor style fix in app/testpmd
>  - use fs_err() in net/failsafe in accordance with review from Gaetan
>  - fix net/mvpp2 build
>  - use eth_err() in ethdev
> 
> Andrew Rybchenko (2):
>   ethdev: change promiscuous callbacks to return status
>   ethdev: do nothing if promiscuous mode is applied again
> 
> Ivan Ilchenko (11):
>   ethdev: change promiscuous mode controllers to return errors
>   net/failsafe: check code of promiscuous mode switch
>   net/bonding: check code of promiscuous mode switch
>   app/pipeline: check code of promiscuous mode switch
>   app/testpmd: check code of promiscuous mode switch
>   app/eventdev: check code of promiscuous mode switch
>   app/pdump: check code of promiscuous mode switch
>   app/test: check code of promiscuous mode switch
>   kni: check code of promiscuous mode switch
>   test/bonding: check code of promiscuous mode switch
>   examples: take promiscuous mode switch result into account

I would like to get these API changes as early as possible, way before rc1 so
that there can be time to fix trivial issues, also before other driver patches
to prevent conflicts and new versions in these big patches.

Please help on reviewing your bits in these sets [1] so we can close them early.


[1]
* ethdev: change promiscuous mode functions to return status [This set]
  https://patches.dpdk.org/project/dpdk/list/?series=6334

* ethdev: change allmulticast controls to return status
  https://patches.dpdk.org/project/dpdk/list/?series=6335

* ethdev: change xstats reset function return value to int
  https://patches.dpdk.org/project/dpdk/list/?series=6308

* ethdev: change link status get functions return value to int
  https://patches.dpdk.org/project/dpdk/list/?series=6350

* ethdev: change MAC addr get function return value to int
  https://patches.dpdk.org/project/dpdk/list/?series=6355

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
@ 2019-09-13 16:40     ` Ferruh Yigit
  2019-09-13 18:30       ` Andrew Rybchenko
  0 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:40 UTC (permalink / raw)
  To: Andrew Rybchenko, Nicolas Chautru, Chas Williams, David Hunt,
	Harry van Haaren, Marko Kovacevic, Ori Kam, Bruce Richardson,
	Pablo de Lara, Radu Nicolau, Akhil Goyal, Tomasz Kantecki,
	Bernard Iremonger, Konstantin Ananyev, Cristian Dumitrescu,
	Declan Doherty, Anatoly Burakov, Reshma Pattan, John McNamara,
	Xiaoyun Li, Jasvinder Singh, Byron Marohn, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang
  Cc: dev, Ivan Ilchenko

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> value was changed from void to int, so this patch modify usage
> of these functions across examples according to new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
> index 0f48ae926c..a3a7478296 100644
> --- a/examples/vm_power_manager/main.c
> +++ b/examples/vm_power_manager/main.c
> @@ -121,7 +121,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
>  			addr.addr_bytes[4], addr.addr_bytes[5]);
>  
>  	/* Enable RX in promiscuous mode for the Ethernet device. */
> -	rte_eth_promiscuous_enable(port);
> +	retval = rte_eth_promiscuous_enable(port);
> +	if (ret != 0)
> +		return retval;

s/ret/retval

error: ‘ret’ undeclared (first use in this function)

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                       ` (3 preceding siblings ...)
  2019-09-13 15:39     ` Ferruh Yigit
@ 2019-09-13 16:43     ` Ferruh Yigit
  2019-09-13 20:33       ` Andrew Rybchenko
  2019-09-13 16:56     ` Ferruh Yigit
  5 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:43 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> @@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>  {
>  	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
> @@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>   *
>   * @param dev
>   *   Pointer to Ethernet device structure.
> + *
> + * @return
> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>   */
> -void
> +int
>  mlx4_promiscuous_disable(struct rte_eth_dev *dev)
>  {
>  	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);

error: control reaches end of non-void function [-Werror=return-type]

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                       ` (4 preceding siblings ...)
  2019-09-13 16:43     ` Ferruh Yigit
@ 2019-09-13 16:56     ` Ferruh Yigit
  2019-09-13 20:38       ` Andrew Rybchenko
  5 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-13 16:56 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
> Enabling/disabling of promiscuous mode is not always successful and
> it should be taken into account to be able to handle it properly.
> 
> When correct return status is unclear from driver code, -EAGAIN is used.
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

<...>

> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index aa716f3195..1da22ff866 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -750,37 +750,43 @@ static void
>  eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
>  {
>  	struct ifreq ifr;
> +	int ret = 0;
>  	int s;
>  
>  	s = socket(PF_INET, SOCK_DGRAM, 0);
>  	if (s < 0)
> -		return;
> +		return -errno;
>  
>  	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
> -	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
> +	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
> +		ret = -errno;
>  		goto out;
> +	}
>  	ifr.ifr_flags &= mask;
>  	ifr.ifr_flags |= flags;
> -	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
> +	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
> +		ret = -errno;
>  		goto out;
> +	}
>  out:
>  	close(s);
> +	return ret;
>  }

../drivers/net/af_xdp/rte_eth_af_xdp.c: In function ‘eth_dev_change_flags’:
../drivers/net/af_xdp/rte_eth_af_xdp.c:758:10: warning: ‘return’ with a value,
in function returning void [-Wreturn-type]
  758 |   return -errno;
      |          ^

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account
  2019-09-13 16:40     ` Ferruh Yigit
@ 2019-09-13 18:30       ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 18:30 UTC (permalink / raw)
  To: Ferruh Yigit, Nicolas Chautru, Chas Williams, David Hunt,
	Harry van Haaren, Marko Kovacevic, Ori Kam, Bruce Richardson,
	Pablo de Lara, Radu Nicolau, Akhil Goyal, Tomasz Kantecki,
	Bernard Iremonger, Konstantin Ananyev, Cristian Dumitrescu,
	Declan Doherty, Anatoly Burakov, Reshma Pattan, John McNamara,
	Xiaoyun Li, Jasvinder Singh, Byron Marohn, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang
  Cc: dev, Ivan Ilchenko

On 9/13/19 7:40 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>>
>> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
>> value was changed from void to int, so this patch modify usage
>> of these functions across examples according to new return type.
>>
>> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> <...>
>
>> diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
>> index 0f48ae926c..a3a7478296 100644
>> --- a/examples/vm_power_manager/main.c
>> +++ b/examples/vm_power_manager/main.c
>> @@ -121,7 +121,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
>>   			addr.addr_bytes[4], addr.addr_bytes[5]);
>>   
>>   	/* Enable RX in promiscuous mode for the Ethernet device. */
>> -	rte_eth_promiscuous_enable(port);
>> +	retval = rte_eth_promiscuous_enable(port);
>> +	if (ret != 0)
>> +		return retval;
> s/ret/retval
>
> error: ‘ret’ undeclared (first use in this function)

Thanks, unfortunately it was not build by ./devtools/test-build.sh
since libvirt-dev package was not installed.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 16:34         ` Ferruh Yigit
@ 2019-09-13 19:57           ` Andrew Rybchenko
  2019-09-16 13:22             ` Ferruh Yigit
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 19:57 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/19 7:34 PM, Ferruh Yigit wrote:
> On 9/13/2019 5:05 PM, Andrew Rybchenko wrote:
>> On 9/13/19 6:39 PM, Ferruh Yigit wrote:
>>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>>> Enabling/disabling of promiscuous mode is not always successful and
>>>> it should be taken into account to be able to handle it properly.
>>>>
>>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>>
>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>> <...>
>>>
>>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>>> index f85458c3cd..41612ce838 100644
>>>> --- a/drivers/net/tap/rte_eth_tap.c
>>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>>>    	return 0;
>>>>    }
>>>>    
>>>> -static void
>>>> +static int
>>>>    tap_promisc_enable(struct rte_eth_dev *dev)
>>>>    {
>>>>    	struct pmd_internals *pmd = dev->data->dev_private;
>>>>    	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>> +	int ret;
>>>>    
>>>> -	dev->data->promiscuous = 1;
>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>> +	if (ret != 0)
>>>> +		return ret;
>>>> +
>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>> +		dev->data->promiscuous = 1;
>>> I think PMD shouldn't be setting this variable, it is already set by the API.
>>> I quickly checked if an internal function requires this but it looks like it has
>>> been set by mistake, I think we can remove this.
>> It is set after callback in the case of enable.
> I see, but do we need it enabled earlier?

Not sure that I understand the question, but tap_ioctl() does not use it.
So, it is safe to move just before tap_flow_implicit_create().

>>>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>> +		if (ret != 0) {
>>>> +			/* Rollback promisc flag */
>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>> +			/*
>>>> +			 * rte_eth_dev_promiscuous_enable() rollback
>>>> +			 * dev->data->promiscuous in the case of failure.
>>>> +			 */
>>>> +			return ret;
>>>> +		}
>>>> +	}
>>>> +
>>>> +	return 0;
>>>>    }
>>>>    
>>>> -static void
>>>> +static int
>>>>    tap_promisc_disable(struct rte_eth_dev *dev)
>>>>    {
>>>>    	struct pmd_internals *pmd = dev->data->dev_private;
>>>>    	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>> +	int ret;
>>>>    
>>>> -	dev->data->promiscuous = 0;
>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>> +	if (ret != 0)
>>>> +		return ret;
>>>> +
>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>> +		dev->data->promiscuous = 0;
>>> Ditto
>>>
>>>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>> +		if (ret != 0) {
>>>> +			/* Rollback promisc flag */
>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>> +			/*
>>>> +			 * rte_eth_dev_promiscuous_disable() rollback
>>>> +			 * dev->data->promiscuous in the case of failure.
>>>> +			 */
>>>> +			return ret;
>>>> +		}
>>>> +	}
>>>> +
>>>> +	return 0;
>>>>    }


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 16:43     ` Ferruh Yigit
@ 2019-09-13 20:33       ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 20:33 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/19 7:43 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> <...>
>
>> @@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>>   {
>>   	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
>> @@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx4_promiscuous_disable(struct rte_eth_dev *dev)
>>   {
>>   	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
> error: control reaches end of non-void function [-Werror=return-type]

Thanks, will fix in the next version and install libverbs-dev to
be able to test build.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 16:56     ` Ferruh Yigit
@ 2019-09-13 20:38       ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 20:38 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/19 7:56 PM, Ferruh Yigit wrote:
> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> <...>
>
>> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> index aa716f3195..1da22ff866 100644
>> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
>> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
>> @@ -750,37 +750,43 @@ static void
>>   eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
>>   {
>>   	struct ifreq ifr;
>> +	int ret = 0;
>>   	int s;
>>   
>>   	s = socket(PF_INET, SOCK_DGRAM, 0);
>>   	if (s < 0)
>> -		return;
>> +		return -errno;
>>   
>>   	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
>> -	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
>> +	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
>> +		ret = -errno;
>>   		goto out;
>> +	}
>>   	ifr.ifr_flags &= mask;
>>   	ifr.ifr_flags |= flags;
>> -	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
>> +	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
>> +		ret = -errno;
>>   		goto out;
>> +	}
>>   out:
>>   	close(s);
>> +	return ret;
>>   }
> ../drivers/net/af_xdp/rte_eth_af_xdp.c: In function ‘eth_dev_change_flags’:
> ../drivers/net/af_xdp/rte_eth_af_xdp.c:758:10: warning: ‘return’ with a value,
> in function returning void [-Wreturn-type]
>    758 |   return -errno;
>        |          ^

Thanks, but this one is more tricky from build point of view to enable
AF_XDP PMD build. Failed to build even with 5.0.0 kernel and headers
on Ubuntu 18.04. So, I will rely on your and automation build checks.

Will try to fix in the next version.


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-10  7:53     ` Matan Azrad
@ 2019-09-13 21:05       ` Andrew Rybchenko
  0 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 21:05 UTC (permalink / raw)
  To: Matan Azrad, Slava Ovsiienko; +Cc: dev

On 9/10/19 10:53 AM, Matan Azrad wrote:
> Hi
>
> Review for mlx5 part:
>
> Added not very important comment below.
> You can stay it as is if no new version will be created.
>
> Acked-by: Matan Azrad <matan@mellanox.com>

Thank you, will fix in the next version.

> Thanks.
>
> From: Andrew Rybchenko
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>>   drivers/net/mlx4/mlx4.h                   |  4 +-
>>   drivers/net/mlx4/mlx4_ethdev.c            | 24 ++++++++---
>>   drivers/net/mlx5/mlx5.h                   |  4 +-
>>   drivers/net/mlx5/mlx5_rxmode.c            | 40 ++++++++++++++---
>>
>>   static void
>> diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
>> index 7730b530af..21517d70a2 100644
>> --- a/drivers/net/mlx4/mlx4.h
>> +++ b/drivers/net/mlx4/mlx4.h
>> @@ -205,8 +205,8 @@ int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t
>> *mtu);
>>   int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
>>   int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
>>   int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
>> -void mlx4_promiscuous_enable(struct rte_eth_dev *dev);
>> -void mlx4_promiscuous_disable(struct rte_eth_dev *dev);
>> +int mlx4_promiscuous_enable(struct rte_eth_dev *dev);
>> +int mlx4_promiscuous_disable(struct rte_eth_dev *dev);
>>   void mlx4_allmulticast_enable(struct rte_eth_dev *dev);
>>   void mlx4_allmulticast_disable(struct rte_eth_dev *dev);
>>   void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
>> diff --git a/drivers/net/mlx4/mlx4_ethdev.c
>> b/drivers/net/mlx4/mlx4_ethdev.c
>> index 623ebd88cb..c8a73bc1f4 100644
>> --- a/drivers/net/mlx4/mlx4_ethdev.c
>> +++ b/drivers/net/mlx4/mlx4_ethdev.c
>> @@ -341,13 +341,17 @@ enum rxmode_toggle {
>>    *   Pointer to Ethernet device structure.
>>    * @param toggle
>>    *   Toggle to set.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -static void
>> +static int
>>   mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle
>> toggle)
>>   {
>>   	struct mlx4_priv *priv = dev->data->dev_private;
>>   	const char *mode;
>>   	struct rte_flow_error error;
>> +	int ret;
>>
>>   	switch (toggle) {
>>   	case RXMODE_TOGGLE_PROMISC_OFF:
>> @@ -363,12 +367,16 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev,
>> enum rxmode_toggle toggle)
>>   	default:
>>   		mode = "undefined";
>>   	}
>> -	if (!mlx4_flow_sync(priv, &error))
>> -		return;
>> +
>> +	ret = mlx4_flow_sync(priv, &error);
>> +	if (!ret)
>> +		return 0;
>> +
>>   	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
>>   	      " flow error type %d, cause %p, message: %s",
>>   	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
>>   	      error.message ? error.message : "(unspecified)");
>> +	return ret;
>>   }
>>
>>   /**
>> @@ -376,8 +384,11 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev,
>> enum rxmode_toggle toggle)
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx4_promiscuous_enable(struct rte_eth_dev *dev)
>>   {
>>   	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
>> @@ -388,8 +399,11 @@ mlx4_promiscuous_enable(struct rte_eth_dev
>> *dev)
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx4_promiscuous_disable(struct rte_eth_dev *dev)
>>   {
>>   	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
>> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
>> index 8ddbb7a17c..11d540c3a5 100644
>> --- a/drivers/net/mlx5/mlx5.h
>> +++ b/drivers/net/mlx5/mlx5.h
>> @@ -752,8 +752,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev
>> *dev,
>>
>>   /* mlx5_rxmode.c */
>>
>> -void mlx5_promiscuous_enable(struct rte_eth_dev *dev);
>> -void mlx5_promiscuous_disable(struct rte_eth_dev *dev);
>> +int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
>> +int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
>>   void mlx5_allmulticast_enable(struct rte_eth_dev *dev);
>>   void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
>>
>> diff --git a/drivers/net/mlx5/mlx5_rxmode.c
>> b/drivers/net/mlx5/mlx5_rxmode.c
>> index d5077db0db..c862fc9520 100644
>> --- a/drivers/net/mlx5/mlx5_rxmode.c
>> +++ b/drivers/net/mlx5/mlx5_rxmode.c
>> @@ -28,8 +28,11 @@
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>>   {
>>   	struct mlx5_priv *priv = dev->data->dev_private;
>> @@ -41,14 +44,24 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>>   			"port %u cannot enable promiscuous mode"
>>   			" in flow isolation mode",
>>   			dev->data->port_id);
>> -		return;
>> +		return 0;
>> +	}
>> +	if (priv->config.vf) {
>> +		ret = mlx5_nl_promisc(dev, 1);
>> +		if (ret)
>> +			goto error;
> No need the jump, just return ret here and below.
>
>>   	}
>> -	if (priv->config.vf)
>> -		mlx5_nl_promisc(dev, 1);
>>   	ret = mlx5_traffic_restart(dev);
>>   	if (ret)
>>   		DRV_LOG(ERR, "port %u cannot enable promiscuous mode:
>> %s",
>>   			dev->data->port_id, strerror(rte_errno));
>> +
>> +error:
>> +	/*
>> +	 * rte_eth_dev_promiscuous_enable() rollback
>> +	 * dev->data->promiscuous in the case of failure.
>> +	 */
>> +	return ret;
>>   }
>>
>>   /**
>> @@ -56,20 +69,33 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
>>    *
>>    * @param dev
>>    *   Pointer to Ethernet device structure.
>> + *
>> + * @return
>> + *   0 on success, a negative errno value otherwise and rte_errno is set.
>>    */
>> -void
>> +int
>>   mlx5_promiscuous_disable(struct rte_eth_dev *dev)
>>   {
>>   	struct mlx5_priv *priv = dev->data->dev_private;
>>   	int ret;
>>
>>   	dev->data->promiscuous = 0;
>> -	if (priv->config.vf)
>> -		mlx5_nl_promisc(dev, 0);
>> +	if (priv->config.vf) {
>> +		ret = mlx5_nl_promisc(dev, 0);
>> +		if (ret)
>> +			goto error;
> Same here.
>
>> +	}
>>   	ret = mlx5_traffic_restart(dev);
>>   	if (ret)
>>   		DRV_LOG(ERR, "port %u cannot disable promiscuous mode:
>> %s",
>>   			dev->data->port_id, strerror(rte_errno));
>> +
>> +error:
>> +	/*
>> +	 * rte_eth_dev_promiscuous_disable() rollback
>> +	 * dev->data->promiscuous in the case of failure.
>> +	 */
>> +	return ret;
>>   }
>>
>>   /**


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-11  8:46     ` Hyong Youb Kim (hyonkim)
@ 2019-09-13 21:06       ` Andrew Rybchenko
  2019-09-16  6:48         ` Hyong Youb Kim (hyonkim)
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-13 21:06 UTC (permalink / raw)
  To: Hyong Youb Kim (hyonkim),
	John W. Linville, Xiaolong Ye, Qi Zhang, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Rasesh Mody, Shahed Shaikh, Ajit Khaparde, Somnath Kotur,
	Chas Williams, Rahul Lakkireddy, Hemant Agrawal, Sachin Saxena,
	Wenzhuo Lu, Gagandeep Singh, John Daley (johndale),
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon, Ferruh Yigit
  Cc: dev

On 9/11/19 11:46 AM, Hyong Youb Kim (hyonkim) wrote:
>> -----Original Message-----
>> From: Andrew Rybchenko <arybchenko@solarflare.com>
>> Sent: Monday, September 9, 2019 8:59 PM
> [...]
>> Subject: [PATCH v2 04/13] ethdev: change promiscuous callbacks to return
>> status
>>
>> Enabling/disabling of promiscuous mode is not always successful and
>> it should be taken into account to be able to handle it properly.
>>
>> When correct return status is unclear from driver code, -EAGAIN is used.
>>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>> ---
> [...]
>>   drivers/net/enic/enic.h                   |  2 +-
>>   drivers/net/enic/enic_ethdev.c            | 22 +++++++---
>>   drivers/net/enic/enic_main.c              |  4 +-
> [...]
>>   static void
>> diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
>> index 5a92508f00..72b1e7956b 100644
>> --- a/drivers/net/enic/enic.h
>> +++ b/drivers/net/enic/enic.h
>> @@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
>>   int enic_dev_stats_get(struct enic *enic,
>>   		       struct rte_eth_stats *r_stats);
>>   void enic_dev_stats_clear(struct enic *enic);
>> -void enic_add_packet_filter(struct enic *enic);
>> +int enic_add_packet_filter(struct enic *enic);
>>   int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
>>   int enic_del_mac_address(struct enic *enic, int mac_index);
>>   unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
>> diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
>> index 90fdeda901..5d48930a9d 100644
>> --- a/drivers/net/enic/enic_ethdev.c
>> +++ b/drivers/net/enic/enic_ethdev.c
>> @@ -603,29 +603,39 @@ static const uint32_t
>> *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
>>   	return NULL;
>>   }
>>
>> -static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev
>> *eth_dev)
>> +static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
>>   {
>>   	struct enic *enic = pmd_priv(eth_dev);
>> +	int ret;
>>
>>   	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>> -		return;
>> +		return -ENOTSUP;
> Should return -E_RTE_SECONDARY to be consistent with other handlers
> that check primary/secondary.

I'll fix in the next version, but please, note that -ENOTSUP has
special handling in ethdev patch on config restore. It looks like
different error code should not be a problem here, but please, check.

>>   	ENICPMD_FUNC_TRACE();
>>
>>   	enic->promisc = 1;
>> -	enic_add_packet_filter(enic);
>> +	ret = enic_add_packet_filter(enic);
>> +	if (ret != 0)
>> +		enic->promisc = 0;
>> +
>> +	return ret;
>>   }
>>
>> -static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev
>> *eth_dev)
>> +static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
>>   {
>>   	struct enic *enic = pmd_priv(eth_dev);
>> +	int ret;
>>
>>   	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>> -		return;
>> +		return -ENOTSUP;
> Should return -E_RTE_SECONDARY here too.
>
>>   	ENICPMD_FUNC_TRACE();
>>   	enic->promisc = 0;
>> -	enic_add_packet_filter(enic);
>> +	ret = enic_add_packet_filter(enic);
>> +	if (ret != 0)
>> +		enic->promisc = 1;
>> +
>> +	return ret;
>>   }
>>
>>   static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
>> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
>> index 40af3781b3..f4e76a057a 100644
>> --- a/drivers/net/enic/enic_main.c
>> +++ b/drivers/net/enic/enic_main.c
>> @@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
>>   			       enic->rss_enable);
>>   }
>>
>> -void enic_add_packet_filter(struct enic *enic)
>> +int enic_add_packet_filter(struct enic *enic)
>>   {
>>   	/* Args -> directed, multicast, broadcast, promisc, allmulti */
>> -	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
>> +	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
>>   		enic->promisc, enic->allmulti);
>>   }
>>
> A couple minor comments above. Other than those, patch works fine for enic.
> Feel free to add my ack on v2..
>
> Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
>

Thanks for review,
Andrew.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status
  2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
                   ` (13 preceding siblings ...)
  2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
@ 2019-09-14 11:37 ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
                     ` (13 more replies)
  14 siblings, 14 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, Rasesh Mody, Shahed Shaikh, Wenzhuo Lu
  Cc: dev, Ivan Ilchenko

It is the second patch series to get rid of void returning functions
in ethdev in accordance with deprecation notice [1].

It should be applied on top of the first one [2] which is already
applied to dpdk-next-net, but not in main DPDK repo.
It could be applied separately, but few simple conflicts should
be resolved.

Functions which return void are bad since they do not provide explicit
information to the caller if everything is OK or not.
It is especially painful in the case of promiscuous mode since it is
not always supported, there are real cases when it fails to apply and
it affects traffic which is received by the port.

Driver maintainrs are encouraged to review the patch which changes
driver callbacks prototype. Changes are not always trivial when I tried
to provide real status of the operation. I used -EAGAIN when I failed
to choose better error code.

The following two drivers ignore status of internal functions and
definitely could be improved:

net/bnx2x: bnx2x_set_rx_mode() can report failure, but it is used in
other places and should be updated carefully.

net/igbvf: e1000_promisc_set_vf() provides return status, but it is
unclear how handle it properly.

[1] https://patches.dpdk.org/patch/56969/
[2] https://patches.dpdk.org/project/dpdk/list/?series=6391

v3:
 - list and describe return values of promiscuous mode enable/disalbe callbacks
 - improve net/failsafe logging in the case of rollback failure to
   distinguish operation and rollback failure cases
 - fix build issue in AF_XDP PMD
 - fix build issue in mlx4 PMD
 - do not use goto and return error directly in mlx5
 - return -E_RTE_SECONDARY in net/enic in the case of secondary process
 - fix examples/vm_power_manager build

v2:
 - minor style fix in app/testpmd
 - use fs_err() in net/failsafe in accordance with review from Gaetan
 - fix net/mvpp2 build
 - use eth_err() in ethdev


Andrew Rybchenko (2):
  ethdev: change promiscuous callbacks to return status
  ethdev: do nothing if promiscuous mode is applied again

Ivan Ilchenko (11):
  ethdev: change promiscuous mode controllers to return errors
  net/failsafe: check code of promiscuous mode switch
  net/bonding: check code of promiscuous mode switch
  app/pipeline: check code of promiscuous mode switch
  app/testpmd: check code of promiscuous mode switch
  app/eventdev: check code of promiscuous mode switch
  app/pdump: check code of promiscuous mode switch
  app/test: check code of promiscuous mode switch
  kni: check code of promiscuous mode switch
  test/bonding: check code of promiscuous mode switch
  examples: take promiscuous mode switch result into account

 app/pdump/main.c                              |  8 +-
 app/test-eventdev/test_perf_common.c          |  7 +-
 app/test-eventdev/test_pipeline_common.c      |  7 +-
 app/test-pipeline/init.c                      |  5 +-
 app/test-pmd/cmdline.c                        | 23 +++---
 app/test-pmd/testpmd.c                        | 14 +++-
 app/test-pmd/testpmd.h                        |  1 +
 app/test-pmd/util.c                           | 16 ++++
 app/test/test_event_eth_rx_adapter.c          |  4 +-
 app/test/test_event_eth_tx_adapter.c          |  4 +-
 app/test/test_kni.c                           |  7 +-
 app/test/test_link_bonding.c                  | 55 +++++++++++---
 app/test/test_link_bonding_mode4.c            | 16 +++-
 app/test/test_pmd_perf.c                      |  6 +-
 app/test/virtual_pmd.c                        | 12 ++-
 doc/guides/rel_notes/deprecation.rst          |  1 -
 doc/guides/rel_notes/release_19_11.rst        |  4 +
 doc/guides/sample_app_ug/flow_classify.rst    |  6 +-
 doc/guides/sample_app_ug/flow_filtering.rst   | 15 +++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst   |  5 +-
 doc/guides/sample_app_ug/skeleton.rst         |  6 +-
 drivers/net/af_packet/rte_eth_af_packet.c     | 22 ++++--
 drivers/net/af_xdp/rte_eth_af_xdp.c           | 22 ++++--
 drivers/net/atlantic/atl_ethdev.c             | 12 ++-
 drivers/net/avp/avp_ethdev.c                  | 12 ++-
 drivers/net/axgbe/axgbe_ethdev.c              | 12 ++-
 drivers/net/bnx2x/bnx2x_ethdev.c              |  8 +-
 drivers/net/bnxt/bnxt_ethdev.c                | 26 +++++--
 drivers/net/bonding/rte_eth_bond_8023ad.c     | 17 ++++-
 drivers/net/bonding/rte_eth_bond_pmd.c        | 74 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c              | 12 +--
 drivers/net/cxgbe/cxgbe_pfvf.h                |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c                |  8 +-
 drivers/net/dpaa2/dpaa2_ethdev.c              | 12 ++-
 drivers/net/e1000/em_ethdev.c                 | 12 ++-
 drivers/net/e1000/igb_ethdev.c                | 24 ++++--
 drivers/net/enetc/enetc_ethdev.c              |  8 +-
 drivers/net/enic/enic.h                       |  2 +-
 drivers/net/enic/enic_ethdev.c                | 22 ++++--
 drivers/net/enic/enic_main.c                  |  4 +-
 drivers/net/failsafe/failsafe_ether.c         |  8 +-
 drivers/net/failsafe/failsafe_ops.c           | 52 +++++++++++--
 drivers/net/fm10k/fm10k_ethdev.c              | 24 ++++--
 drivers/net/hinic/hinic_pmd_ethdev.c          | 16 +++-
 drivers/net/i40e/i40e_ethdev.c                | 35 ++++++---
 drivers/net/i40e/i40e_ethdev_vf.c             | 20 +++--
 drivers/net/i40e/i40e_vf_representor.c        |  8 +-
 drivers/net/iavf/iavf_ethdev.c                | 20 +++--
 drivers/net/ice/ice_ethdev.c                  | 27 +++++--
 drivers/net/ipn3ke/ipn3ke_ethdev.h            |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c       |  8 +-
 drivers/net/ixgbe/ixgbe_ethdev.c              | 50 +++++++++---
 drivers/net/liquidio/lio_ethdev.c             | 30 +++++---
 drivers/net/mlx4/mlx4.h                       |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c                | 28 +++++--
 drivers/net/mlx5/mlx5.h                       |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c                | 38 ++++++++--
 drivers/net/mvneta/mvneta_ethdev.c            | 22 ++++--
 drivers/net/mvpp2/mrvl_ethdev.c               | 28 +++++--
 drivers/net/netvsc/hn_ethdev.c                |  8 +-
 drivers/net/netvsc/hn_var.h                   |  4 +-
 drivers/net/netvsc/hn_vf.c                    | 22 +++++-
 drivers/net/nfb/nfb_rxmode.c                  | 10 ++-
 drivers/net/nfb/nfb_rxmode.h                  |  8 +-
 drivers/net/nfp/nfp_net.c                     | 30 +++++---
 drivers/net/octeontx/octeontx_ethdev.c        | 16 ++--
 drivers/net/octeontx2/otx2_ethdev.h           |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c       |  8 +-
 drivers/net/qede/qede_ethdev.c                | 16 ++--
 drivers/net/sfc/sfc_ethdev.c                  | 14 ++--
 drivers/net/szedata2/rte_eth_szedata2.c       |  6 +-
 drivers/net/tap/rte_eth_tap.c                 | 52 ++++++++++---
 drivers/net/thunderx/nicvf_ethdev.c           |  3 +-
 drivers/net/virtio/virtio_ethdev.c            | 24 ++++--
 drivers/net/vmxnet3/vmxnet3_ethdev.c          | 12 ++-
 examples/bbdev_app/main.c                     |  7 +-
 examples/bond/main.c                          |  8 +-
 examples/distributor/main.c                   |  4 +-
 examples/eventdev_pipeline/main.c             |  4 +-
 examples/exception_path/main.c                |  5 +-
 examples/flow_classify/flow_classify.c        |  4 +-
 examples/flow_filtering/main.c                |  7 +-
 examples/ip_fragmentation/main.c              |  6 +-
 examples/ip_pipeline/link.c                   |  7 +-
 examples/ip_reassembly/main.c                 |  6 +-
 examples/ipsec-secgw/ipsec-secgw.c            |  9 ++-
 examples/kni/main.c                           |  9 ++-
 examples/l2fwd-cat/l2fwd-cat.c                |  4 +-
 examples/l2fwd-crypto/main.c                  |  7 +-
 examples/l2fwd-jobstats/main.c                |  9 ++-
 examples/l2fwd-keepalive/main.c               |  6 +-
 examples/l2fwd/main.c                         |  6 +-
 examples/l3fwd-acl/main.c                     |  9 ++-
 examples/l3fwd-power/main.c                   |  9 ++-
 examples/l3fwd/main.c                         |  9 ++-
 examples/link_status_interrupt/main.c         |  6 +-
 examples/load_balancer/init.c                 |  6 +-
 .../client_server_mp/mp_server/init.c         |  4 +-
 examples/multi_process/symmetric_mp/main.c    |  4 +-
 examples/netmap_compat/bridge/bridge.c        |  6 +-
 examples/packet_ordering/main.c               |  4 +-
 .../performance-thread/l3fwd-thread/main.c    |  9 ++-
 examples/ptpclient/ptpclient.c                |  7 +-
 examples/qos_meter/main.c                     | 12 ++-
 examples/qos_sched/init.c                     |  6 +-
 examples/quota_watermark/qw/init.c            |  6 +-
 examples/rxtx_callbacks/main.c                |  5 +-
 examples/server_node_efd/server/init.c        |  4 +-
 examples/skeleton/basicfwd.c                  |  4 +-
 examples/vhost/main.c                         | 11 ++-
 examples/vm_power_manager/main.c              |  4 +-
 lib/librte_ethdev/rte_ethdev.c                | 76 +++++++++++++++----
 lib/librte_ethdev/rte_ethdev.h                | 14 +++-
 lib/librte_ethdev/rte_ethdev_core.h           | 52 ++++++++++++-
 lib/librte_kni/rte_kni.c                      | 14 +++-
 115 files changed, 1202 insertions(+), 385 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
                     ` (12 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Neil Horman, John McNamara, Marko Kovacevic, Bernard Iremonger,
	Ori Kam, Bruce Richardson, Radu Nicolau, Akhil Goyal,
	Tomasz Kantecki, Harry van Haaren, Xiaoyun Li, Thomas Monjalon,
	Ferruh Yigit
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

Change rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable()
return value from void to int and return negative errno values
in case of error conditions.
Modify usage of these functions across the ethdev according
to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst        |  1 -
 doc/guides/rel_notes/release_19_11.rst      |  4 ++
 doc/guides/sample_app_ug/flow_classify.rst  |  6 ++-
 doc/guides/sample_app_ug/flow_filtering.rst | 15 +++++-
 doc/guides/sample_app_ug/rxtx_callbacks.rst |  5 +-
 doc/guides/sample_app_ug/skeleton.rst       |  6 ++-
 lib/librte_ethdev/rte_ethdev.c              | 52 ++++++++++++++++-----
 lib/librte_ethdev/rte_ethdev.h              | 14 +++++-
 8 files changed, 80 insertions(+), 23 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index cbb4c34ef..b2e0a1fc7 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -88,7 +88,6 @@ Deprecation Notices
   negative errno values to indicate various error conditions (e.g.
   invalid port ID, unsupported operation, failed operation):
 
-  - ``rte_eth_promiscuous_enable`` and ``rte_eth_promiscuous_disable``
   - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable``
   - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
   - ``rte_eth_dev_stop``
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index c8d97f16e..90c03cb8f 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -97,6 +97,10 @@ API Changes
 * ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` to
   ``int`` to provide a way to report various error conditions.
 
+* ethdev: changed ``rte_eth_promiscuous_enable`` and
+  ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
+  provide a way to report various error conditions.
+
 
 ABI Changes
 -----------
diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst
index 96a5c66d0..7c2b6dcf8 100644
--- a/doc/guides/sample_app_ug/flow_classify.rst
+++ b/doc/guides/sample_app_ug/flow_classify.rst
@@ -315,7 +315,9 @@ Forwarding application is shown below:
                addr.addr_bytes[4], addr.addr_bytes[5]);
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+                return retval;
 
         return 0;
     }
@@ -343,7 +345,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-    rte_eth_promiscuous_enable(port);
+    retval = rte_eth_promiscuous_enable(port);
 
 The Add Rules function
 ~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst
index 02fc67550..de3e4ab0b 100644
--- a/doc/guides/sample_app_ug/flow_filtering.rst
+++ b/doc/guides/sample_app_ug/flow_filtering.rst
@@ -193,7 +193,13 @@ application is shown below:
                    }
           }
 
-           rte_eth_promiscuous_enable(port_id);
+           ret = rte_eth_promiscuous_enable(port_id);
+           if (ret != 0) {
+                   rte_exit(EXIT_FAILURE,
+                           ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                           ret, port_id);
+           }
+
            ret = rte_eth_dev_start(port_id);
            if (ret < 0) {
                    rte_exit(EXIT_FAILURE,
@@ -278,7 +284,12 @@ We are setting the RX port to promiscuous mode:
 
 .. code-block:: c
 
-   rte_eth_promiscuous_enable(port_id);
+   ret = rte_eth_promiscuous_enable(port_id);
+   if (ret != 0) {
+        rte_exit(EXIT_FAILURE,
+                 ":: cannot enable promiscuous mode: err=%d, port=%u\n",
+                 ret, port_id);
+   }
 
 The last step is to start the port.
 
diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst
index 32c120992..0a69ec71a 100644
--- a/doc/guides/sample_app_ug/rxtx_callbacks.rst
+++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst
@@ -117,8 +117,9 @@ comments:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
-
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         /* Add the callbacks for RX and TX.*/
         rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst
index 59ca511d3..1d0a2760d 100644
--- a/doc/guides/sample_app_ug/skeleton.rst
+++ b/doc/guides/sample_app_ug/skeleton.rst
@@ -149,7 +149,9 @@ Forwarding application is shown below:
             return retval;
 
         /* Enable RX in promiscuous mode for the Ethernet device. */
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
+        if (retval != 0)
+            return retval;
 
         return 0;
     }
@@ -177,7 +179,7 @@ Finally the RX port is set in promiscuous mode:
 
 .. code-block:: c
 
-        rte_eth_promiscuous_enable(port);
+        retval = rte_eth_promiscuous_enable(port);
 
 
 The Lcores Main
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 30b0c7803..b97dd8aa8 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1381,24 +1381,41 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev,
 	}
 }
 
-static void
+static int
 rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 			   struct rte_eth_dev_info *dev_info, uint16_t port_id)
 {
+	int ret;
+
 	if (!(*dev_info->dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR))
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1)
-		rte_eth_promiscuous_enable(port_id);
-	else if (rte_eth_promiscuous_get(port_id) == 0)
-		rte_eth_promiscuous_disable(port_id);
+	if (rte_eth_promiscuous_get(port_id) == 1) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to enable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	} else if (rte_eth_promiscuous_get(port_id) == 0) {
+		ret = rte_eth_promiscuous_disable(port_id);
+		if (ret != 0 && ret != -ENOTSUP) {
+			RTE_ETHDEV_LOG(ERR,
+				"Failed to disable promiscuous mode for device (port %u): %s\n",
+				port_id, rte_strerror(-ret));
+			return ret;
+		}
+	}
 
 	/* replay all multicast configuration */
 	if (rte_eth_allmulticast_get(port_id) == 1)
 		rte_eth_allmulticast_enable(port_id);
 	else if (rte_eth_allmulticast_get(port_id) == 0)
 		rte_eth_allmulticast_disable(port_id);
+
+	return 0;
 }
 
 int
@@ -1436,7 +1453,14 @@ rte_eth_dev_start(uint16_t port_id)
 	else
 		return eth_err(port_id, diag);
 
-	rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	ret = rte_eth_dev_config_restore(dev, &dev_info, port_id);
+	if (ret != 0) {
+		RTE_ETHDEV_LOG(ERR,
+			"Error during restoring configuration for device (port %u): %s\n",
+			port_id, rte_strerror(-ret));
+		rte_eth_dev_stop(port_id);
+		return ret;
+	}
 
 	if (dev->data->dev_conf.intr_conf.lsc == 0) {
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
@@ -1864,30 +1888,34 @@ rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
 	return eth_err(port_id, ret);
 }
 
-void
+int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_enable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
 	(*dev->dev_ops->promiscuous_enable)(dev);
 	dev->data->promiscuous = 1;
+
+	return 0;
 }
 
-void
+int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
 
-	RTE_ETH_VALID_PORTID_OR_RET(port_id);
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	RTE_FUNC_PTR_OR_RET(*dev->dev_ops->promiscuous_disable);
+	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
 	dev->data->promiscuous = 0;
 	(*dev->dev_ops->promiscuous_disable)(dev);
+
+	return 0;
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 475dbdae1..f07a829b2 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -2022,16 +2022,26 @@ int rte_eth_dev_reset(uint16_t port_id);
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_enable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_enable(uint16_t port_id);
+int rte_eth_promiscuous_enable(uint16_t port_id);
 
 /**
  * Disable receipt in promiscuous mode for an Ethernet device.
  *
  * @param port_id
  *   The port identifier of the Ethernet device.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENOTSUP) if support for promiscuous_disable() does not exist
+ *     for the device.
+ *   - (-ENODEV) if *port_id* invalid.
  */
-void rte_eth_promiscuous_disable(uint16_t port_id);
+int rte_eth_promiscuous_disable(uint16_t port_id);
 
 /**
  * Return the value of promiscuous mode for an Ethernet device.
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 02/13] net/failsafe: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 03/13] net/bonding: " Andrew Rybchenko
                     ` (11 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Gaetan Rivet; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/failsafe according to new return type.

Try to keep promiscuous mode consistent across all active
devices in the case of failure.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 drivers/net/failsafe/failsafe_ether.c |  8 +++--
 drivers/net/failsafe/failsafe_ops.c   | 44 ++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 504c76edb..bd38f1c1e 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -126,9 +126,13 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev,
 	if (dev->data->promiscuous != edev->data->promiscuous) {
 		DEBUG("Configuring promiscuous");
 		if (dev->data->promiscuous)
-			rte_eth_promiscuous_enable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
 		else
-			rte_eth_promiscuous_disable(PORT_ID(sdev));
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		if (ret != 0) {
+			ERROR("Failed to apply promiscuous mode");
+			return ret;
+		}
 	} else {
 		DEBUG("promiscuous already set");
 	}
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index 2683b8fe5..af2c216f3 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -659,10 +659,28 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_enable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+		ret = fs_err(sdev, ret);
+		if (ret != 0) {
+			ERROR("Promiscuous mode enable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+			ret = fs_err(sdev, ret);
+			if (ret != 0)
+				ERROR("Promiscuous mode disable during rollback failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
 }
 
@@ -671,10 +689,28 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
 	uint8_t i;
+	int ret = 0;
 
 	fs_lock(dev, 0);
-	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE)
-		rte_eth_promiscuous_disable(PORT_ID(sdev));
+	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+		ret = rte_eth_promiscuous_disable(PORT_ID(sdev));
+		ret = fs_err(sdev, ret);
+		if (ret != 0) {
+			ERROR("Promiscuous mode disable failed for subdevice %d",
+				PORT_ID(sdev));
+			break;
+		}
+	}
+	if (ret != 0) {
+		/* Rollback in the case of failure */
+		FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
+			ret = rte_eth_promiscuous_enable(PORT_ID(sdev));
+			ret = fs_err(sdev, ret);
+			if (ret != 0)
+				ERROR("Promiscuous mode enable during rollback failed for subdevice %d",
+					PORT_ID(sdev));
+		}
+	}
 	fs_unlock(dev, 0);
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 03/13] net/bonding: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
                     ` (10 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across net/bonding according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 17 ++++++++++--
 drivers/net/bonding/rte_eth_bond_pmd.c    | 34 +++++++++++++++++++----
 2 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index fbc69051a..7189a8458 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -913,6 +913,8 @@ bond_mode_8023ad_periodic_cb(void *arg)
 static int
 bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	rte_eth_allmulticast_enable(slave_id);
 	if (rte_eth_allmulticast_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
@@ -922,7 +924,12 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 		return 0;
 	}
 
-	rte_eth_promiscuous_enable(slave_id);
+	ret = rte_eth_promiscuous_enable(slave_id);
+	if (ret != 0) {
+		RTE_BOND_LOG(ERR,
+			"failed to enable promiscuous mode for port %u: %s",
+			slave_id, rte_strerror(-ret));
+	}
 	if (rte_eth_promiscuous_get(slave_id)) {
 		RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u",
 			     slave_id);
@@ -937,6 +944,8 @@ bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
 static void
 bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 {
+	int ret;
+
 	switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) {
 	case BOND_8023AD_FORCED_ALLMULTI:
 		RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id);
@@ -945,7 +954,11 @@ bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
 
 	case BOND_8023AD_FORCED_PROMISC:
 		RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id);
-		rte_eth_promiscuous_disable(slave_id);
+		ret = rte_eth_promiscuous_disable(slave_id);
+		if (ret != 0)
+			RTE_BOND_LOG(ERR,
+				"failed to disable promiscuous mode for port %u: %s",
+				slave_id, rte_strerror(-ret));
 		break;
 
 	default:
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a994c9abd..edf660db3 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2487,6 +2487,8 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
 	int i;
+	int ret = 0;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2495,9 +2497,13 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
-			rte_eth_promiscuous_enable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2508,7 +2514,12 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_enable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
@@ -2517,6 +2528,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
+	int ret;
+	uint16_t port_id;
 
 	switch (internals->mode) {
 	/* Promiscuous mode is propagated to all slaves */
@@ -2525,13 +2538,17 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_BROADCAST:
 	case BONDING_MODE_8023AD:
 		for (i = 0; i < internals->slave_count; i++) {
-			uint16_t port_id = internals->slaves[i].port_id;
+			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
 					BOND_8023AD_FORCED_PROMISC)
 				continue;
-			rte_eth_promiscuous_disable(port_id);
+			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));
 		}
 		break;
 	/* Promiscuous mode is propagated only to primary slave */
@@ -2542,7 +2559,12 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 		/* Do not touch promisc when there cannot be primary ports */
 		if (internals->slave_count == 0)
 			break;
-		rte_eth_promiscuous_disable(internals->current_primary_port);
+		port_id = internals->current_primary_port;
+		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));
 	}
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (2 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 03/13] net/bonding: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
                     ` (9 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: John W. Linville, Xiaolong Ye, Qi Zhang, Igor Russkikh,
	Pavel Belous, Allain Legacy, Matt Peters, Ravi Kumar,
	Rasesh Mody, Shahed Shaikh, Ajit Khaparde, Somnath Kotur,
	Chas Williams, Rahul Lakkireddy, Hemant Agrawal, Sachin Saxena,
	Wenzhuo Lu, Gagandeep Singh, John Daley, Hyong Youb Kim,
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Zyta Szpak, Liron Himi, Tomasz Duszynski,
	Stephen Hemminger, K. Y. Srinivasan, Haiyang Zhang,
	Rastislav Cernay, Jan Remes, Alejandro Lucero, Jerin Jacob,
	Nithin Dabilpuram, Kiran Kumar K, Keith Wiles, Maciej Czekaj,
	Maxime Coquelin, Tiwei Bie, Zhihong Wang, Yong Wang,
	Thomas Monjalon, Ferruh Yigit
  Cc: dev

Enabling/disabling of promiscuous mode is not always successful and
it should be taken into account to be able to handle it properly.

When correct return status is unclear from driver code, -EAGAIN is used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
---
 app/test/virtual_pmd.c                    | 12 ++++--
 drivers/net/af_packet/rte_eth_af_packet.c | 22 ++++++----
 drivers/net/af_xdp/rte_eth_af_xdp.c       | 22 ++++++----
 drivers/net/atlantic/atl_ethdev.c         | 12 ++++--
 drivers/net/avp/avp_ethdev.c              | 12 ++++--
 drivers/net/axgbe/axgbe_ethdev.c          | 12 ++++--
 drivers/net/bnx2x/bnx2x_ethdev.c          |  8 +++-
 drivers/net/bnxt/bnxt_ethdev.c            | 26 +++++++++---
 drivers/net/bonding/rte_eth_bond_pmd.c    | 42 +++++++++++++++---
 drivers/net/cxgbe/cxgbe_ethdev.c          | 12 +++---
 drivers/net/cxgbe/cxgbe_pfvf.h            |  4 +-
 drivers/net/dpaa/dpaa_ethdev.c            |  8 +++-
 drivers/net/dpaa2/dpaa2_ethdev.c          | 12 ++++--
 drivers/net/e1000/em_ethdev.c             | 12 ++++--
 drivers/net/e1000/igb_ethdev.c            | 24 +++++++----
 drivers/net/enetc/enetc_ethdev.c          |  8 +++-
 drivers/net/enic/enic.h                   |  2 +-
 drivers/net/enic/enic_ethdev.c            | 22 +++++++---
 drivers/net/enic/enic_main.c              |  4 +-
 drivers/net/failsafe/failsafe_ops.c       |  8 +++-
 drivers/net/fm10k/fm10k_ethdev.c          | 24 +++++++----
 drivers/net/hinic/hinic_pmd_ethdev.c      | 16 ++++++-
 drivers/net/i40e/i40e_ethdev.c            | 35 +++++++++++----
 drivers/net/i40e/i40e_ethdev_vf.c         | 20 ++++++---
 drivers/net/i40e/i40e_vf_representor.c    |  8 ++--
 drivers/net/iavf/iavf_ethdev.c            | 20 ++++++---
 drivers/net/ice/ice_ethdev.c              | 27 +++++++++---
 drivers/net/ipn3ke/ipn3ke_ethdev.h        |  4 +-
 drivers/net/ipn3ke/ipn3ke_representor.c   |  8 +++-
 drivers/net/ixgbe/ixgbe_ethdev.c          | 50 +++++++++++++++++-----
 drivers/net/liquidio/lio_ethdev.c         | 30 ++++++++-----
 drivers/net/mlx4/mlx4.h                   |  4 +-
 drivers/net/mlx4/mlx4_ethdev.c            | 28 +++++++++---
 drivers/net/mlx5/mlx5.h                   |  4 +-
 drivers/net/mlx5/mlx5_rxmode.c            | 38 ++++++++++++++---
 drivers/net/mvneta/mvneta_ethdev.c        | 22 +++++++---
 drivers/net/mvpp2/mrvl_ethdev.c           | 28 +++++++++---
 drivers/net/netvsc/hn_ethdev.c            |  8 ++--
 drivers/net/netvsc/hn_var.h               |  4 +-
 drivers/net/netvsc/hn_vf.c                | 22 ++++++++--
 drivers/net/nfb/nfb_rxmode.c              | 10 +++--
 drivers/net/nfb/nfb_rxmode.h              |  8 +++-
 drivers/net/nfp/nfp_net.c                 | 30 ++++++++-----
 drivers/net/octeontx/octeontx_ethdev.c    | 16 ++++---
 drivers/net/octeontx2/otx2_ethdev.h       |  4 +-
 drivers/net/octeontx2/otx2_ethdev_ops.c   |  8 +++-
 drivers/net/qede/qede_ethdev.c            | 16 ++++---
 drivers/net/sfc/sfc_ethdev.c              | 14 +++---
 drivers/net/szedata2/rte_eth_szedata2.c   |  6 ++-
 drivers/net/tap/rte_eth_tap.c             | 52 ++++++++++++++++++-----
 drivers/net/thunderx/nicvf_ethdev.c       |  3 +-
 drivers/net/virtio/virtio_ethdev.c        | 24 +++++++----
 drivers/net/vmxnet3/vmxnet3_ethdev.c      | 12 ++++--
 lib/librte_ethdev/rte_ethdev.c            | 18 +++++---
 lib/librte_ethdev/rte_ethdev_core.h       | 52 +++++++++++++++++++++--
 55 files changed, 692 insertions(+), 265 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index e295891c0..b34df416a 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -210,13 +210,17 @@ virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
 	memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
 }
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_enable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
-static void
+static int
 virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused)
-{}
+{
+	return 0;
+}
 
 static int
 virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev,
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 66131b53e..049572728 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -458,41 +458,47 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	return 0;
 }
 
-static void
+static int
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index aa716f319..096815732 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -746,41 +746,47 @@ eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	return (ret < 0) ? -errno : 0;
 }
 
-static void
+static int
 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
 {
 	struct ifreq ifr;
+	int ret = 0;
 	int s;
 
 	s = socket(PF_INET, SOCK_DGRAM, 0);
 	if (s < 0)
-		return;
+		return -errno;
 
 	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
-	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 	ifr.ifr_flags &= mask;
 	ifr.ifr_flags |= flags;
-	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0)
+	if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
+		ret = -errno;
 		goto out;
+	}
 out:
 	close(s);
+	return ret;
 }
 
-static void
+static int
 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
+	return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
 }
 
-static void
+static int
 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
 
-	eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
+	return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
 }
 
 static const struct eth_dev_ops ops = {
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index b056f8229..5018529da 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -24,8 +24,8 @@ static int  atl_dev_set_link_up(struct rte_eth_dev *dev);
 static int  atl_dev_set_link_down(struct rte_eth_dev *dev);
 static void atl_dev_close(struct rte_eth_dev *dev);
 static int  atl_dev_reset(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int  atl_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void atl_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int  atl_dev_link_update(struct rte_eth_dev *dev, int wait);
@@ -1207,20 +1207,24 @@ atl_dev_link_update(struct rte_eth_dev *dev, int wait __rte_unused)
 	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, true);
+
+	return 0;
 }
 
-static void
+static int
 atl_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	hw_atl_rpfl2promiscuous_mode_en_set(hw, false);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index c5801f319..050901990 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -45,8 +45,8 @@ static int avp_dev_info_get(struct rte_eth_dev *dev,
 			    struct rte_eth_dev_info *dev_info);
 static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int avp_dev_promiscuous_disable(struct rte_eth_dev *dev);
 
 static int avp_dev_rx_queue_setup(struct rte_eth_dev *dev,
 				  uint16_t rx_queue_id,
@@ -2157,7 +2157,7 @@ avp_dev_link_update(struct rte_eth_dev *eth_dev,
 	return -1;
 }
 
-static void
+static int
 avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2169,9 +2169,11 @@ avp_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
-static void
+static int
 avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -2183,6 +2185,8 @@ avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 			    eth_dev->data->port_id);
 	}
 	rte_spinlock_unlock(&avp->lock);
+
+	return 0;
 }
 
 static int
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 5a7da7512..c43b5bfb6 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -15,8 +15,8 @@ static int  axgbe_dev_start(struct rte_eth_dev *dev);
 static void axgbe_dev_stop(struct rte_eth_dev *dev);
 static void axgbe_dev_interrupt_handler(void *param);
 static void axgbe_dev_close(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int axgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -236,7 +236,7 @@ axgbe_dev_close(struct rte_eth_dev *dev)
 	axgbe_dev_clear_queues(dev);
 }
 
-static void
+static int
 axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -244,9 +244,11 @@ axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
+
+	return 0;
 }
 
-static void
+static int
 axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct axgbe_port *pdata = dev->data->dev_private;
@@ -254,6 +256,8 @@ axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b7359514e..07168e9a8 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -292,7 +292,7 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
 	bnx2x_free_ilt_mem(sc);
 }
 
-static void
+static int
 bnx2x_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -302,9 +302,11 @@ bnx2x_promisc_enable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI_PROMISC;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
-static void
+static int
 bnx2x_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct bnx2x_softc *sc = dev->data->dev_private;
@@ -314,6 +316,8 @@ bnx2x_promisc_disable(struct rte_eth_dev *dev)
 	if (rte_eth_allmulticast_get(dev->data->port_id) == 1)
 		sc->rx_mode = BNX2X_RX_MODE_ALLMULTI;
 	bnx2x_set_rx_mode(sc);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b521a7296..7fff5d5b8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1006,32 +1006,46 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 	return rc;
 }
 
-static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags |= BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
-static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
+static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
+	uint32_t old_flags;
+	int rc;
 
 	if (bp->vnic_info == NULL)
-		return;
+		return 0;
 
 	vnic = &bp->vnic_info[0];
 
+	old_flags = vnic->flags;
 	vnic->flags &= ~BNXT_VNIC_INFO_PROMISC;
-	bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
+	if (rc != 0)
+		vnic->flags = old_flags;
+
+	return rc;
 }
 
 static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index edf660db3..f9b7b595d 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1915,7 +1915,7 @@ bond_ethdev_primary_set(struct bond_dev_private *internals,
 		}
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev);
 
 static int
@@ -2482,7 +2482,7 @@ bond_ethdev_stats_reset(struct rte_eth_dev *dev)
 		rte_eth_stats_reset(internals->slaves[i].port_id);
 }
 
-static void
+static int
 bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct bond_dev_private *internals = eth_dev->data->dev_private;
@@ -2495,7 +2495,9 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
@@ -2504,8 +2506,17 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				RTE_BOND_LOG(ERR,
 					"Failed to enable promiscuous mode for port %u: %s",
 					port_id, rte_strerror(-ret));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2521,14 +2532,16 @@ bond_ethdev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 				"Failed to enable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
-static void
+static int
 bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct bond_dev_private *internals = dev->data->dev_private;
 	int i;
-	int ret;
+	int ret = 0;
 	uint16_t port_id;
 
 	switch (internals->mode) {
@@ -2536,21 +2549,34 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 	case BONDING_MODE_ROUND_ROBIN:
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
-	case BONDING_MODE_8023AD:
+	case BONDING_MODE_8023AD: {
+		unsigned int slave_ok = 0;
+
 		for (i = 0; i < internals->slave_count; i++) {
 			port_id = internals->slaves[i].port_id;
 
 			if (internals->mode == BONDING_MODE_8023AD &&
 			    bond_mode_8023ad_ports[port_id].forced_rx_flags ==
-					BOND_8023AD_FORCED_PROMISC)
+					BOND_8023AD_FORCED_PROMISC) {
+				slave_ok++;
 				continue;
+			}
 			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));
+			else
+				slave_ok++;
 		}
+		/*
+		 * Report success if operation is successful on at least
+		 * on one slave. Otherwise return last error code.
+		 */
+		if (slave_ok > 0)
+			ret = 0;
 		break;
+	}
 	/* Promiscuous mode is propagated only to primary slave */
 	case BONDING_MODE_ACTIVE_BACKUP:
 	case BONDING_MODE_TLB:
@@ -2566,6 +2592,8 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev)
 				"Failed to disable promiscuous mode for port %u: %s",
 				port_id, rte_strerror(-ret));
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 19c2a3c4d..be001a0d2 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -150,22 +150,22 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 	return 0;
 }
 
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      1, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     1, -1, 1, -1, false);
 }
 
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
-	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
-		      0, -1, 1, -1, false);
+	return t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
+			     0, -1, 1, -1, false);
 }
 
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h
index 011ec1386..bfa07ba55 100644
--- a/drivers/net/cxgbe/cxgbe_pfvf.h
+++ b/drivers/net/cxgbe/cxgbe_pfvf.h
@@ -12,8 +12,8 @@ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_close(struct rte_eth_dev *eth_dev);
 int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 		       struct rte_eth_dev_info *device_info);
-void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
-void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev);
+int cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr);
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 25deadb94..ad28c110d 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -514,22 +514,26 @@ dpaa_xstats_get_names_by_id(
 	return limit;
 }
 
-static void dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_enable(dpaa_intf->fif);
+
+	return 0;
 }
 
-static void dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
+static int dpaa_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	fman_if_promiscuous_disable(dpaa_intf->fif);
+
+	return 0;
 }
 
 static void dpaa_eth_multicast_enable(struct rte_eth_dev *dev)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 879bbc120..d9cc2c351 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -987,7 +987,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
 	rte_eth_linkstatus_set(dev, &link);
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_enable(
 		struct rte_eth_dev *dev)
 {
@@ -999,7 +999,7 @@ dpaa2_dev_promiscuous_enable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
@@ -1009,9 +1009,11 @@ dpaa2_dev_promiscuous_enable(
 	ret = dpni_set_multicast_promisc(dpni, CMD_PRI_LOW, priv->token, true);
 	if (ret < 0)
 		DPAA2_PMD_ERR("Unable to enable M promisc mode %d", ret);
+
+	return ret;
 }
 
-static void
+static int
 dpaa2_dev_promiscuous_disable(
 		struct rte_eth_dev *dev)
 {
@@ -1023,7 +1025,7 @@ dpaa2_dev_promiscuous_disable(
 
 	if (dpni == NULL) {
 		DPAA2_PMD_ERR("dpni is NULL");
-		return;
+		return -ENODEV;
 	}
 
 	ret = dpni_set_unicast_promisc(dpni, CMD_PRI_LOW, priv->token, false);
@@ -1037,6 +1039,8 @@ dpaa2_dev_promiscuous_disable(
 			DPAA2_PMD_ERR("Unable to disable M promisc mode %d",
 				      ret);
 	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 885095790..8fe39176a 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -35,8 +35,8 @@ static int eth_em_configure(struct rte_eth_dev *dev);
 static int eth_em_start(struct rte_eth_dev *dev);
 static void eth_em_stop(struct rte_eth_dev *dev);
 static void eth_em_close(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_disable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_em_link_update(struct rte_eth_dev *dev,
@@ -1263,7 +1263,7 @@ em_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1273,9 +1273,11 @@ eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -1289,6 +1291,8 @@ eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 6172f9ac6..a9f6de5d5 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -79,8 +79,8 @@ static int  eth_igb_dev_set_link_up(struct rte_eth_dev *dev);
 static int  eth_igb_dev_set_link_down(struct rte_eth_dev *dev);
 static void eth_igb_close(struct rte_eth_dev *dev);
 static int eth_igb_reset(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_enable(struct rte_eth_dev *dev);
+static int  eth_igb_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_igb_allmulticast_disable(struct rte_eth_dev *dev);
 static int  eth_igb_link_update(struct rte_eth_dev *dev,
@@ -156,8 +156,8 @@ static int igbvf_dev_configure(struct rte_eth_dev *dev);
 static int igbvf_dev_start(struct rte_eth_dev *dev);
 static void igbvf_dev_stop(struct rte_eth_dev *dev);
 static void igbvf_dev_close(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_enable(struct rte_eth_dev *dev);
-static void igbvf_promiscuous_disable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_enable(struct rte_eth_dev *dev);
+static int igbvf_promiscuous_disable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_enable(struct rte_eth_dev *dev);
 static void igbvf_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_igbvf_link_update(struct e1000_hw *hw);
@@ -2519,7 +2519,7 @@ igb_release_manageability(struct e1000_hw *hw)
 	}
 }
 
-static void
+static int
 eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2529,9 +2529,11 @@ eth_igb_promiscuous_enable(struct rte_eth_dev *dev)
 	rctl = E1000_READ_REG(hw, E1000_RCTL);
 	rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
-static void
+static int
 eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw =
@@ -2545,6 +2547,8 @@ eth_igb_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		rctl &= (~E1000_RCTL_MPE);
 	E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+	return 0;
 }
 
 static void
@@ -3390,16 +3394,18 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 	igbvf_default_mac_addr_set(dev, &addr);
 }
 
-static void
+static int
 igbvf_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	/* Set both unicast and multicast promisc */
 	e1000_promisc_set_vf(hw, e1000_promisc_enabled);
+
+	return 0;
 }
 
-static void
+static int
 igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -3409,6 +3415,8 @@ igbvf_promiscuous_disable(struct rte_eth_dev *dev)
 		e1000_promisc_set_vf(hw, e1000_promisc_multicast);
 	else
 		e1000_promisc_set_vf(hw, e1000_promisc_disabled);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dec42b976..1ec66d0ba 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -523,7 +523,7 @@ enetc_dev_close(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 enetc_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -537,9 +537,11 @@ enetc_promiscuous_enable(struct rte_eth_dev *dev)
 	psipmr |= ENETC_PSIPMR_SET_UP(0) | ENETC_PSIPMR_SET_MP(0);
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
-static void
+static int
 enetc_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct enetc_eth_hw *hw =
@@ -555,6 +557,8 @@ enetc_promiscuous_disable(struct rte_eth_dev *dev)
 		psipmr &= (~ENETC_PSIPMR_SET_MP(0));
 
 	enetc_port_wr(enetc_hw, ENETC_PSIPMR, psipmr);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index 5a92508f0..72b1e7956 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
 int enic_dev_stats_get(struct enic *enic,
 		       struct rte_eth_stats *r_stats);
 void enic_dev_stats_clear(struct enic *enic);
-void enic_add_packet_filter(struct enic *enic);
+int enic_add_packet_filter(struct enic *enic);
 int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
 int enic_del_mac_address(struct enic *enic, int mac_index);
 unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 90fdeda90..6572815f5 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -603,29 +603,39 @@ static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 	return NULL;
 }
 
-static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -E_RTE_SECONDARY;
 
 	ENICPMD_FUNC_TRACE();
 
 	enic->promisc = 1;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 0;
+
+	return ret;
 }
 
-static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct enic *enic = pmd_priv(eth_dev);
+	int ret;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return;
+		return -E_RTE_SECONDARY;
 
 	ENICPMD_FUNC_TRACE();
 	enic->promisc = 0;
-	enic_add_packet_filter(enic);
+	ret = enic_add_packet_filter(enic);
+	if (ret != 0)
+		enic->promisc = 1;
+
+	return ret;
 }
 
 static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 40af3781b..f4e76a057 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
 			       enic->rss_enable);
 }
 
-void enic_add_packet_filter(struct enic *enic)
+int enic_add_packet_filter(struct enic *enic)
 {
 	/* Args -> directed, multicast, broadcast, promisc, allmulti */
-	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
+	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
 		enic->promisc, enic->allmulti);
 }
 
diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c
index af2c216f3..ade5d1d75 100644
--- a/drivers/net/failsafe/failsafe_ops.c
+++ b/drivers/net/failsafe/failsafe_ops.c
@@ -654,7 +654,7 @@ fs_dev_free_queues(struct rte_eth_dev *dev)
 	dev->data->nb_tx_queues = 0;
 }
 
-static void
+static int
 fs_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -682,9 +682,11 @@ fs_promiscuous_enable(struct rte_eth_dev *dev)
 		}
 	}
 	fs_unlock(dev, 0);
+
+	return ret;
 }
 
-static void
+static int
 fs_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct sub_device *sdev;
@@ -712,6 +714,8 @@ fs_promiscuous_disable(struct rte_eth_dev *dev)
 		}
 	}
 	fs_unlock(dev, 0);
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8cb7337ea..f0f629008 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -44,8 +44,8 @@ int fm10k_logtype_init;
 int fm10k_logtype_driver;
 
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
-static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void fm10k_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static inline int fm10k_glort_valid(struct fm10k_hw *hw);
@@ -908,7 +908,7 @@ static inline int fm10k_glort_valid(struct fm10k_hw *hw)
 		!= FM10K_DGLORTMAP_NONE);
 }
 
-static void
+static int
 fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -918,18 +918,22 @@ fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	fm10k_mbx_lock(hw);
 	status = hw->mac.ops.update_xcast_mode(hw, hw->mac.dglort_map,
 				FM10K_XCAST_MODE_PROMISC);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -940,7 +944,7 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* Return if it didn't acquire valid glort range */
 	if ((hw->mac.type == fm10k_mac_pf) && !fm10k_glort_valid(hw))
-		return;
+		return 0;
 
 	if (dev->data->all_multicast == 1)
 		mode = FM10K_XCAST_MODE_ALLMULTI;
@@ -952,8 +956,12 @@ fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev)
 				mode);
 	fm10k_mbx_unlock(hw);
 
-	if (status != FM10K_SUCCESS)
+	if (status != FM10K_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 17a3625d6..c50cdd9f8 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1325,8 +1325,12 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1338,6 +1342,8 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, true);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Enable promiscuous failed");
+
+	return rc;
 }
 
 /**
@@ -1345,8 +1351,12 @@ static void hinic_dev_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success,
+ *   negative error value otherwise.
  */
-static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
+static int hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	int rc = HINIC_OK;
 	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
@@ -1358,6 +1368,8 @@ static void hinic_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	rc = hinic_set_dev_promiscuous(nic_dev, false);
 	if (rc)
 		PMD_DRV_LOG(ERR, "Disable promiscuous failed");
+
+	return rc;
 }
 
 /**
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 390cb2196..79bd3a70c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -223,8 +223,8 @@ static int i40e_dev_start(struct rte_eth_dev *dev);
 static void i40e_dev_stop(struct rte_eth_dev *dev);
 static void i40e_dev_close(struct rte_eth_dev *dev);
 static int  i40e_dev_reset(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40e_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40e_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40e_dev_set_link_up(struct rte_eth_dev *dev);
@@ -2564,7 +2564,7 @@ i40e_dev_reset(struct rte_eth_dev *dev)
 	return ret;
 }
 
-static void
+static int
 i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2574,17 +2574,25 @@ i40e_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     true, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							TRUE, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to enable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    false, NULL, true);
+		return -EAGAIN;
+	}
 
+	return 0;
 }
 
-static void
+static int
 i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2594,17 +2602,26 @@ i40e_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	status = i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
 						     false, NULL, true);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable unicast promiscuous");
+		return -EAGAIN;
+	}
 
 	/* must remain in all_multicast mode */
 	if (dev->data->all_multicast == 1)
-		return;
+		return 0;
 
 	status = i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid,
 							false, NULL);
-	if (status != I40E_SUCCESS)
+	if (status != I40E_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to disable multicast promiscuous");
+		/* Rollback unicast promiscuous mode */
+		i40e_aq_set_vsi_unicast_promiscuous(hw, vsi->seid,
+						    true, NULL, true);
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 95b774284..22e5e1409 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -92,8 +92,8 @@ static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
 static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 static void i40evf_dev_close(struct rte_eth_dev *dev);
 static int  i40evf_dev_reset(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int i40evf_init_vlan(struct rte_eth_dev *dev);
@@ -2156,7 +2156,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	return rte_eth_linkstatus_set(dev, &new_link);
 }
 
-static void
+static int
 i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2164,14 +2164,18 @@ i40evf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	/* If enabled, just return */
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 1, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
@@ -2179,11 +2183,15 @@ i40evf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* If disabled, just return */
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = i40evf_config_promisc(dev, 0, vf->promisc_multicast_enabled);
 	if (ret == 0)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c
index 652f0accc..7f69e27a2 100644
--- a/drivers/net/i40e/i40e_vf_representor.c
+++ b/drivers/net/i40e/i40e_vf_representor.c
@@ -274,22 +274,22 @@ i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
 		representor->vf_id, &representor->stats_offset);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 1);
 }
 
-static void
+static int
 i40e_vf_representor_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct i40e_vf_representor *representor = ethdev->data->dev_private;
 
-	rte_pmd_i40e_set_vf_unicast_promisc(
+	return rte_pmd_i40e_set_vf_unicast_promisc(
 		representor->adapter->eth_dev->data->port_id,
 		representor->vf_id, 0);
 }
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 99b1f43b8..22a88c88d 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -43,8 +43,8 @@ static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int iavf_dev_stats_get(struct rte_eth_dev *dev,
 			     struct rte_eth_stats *stats);
 static void iavf_dev_stats_reset(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev,
@@ -634,7 +634,7 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -643,14 +643,18 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, TRUE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = TRUE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
-static void
+static int
 iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
@@ -659,11 +663,15 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	int ret;
 
 	if (!vf->promisc_unicast_enabled)
-		return;
+		return 0;
 
 	ret = iavf_config_promisc(adapter, FALSE, vf->promisc_multicast_enabled);
 	if (!ret)
 		vf->promisc_unicast_enabled = FALSE;
+	else
+		ret = -EAGAIN;
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9d0e339a5..eecf9c86c 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -58,8 +58,8 @@ static int ice_rss_hash_update(struct rte_eth_dev *dev,
 			       struct rte_eth_rss_conf *rss_conf);
 static int ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 				 struct rte_eth_rss_conf *rss_conf);
-static void ice_promisc_enable(struct rte_eth_dev *dev);
-static void ice_promisc_disable(struct rte_eth_dev *dev);
+static int ice_promisc_enable(struct rte_eth_dev *dev);
+static int ice_promisc_disable(struct rte_eth_dev *dev);
 static void ice_allmulti_enable(struct rte_eth_dev *dev);
 static void ice_allmulti_disable(struct rte_eth_dev *dev);
 static int ice_vlan_filter_set(struct rte_eth_dev *dev,
@@ -2973,7 +2973,7 @@ ice_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 ice_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -2981,18 +2981,26 @@ ice_promisc_enable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_set_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status == ICE_ERR_ALREADY_EXISTS)
+	switch (status) {
+	case ICE_ERR_ALREADY_EXISTS:
 		PMD_DRV_LOG(DEBUG, "Promisc mode has already been enabled");
-	else if (status != ICE_SUCCESS)
+	case ICE_SUCCESS:
+		break;
+	default:
 		PMD_DRV_LOG(ERR, "Failed to enable promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
-static void
+static int
 ice_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@@ -3000,13 +3008,18 @@ ice_promisc_disable(struct rte_eth_dev *dev)
 	struct ice_vsi *vsi = pf->main_vsi;
 	enum ice_status status;
 	uint8_t pmask;
+	int ret = 0;
 
 	pmask = ICE_PROMISC_UCAST_RX | ICE_PROMISC_UCAST_TX |
 		ICE_PROMISC_MCAST_RX | ICE_PROMISC_MCAST_TX;
 
 	status = ice_clear_vsi_promisc(hw, vsi->idx, pmask, 0);
-	if (status != ICE_SUCCESS)
+	if (status != ICE_SUCCESS) {
 		PMD_DRV_LOG(ERR, "Failed to clear promisc, err=%d", status);
+		ret = -EAGAIN;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h
index c7b336bbd..830e71797 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h
@@ -539,9 +539,9 @@ ipn3ke_rpst_dev_set_link_down(struct rte_eth_dev *dev);
 int
 ipn3ke_rpst_link_update(struct rte_eth_dev *ethdev,
 	__rte_unused int wait_to_complete);
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev);
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev);
 void
 ipn3ke_rpst_allmulticast_enable(struct rte_eth_dev *ethdev);
diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index 476d5e52b..9079073c9 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2618,7 +2618,7 @@ ipn3ke_rpst_scan_check(void)
 	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2641,9 +2641,11 @@ ipn3ke_rpst_promiscuous_enable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
-void
+int
 ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 {
 	struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev);
@@ -2666,6 +2668,8 @@ ipn3ke_rpst_promiscuous_disable(struct rte_eth_dev *ethdev)
 				rpst->port_id,
 				0);
 	}
+
+	return 0;
 }
 
 void
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 0108db890..023b267d7 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -149,8 +149,8 @@ static int  ixgbe_dev_set_link_up(struct rte_eth_dev *dev);
 static int  ixgbe_dev_set_link_down(struct rte_eth_dev *dev);
 static void ixgbe_dev_close(struct rte_eth_dev *dev);
 static int  ixgbe_dev_reset(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbe_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int ixgbe_dev_link_update(struct rte_eth_dev *dev,
@@ -270,8 +270,8 @@ static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 static void ixgbevf_set_ivar_map(struct ixgbe_hw *hw, int8_t direction,
 				 uint8_t queue, uint8_t msix_vector);
 static void ixgbevf_configure_msix(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 
@@ -4181,7 +4181,7 @@ ixgbevf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	return ixgbe_dev_link_update_share(dev, wait_to_complete, 1);
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4190,9 +4190,11 @@ ixgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL);
 	fctrl |= (IXGBE_FCTRL_UPE | IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
-static void
+static int
 ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -4205,6 +4207,8 @@ ixgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	else
 		fctrl &= (~IXGBE_FCTRL_MPE);
 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl);
+
+	return 0;
 }
 
 static void
@@ -8402,20 +8406,46 @@ ixgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
 	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
+
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_PROMISC);
+	return ret;
 }
 
-static void
+static int
 ixgbevf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	int ret;
 
-	hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE);
+	switch (hw->mac.ops.update_xcast_mode(hw, IXGBEVF_XCAST_MODE_NONE)) {
+	case IXGBE_SUCCESS:
+		ret = 0;
+		break;
+	case IXGBE_ERR_FEATURE_NOT_SUPPORTED:
+		ret = -ENOTSUP;
+		break;
+	default:
+		ret = -EAGAIN;
+		break;
+	}
+
+	return ret;
 }
 
 static void
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index d97e357e3..e1eaf9eb8 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -961,8 +961,12 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev,
 /**
  * \brief Net device enable, disable allmulticast
  * @param eth_dev Pointer to the structure rte_eth_dev
+ *
+ * @return
+ *  On success return 0
+ *  On failure return negative errno
  */
-static void
+static int
 lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -987,14 +991,18 @@ lio_change_dev_flag(struct rte_eth_dev *eth_dev)
 
 	if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
 		lio_dev_err(lio_dev, "Failed to send change flag message\n");
-		return;
+		return -EAGAIN;
 	}
 
-	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
+	if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
 		lio_dev_err(lio_dev, "Change dev flag command timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
 }
 
-static void
+static int
 lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1002,20 +1010,20 @@ lio_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't enable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags |= LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
-static void
+static int
 lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct lio_device *lio_dev = LIO_DEV(eth_dev);
@@ -1023,17 +1031,17 @@ lio_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 	if (strcmp(lio_dev->firmware_version, LIO_VF_TRUST_MIN_VERSION) < 0) {
 		lio_dev_err(lio_dev, "Require firmware version >= %s\n",
 			    LIO_VF_TRUST_MIN_VERSION);
-		return;
+		return -EAGAIN;
 	}
 
 	if (!lio_dev->intf_open) {
 		lio_dev_err(lio_dev, "Port %d down, can't disable promiscuous\n",
 			    lio_dev->port_id);
-		return;
+		return -EAGAIN;
 	}
 
 	lio_dev->ifflags &= ~LIO_IFFLAG_PROMISC;
-	lio_change_dev_flag(eth_dev);
+	return lio_change_dev_flag(eth_dev);
 }
 
 static void
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index 7730b530a..21517d70a 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -205,8 +205,8 @@ int mlx4_mtu_get(struct mlx4_priv *priv, uint16_t *mtu);
 int mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 int mlx4_dev_set_link_down(struct rte_eth_dev *dev);
 int mlx4_dev_set_link_up(struct rte_eth_dev *dev);
-void mlx4_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx4_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx4_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx4_allmulticast_disable(struct rte_eth_dev *dev);
 void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c
index 623ebd88c..b5706bb78 100644
--- a/drivers/net/mlx4/mlx4_ethdev.c
+++ b/drivers/net/mlx4/mlx4_ethdev.c
@@ -341,13 +341,17 @@ enum rxmode_toggle {
  *   Pointer to Ethernet device structure.
  * @param toggle
  *   Toggle to set.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-static void
+static int
 mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 {
 	struct mlx4_priv *priv = dev->data->dev_private;
 	const char *mode;
 	struct rte_flow_error error;
+	int ret;
 
 	switch (toggle) {
 	case RXMODE_TOGGLE_PROMISC_OFF:
@@ -363,12 +367,16 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
 	default:
 		mode = "undefined";
 	}
-	if (!mlx4_flow_sync(priv, &error))
-		return;
+
+	ret = mlx4_flow_sync(priv, &error);
+	if (!ret)
+		return 0;
+
 	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
 	      " flow error type %d, cause %p, message: %s",
 	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
 	      error.message ? error.message : "(unspecified)");
+	return ret;
 }
 
 /**
@@ -376,11 +384,14 @@ mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
+	return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_ON);
 }
 
 /**
@@ -388,11 +399,14 @@ mlx4_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx4_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
+	return mlx4_rxmode_toggle(dev, RXMODE_TOGGLE_PROMISC_OFF);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 5482eb7b4..0887e6de2 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -760,8 +760,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
 
 /* mlx5_rxmode.c */
 
-void mlx5_promiscuous_enable(struct rte_eth_dev *dev);
-void mlx5_promiscuous_disable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_enable(struct rte_eth_dev *dev);
+int mlx5_promiscuous_disable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_enable(struct rte_eth_dev *dev);
 void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
 
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index d5077db0d..56fc1b636 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -28,8 +28,11 @@
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
@@ -41,14 +44,23 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 			"port %u cannot enable promiscuous mode"
 			" in flow isolation mode",
 			dev->data->port_id);
-		return;
+		return 0;
+	}
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 1);
+		if (ret)
+			return ret;
 	}
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 1);
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+	/*
+	 * rte_eth_dev_promiscuous_enable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
@@ -56,20 +68,32 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	int ret;
 
 	dev->data->promiscuous = 0;
-	if (priv->config.vf)
-		mlx5_nl_promisc(dev, 0);
+	if (priv->config.vf) {
+		ret = mlx5_nl_promisc(dev, 0);
+		if (ret)
+			return ret;
+	}
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
 		DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
 			dev->data->port_id, strerror(rte_errno));
+
+	/*
+	 * rte_eth_dev_promiscuous_disable() rollback
+	 * dev->data->promiscuous in the case of failure.
+	 */
+	return ret;
 }
 
 /**
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 3ba0ac76e..1090af03b 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -534,25 +534,30 @@ mvneta_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (en) {
 		MVNETA_LOG(INFO, "Promiscuous already enabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 1);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to enable promiscuous mode");
+
+	return 0;
 }
 
 /**
@@ -560,25 +565,30 @@ mvneta_promiscuous_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   always 0
  */
-static void
+static int
 mvneta_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mvneta_priv *priv = dev->data->dev_private;
 	int ret, en;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	neta_ppio_get_promisc(priv->ppio, &en);
 	if (!en) {
 		MVNETA_LOG(INFO, "Promiscuous already disabled");
-		return;
+		return 0;
 	}
 
 	ret = neta_ppio_set_promisc(priv->ppio, 0);
 	if (ret)
 		MVNETA_LOG(ERR, "Failed to disable promiscuous mode");
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 345c24404..7babc891a 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -994,22 +994,29 @@ mrvl_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	if (priv->isolated)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 1);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to enable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
@@ -1040,19 +1047,26 @@ mrvl_allmulticast_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, negative error value otherwise.
  */
-static void
+static int
 mrvl_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct mrvl_priv *priv = dev->data->dev_private;
 	int ret;
 
 	if (!priv->ppio)
-		return;
+		return 0;
 
 	ret = pp2_ppio_set_promisc(priv->ppio, 0);
-	if (ret)
+	if (ret) {
 		MRVL_LOG(ERR, "Failed to disable promiscuous mode");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 /**
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 7353211c1..d04a6c8ac 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -416,16 +416,16 @@ static int hn_rss_hash_conf_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
-static void
+static int
 hn_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
 
 	hn_rndis_set_rxfilter(hv, NDIS_PACKET_TYPE_PROMISCUOUS);
-	hn_vf_promiscuous_enable(dev);
+	return hn_vf_promiscuous_enable(dev);
 }
 
-static void
+static int
 hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
@@ -435,7 +435,7 @@ hn_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	if (dev->data->all_multicast)
 		filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
 	hn_rndis_set_rxfilter(hv, filter);
-	hn_vf_promiscuous_disable(dev);
+	return hn_vf_promiscuous_disable(dev);
 }
 
 static void
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index e0ebe4e1c..01f227648 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -214,8 +214,8 @@ void	hn_vf_close(struct rte_eth_dev *dev);
 
 void	hn_vf_allmulticast_enable(struct rte_eth_dev *dev);
 void	hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
-void	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
+int	hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
 int	hn_vf_mc_addr_list(struct rte_eth_dev *dev,
 			   struct rte_ether_addr *mc_addr_set,
 			   uint32_t nb_mc_addr);
diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c
index d53d27bb7..d133438bb 100644
--- a/drivers/net/netvsc/hn_vf.c
+++ b/drivers/net/netvsc/hn_vf.c
@@ -362,6 +362,20 @@ void hn_vf_stop(struct rte_eth_dev *dev)
 		rte_spinlock_unlock(&hv->vf_lock);		\
 	}
 
+/* If VF is present, then cascade configuration down */
+#define VF_ETHDEV_FUNC_RET_STATUS(dev, func)			\
+	{							\
+		struct hn_data *hv = (dev)->data->dev_private;	\
+		struct rte_eth_dev *vf_dev;			\
+		int ret = 0;					\
+		rte_spinlock_lock(&hv->vf_lock);		\
+		vf_dev = hn_get_vf_dev(hv);			\
+		if (vf_dev)					\
+			ret = func(vf_dev->data->port_id);	\
+		rte_spinlock_unlock(&hv->vf_lock);		\
+		return ret;					\
+	}
+
 void hn_vf_reset(struct rte_eth_dev *dev)
 {
 	VF_ETHDEV_FUNC(dev, rte_eth_dev_reset);
@@ -396,14 +410,14 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
 	VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable);
 }
 
-void hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_enable);
 }
 
-void hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable);
+	VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_disable);
 }
 
 int hn_vf_mc_addr_list(struct rte_eth_dev *dev,
diff --git a/drivers/net/nfb/nfb_rxmode.c b/drivers/net/nfb/nfb_rxmode.c
index 97bfcb238..17708c84c 100644
--- a/drivers/net/nfb/nfb_rxmode.c
+++ b/drivers/net/nfb/nfb_rxmode.c
@@ -7,7 +7,7 @@
 #include "nfb_rxmode.h"
 #include "nfb.h"
 
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -20,9 +20,11 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev)
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_PROMISCUOUS);
 	}
+
+	return 0;
 }
 
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *internals = (struct pmd_internals *)
@@ -33,12 +35,14 @@ nfb_eth_promiscuous_disable(struct rte_eth_dev *dev)
 
 	/* if promisc is not enabled, do nothing */
 	if (!nfb_eth_promiscuous_get(dev))
-		return;
+		return 0;
 
 	for (i = 0; i < internals->max_rxmac; ++i) {
 		nc_rxmac_mac_filter_enable(internals->rxmac[i],
 			RXMAC_MAC_FILTER_TABLE);
 	}
+
+	return 0;
 }
 
 int
diff --git a/drivers/net/nfb/nfb_rxmode.h b/drivers/net/nfb/nfb_rxmode.h
index 4c59651d6..1d5bafa98 100644
--- a/drivers/net/nfb/nfb_rxmode.h
+++ b/drivers/net/nfb/nfb_rxmode.h
@@ -26,8 +26,10 @@ nfb_eth_promiscuous_get(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
 
 /**
@@ -35,8 +37,10 @@ nfb_eth_promiscuous_enable(struct rte_eth_dev *dev);
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return always 0
  */
-void
+int
 nfb_eth_promiscuous_disable(struct rte_eth_dev *dev);
 
 /**
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 3d5b99c94..a9858036a 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -85,8 +85,8 @@ static int nfp_net_infos_get(struct rte_eth_dev *dev,
 			     struct rte_eth_dev_info *dev_info);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
 static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static void nfp_net_promisc_enable(struct rte_eth_dev *dev);
-static void nfp_net_promisc_disable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_enable(struct rte_eth_dev *dev);
+static int nfp_net_promisc_disable(struct rte_eth_dev *dev);
 static int nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq);
 static uint32_t nfp_net_rx_queue_count(struct rte_eth_dev *dev,
 				       uint16_t queue_idx);
@@ -931,11 +931,12 @@ nfp_net_close(struct rte_eth_dev *dev)
 	 */
 }
 
-static void
+static int
 nfp_net_promisc_enable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	PMD_DRV_LOG(DEBUG, "Promiscuous mode enable");
 
@@ -943,12 +944,12 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 
 	if (!(hw->cap & NFP_NET_CFG_CTRL_PROMISC)) {
 		PMD_INIT_LOG(INFO, "Promiscuous mode not supported");
-		return;
+		return -ENOTSUP;
 	}
 
 	if (hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already enabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl | NFP_NET_CFG_CTRL_PROMISC;
@@ -958,23 +959,27 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode on just after this call assuming
 	 * it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
-static void
+static int
 nfp_net_promisc_disable(struct rte_eth_dev *dev)
 {
 	uint32_t new_ctrl, update = 0;
 	struct nfp_net_hw *hw;
+	int ret;
 
 	hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_PROMISC) == 0) {
 		PMD_DRV_LOG(INFO, "Promiscuous mode already disabled");
-		return;
+		return 0;
 	}
 
 	new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_PROMISC;
@@ -984,10 +989,13 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev)
 	 * DPDK sets promiscuous mode off just before this call
 	 * assuming it can not fail ...
 	 */
-	if (nfp_net_reconfig(hw, new_ctrl, update) < 0)
-		return;
+	ret = nfp_net_reconfig(hw, new_ctrl, update);
+	if (ret < 0)
+		return ret;
 
 	hw->ctrl = new_ctrl;
+
+	return 0;
 }
 
 /*
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 1faa7b7c6..47cea4e9b 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -174,7 +174,7 @@ octeontx_port_stop(struct octeontx_nic *nic)
 	return octeontx_bgx_port_stop(nic->port_id);
 }
 
-static void
+static int
 octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 {
 	struct rte_eth_dev *dev;
@@ -185,15 +185,19 @@ octeontx_port_promisc_set(struct octeontx_nic *nic, int en)
 	dev = nic->dev;
 
 	res = octeontx_bgx_port_promisc_set(nic->port_id, en);
-	if (res < 0)
+	if (res < 0) {
 		octeontx_log_err("failed to set promiscuous mode %d",
 				nic->port_id);
+		return res;
+	}
 
 	/* Set proper flag for the mode */
 	dev->data->promiscuous = (en != 0) ? 1 : 0;
 
 	octeontx_log_dbg("port %d : promiscuous mode %s",
 			nic->port_id, en ? "set" : "unset");
+
+	return 0;
 }
 
 static int
@@ -444,22 +448,22 @@ octeontx_dev_stop(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 octeontx_dev_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 1);
+	return octeontx_port_promisc_set(nic, 1);
 }
 
-static void
+static int
 octeontx_dev_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
 
 	PMD_INIT_FUNC_TRACE();
-	octeontx_port_promisc_set(nic, 0);
+	return octeontx_port_promisc_set(nic, 0);
 }
 
 static int
diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h
index 5de0a1d4d..8814622e4 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -379,8 +379,8 @@ int otx2_nix_rx_descriptor_done(void *rxq, uint16_t offset);
 int otx2_nix_rx_descriptor_status(void *rx_queue, uint16_t offset);
 
 void otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en);
-void otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
-void otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+int otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 void otx2_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int otx2_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qidx);
diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c
index 024c295aa..5a97a090a 100644
--- a/drivers/net/octeontx2/otx2_ethdev_ops.c
+++ b/drivers/net/octeontx2/otx2_ethdev_ops.c
@@ -129,18 +129,22 @@ otx2_nix_promisc_config(struct rte_eth_dev *eth_dev, int en)
 	otx2_nix_vlan_update_promisc(eth_dev, en);
 }
 
-void
+int
 otx2_nix_promisc_enable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 1);
 	nix_cgx_promisc_config(eth_dev, 1);
+
+	return 0;
 }
 
-void
+int
 otx2_nix_promisc_disable(struct rte_eth_dev *eth_dev)
 {
 	otx2_nix_promisc_config(eth_dev, 0);
 	nix_cgx_promisc_config(eth_dev, 0);
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index d2e3d36d6..4f324a6d5 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1380,33 +1380,39 @@ qede_link_update(struct rte_eth_dev *eth_dev, __rte_unused int wait_to_complete)
 	return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
-static void qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
 	enum qed_filter_rx_mode_type type = QED_FILTER_RX_MODE_TYPE_PROMISC;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
 		type |= QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
 
-	qed_configure_filter_rx_mode(eth_dev, type);
+	ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
-static void qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
+static int qede_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
 	struct qede_dev *qdev = eth_dev->data->dev_private;
 	struct ecore_dev *edev = &qdev->edev;
+	enum _ecore_status_t ecore_status;
 
 	PMD_INIT_FUNC_TRACE(edev);
 
 	if (rte_eth_allmulticast_get(eth_dev->data->port_id) == 1)
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC);
 	else
-		qed_configure_filter_rx_mode(eth_dev,
+		ecore_status = qed_configure_filter_rx_mode(eth_dev,
 				QED_FILTER_RX_MODE_TYPE_REGULAR);
+
+	return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
 }
 
 static void qede_poll_sp_sb_cb(void *param)
diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 013b6bbd6..5faf14b67 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -366,7 +366,7 @@ sfc_dev_close(struct rte_eth_dev *dev)
 	free(sa);
 }
 
-static void
+static int
 sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 		   boolean_t enabled)
 {
@@ -375,6 +375,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
 	boolean_t allmulti = (mode == SFC_DEV_FILTER_MODE_ALLMULTI);
 	const char *desc = (allmulti) ? "all-multi" : "promiscuous";
+	int rc = 0;
 
 	sfc_adapter_lock(sa);
 
@@ -390,7 +391,7 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 				     "start provided that isolated mode is "
 				     "disabled prior the next start");
 		} else if ((sa->state == SFC_ADAPTER_STARTED) &&
-			   (sfc_set_rx_mode(sa) != 0)) {
+			   ((rc = sfc_set_rx_mode(sa)) != 0)) {
 			*toggle = !(enabled);
 			sfc_warn(sa, "Failed to %s %s mode",
 				 ((enabled) ? "enable" : "disable"), desc);
@@ -398,18 +399,19 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
 	}
 
 	sfc_adapter_unlock(sa);
+	return rc;
 }
 
-static void
+static int
 sfc_dev_promisc_enable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_TRUE);
 }
 
-static void
+static int
 sfc_dev_promisc_disable(struct rte_eth_dev *dev)
 {
-	sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
+	return sfc_dev_filter_set(dev, SFC_DEV_FILTER_MODE_PROMISC, B_FALSE);
 }
 
 static void
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index ca066a3d3..2f3811b67 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1344,18 +1344,20 @@ eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused,
 	return 0;
 }
 
-static void
+static int
 eth_promiscuous_enable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Enabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return 0;
 }
 
-static void
+static int
 eth_promiscuous_disable(struct rte_eth_dev *dev __rte_unused)
 {
 	PMD_DRV_LOG(WARNING, "Disabling promiscuous mode is not supported. "
 			"The card is always in promiscuous mode.");
+	return -ENOTSUP;
 }
 
 static void
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index f85458c3c..41612ce83 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
 	return 0;
 }
 
-static void
+static int
 tap_promisc_enable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 1;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 1;
+		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_enable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
-static void
+static int
 tap_promisc_disable(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
+	int ret;
 
-	dev->data->promiscuous = 0;
-	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
-	if (pmd->remote_if_index && !pmd->flow_isolate)
-		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
+	if (ret != 0)
+		return ret;
+
+	if (pmd->remote_if_index && !pmd->flow_isolate) {
+		dev->data->promiscuous = 0;
+		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
+		if (ret != 0) {
+			/* Rollback promisc flag */
+			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
+			/*
+			 * rte_eth_dev_promiscuous_disable() rollback
+			 * dev->data->promiscuous in the case of failure.
+			 */
+			return ret;
+		}
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index f3ba07ae3..edc956bb3 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -401,9 +401,10 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
 }
 
 /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */
-static void
+static int
 nicvf_dev_promisc_enable(struct rte_eth_dev *dev __rte_unused)
 {
+	return 0;
 }
 
 static inline uint64_t
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 8fe9dcebd..1ba4aa37e 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -41,8 +41,8 @@ static int eth_virtio_dev_uninit(struct rte_eth_dev *eth_dev);
 static int  virtio_dev_configure(struct rte_eth_dev *dev);
 static int  virtio_dev_start(struct rte_eth_dev *dev);
 static void virtio_dev_stop(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int virtio_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int virtio_dev_info_get(struct rte_eth_dev *dev,
@@ -746,7 +746,7 @@ virtio_dev_close(struct rte_eth_dev *dev)
 	}
 }
 
-static void
+static int
 virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -756,7 +756,7 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -765,11 +765,15 @@ virtio_dev_promiscuous_enable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to enable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
-static void
+static int
 virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct virtio_hw *hw = dev->data->dev_private;
@@ -779,7 +783,7 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 
 	if (!vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_RX)) {
 		PMD_INIT_LOG(INFO, "host does not support rx control");
-		return;
+		return -ENOTSUP;
 	}
 
 	ctrl.hdr.class = VIRTIO_NET_CTRL_RX;
@@ -788,8 +792,12 @@ virtio_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	dlen[0] = 1;
 
 	ret = virtio_send_command(hw->cvq, &ctrl, dlen, 1);
-	if (ret)
+	if (ret) {
 		PMD_INIT_LOG(ERR, "Failed to disable promisc");
+		return -EAGAIN;
+	}
+
+	return 0;
 }
 
 static void
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index 3ed34f825..bfe978c4a 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -65,8 +65,8 @@ static int vmxnet3_dev_start(struct rte_eth_dev *dev);
 static void vmxnet3_dev_stop(struct rte_eth_dev *dev);
 static void vmxnet3_dev_close(struct rte_eth_dev *dev);
 static void vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set);
-static void vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_enable(struct rte_eth_dev *dev);
 static void vmxnet3_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int __vmxnet3_dev_link_update(struct rte_eth_dev *dev,
@@ -1262,7 +1262,7 @@ vmxnet3_dev_set_rxmode(struct vmxnet3_hw *hw, uint32_t feature, int set)
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1273,10 +1273,12 @@ vmxnet3_dev_promiscuous_enable(struct rte_eth_dev *dev)
 
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Promiscuous supported only if Vmxnet3_DriverShared is initialized in adapter */
-static void
+static int
 vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
@@ -1290,6 +1292,8 @@ vmxnet3_dev_promiscuous_disable(struct rte_eth_dev *dev)
 	vmxnet3_dev_set_rxmode(hw, VMXNET3_RXM_PROMISC, 0);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
+
+	return 0;
 }
 
 /* Allmulticast supported only if Vmxnet3_DriverShared is initialized in adapter */
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index b97dd8aa8..f2e6b4c83 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1892,30 +1892,38 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int diag;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	(*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = 1;
+	old_promiscuous = dev->data->promiscuous;
+	diag = (*dev->dev_ops->promiscuous_enable)(dev);
+	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
 
-	return 0;
+	return eth_err(port_id, diag);
 }
 
 int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
+	uint8_t old_promiscuous;
+	int diag;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
+	old_promiscuous = dev->data->promiscuous;
 	dev->data->promiscuous = 0;
-	(*dev->dev_ops->promiscuous_disable)(dev);
+	diag = (*dev->dev_ops->promiscuous_disable)(dev);
+	if (diag != 0)
+		dev->data->promiscuous = old_promiscuous;
 
-	return 0;
+	return eth_err(port_id, diag);
 }
 
 int
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 2394b32c8..eacd56554 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -52,11 +52,55 @@ typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev);
 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev);
 /**< @internal Function used to detect an Ethernet device removal. */
 
-typedef void (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to enable the RX promiscuous mode of an Ethernet device. */
+/**
+ * @internal
+ * Function used to enable the Rx promiscuous mode of an Ethernet device.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, promiscuous mode is enabled.
+ * @retval -ENOTSUP
+ *   Promiscuous mode is not supported.
+ * @retval -ENODEV
+ *   Device is gone.
+ * @retval -E_RTE_SECONDARY
+ *   Function was called from a secondary process instance and not supported.
+ * @retval -ETIMEDOUT
+ *   Attempt to enable promiscuos mode failed because of timeout.
+ * @retval -EAGAIN
+ *   Failed to enable promiscuous mode.
+ */
+typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev);
 
-typedef void (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
-/**< @internal Function used to disable the RX promiscuous mode of an Ethernet device. */
+/**
+ * @internal
+ * Function used to disable the R promiscuous mode of an Ethernet device.
+ *
+ * @param dev
+ *   ethdev handle of port.
+ *
+ * @return
+ *   Negative errno value on error, 0 on success.
+ *
+ * @retval 0
+ *   Success, promiscuous mode is disabled.
+ * @retval -ENOTSUP
+ *   Promiscuous mode disabling is not supported.
+ * @retval -ENODEV
+ *   Device is gone.
+ * @retval -E_RTE_SECONDARY
+ *   Function was called from a secondary process instance and not supported.
+ * @retval -ETIMEDOUT
+ *   Attempt to disable promiscuos mode failed because of timeout.
+ * @retval -EAGAIN
+ *   Failed to disable promiscuous mode.
+ */
+typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev);
 
 typedef void (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev);
 /**< @internal Enable the receipt of all multicast packets by an Ethernet device. */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 05/13] ethdev: do nothing if promiscuous mode is applied again
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (3 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
                     ` (8 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit; +Cc: dev

Since driver callbacks return status code now, there is no necessity
to enable or disable promiscuous mode once again if it is already
successfully enabled or disabled.

Configuration restore at startup tries to ensure that configured
promiscuous mode is applied and start will return error if it fails.

Also it avoids theoretical cases when already configured promiscuous
mode is applied once again and fails. In this cases it is unclear
which value should be reported on get (configured or opposite).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 40 ++++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index f2e6b4c83..98fe533c5 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1391,16 +1391,22 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev,
 		rte_eth_dev_mac_restore(dev, dev_info);
 
 	/* replay promiscuous configuration */
-	if (rte_eth_promiscuous_get(port_id) == 1) {
-		ret = rte_eth_promiscuous_enable(port_id);
+	/*
+	 * use callbacks directly since we don't need port_id check and
+	 * would like to bypass the same value set
+	 */
+	if (rte_eth_promiscuous_get(port_id) == 1 &&
+	    *dev->dev_ops->promiscuous_enable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_enable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to enable promiscuous mode for device (port %u): %s\n",
 				port_id, rte_strerror(-ret));
 			return ret;
 		}
-	} else if (rte_eth_promiscuous_get(port_id) == 0) {
-		ret = rte_eth_promiscuous_disable(port_id);
+	} else if (rte_eth_promiscuous_get(port_id) == 0 &&
+		   *dev->dev_ops->promiscuous_disable != NULL) {
+		ret = (*dev->dev_ops->promiscuous_disable)(dev);
 		if (ret != 0 && ret != -ENOTSUP) {
 			RTE_ETHDEV_LOG(ERR,
 				"Failed to disable promiscuous mode for device (port %u): %s\n",
@@ -1892,16 +1898,17 @@ int
 rte_eth_promiscuous_enable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int diag;
+	int diag = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_enable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	diag = (*dev->dev_ops->promiscuous_enable)(dev);
-	dev->data->promiscuous = (diag == 0) ? 1 : old_promiscuous;
+
+	if (dev->data->promiscuous == 0) {
+		diag = (*dev->dev_ops->promiscuous_enable)(dev);
+		dev->data->promiscuous = (diag == 0) ? 1 : 0;
+	}
 
 	return eth_err(port_id, diag);
 }
@@ -1910,18 +1917,19 @@ int
 rte_eth_promiscuous_disable(uint16_t port_id)
 {
 	struct rte_eth_dev *dev;
-	uint8_t old_promiscuous;
-	int diag;
+	int diag = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->promiscuous_disable, -ENOTSUP);
-	old_promiscuous = dev->data->promiscuous;
-	dev->data->promiscuous = 0;
-	diag = (*dev->dev_ops->promiscuous_disable)(dev);
-	if (diag != 0)
-		dev->data->promiscuous = old_promiscuous;
+
+	if (dev->data->promiscuous == 1) {
+		dev->data->promiscuous = 0;
+		diag = (*dev->dev_ops->promiscuous_disable)(dev);
+		if (diag != 0)
+			dev->data->promiscuous = 1;
+	}
 
 	return eth_err(port_id, diag);
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 06/13] app/pipeline: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (4 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 07/13] app/testpmd: " Andrew Rybchenko
                     ` (7 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Cristian Dumitrescu; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pipeline
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pipeline/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c
index b75688a87..871d9fa2d 100644
--- a/app/test-pipeline/init.c
+++ b/app/test-pipeline/init.c
@@ -200,7 +200,10 @@ app_init_ports(void)
 		if (ret < 0)
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 
-		rte_eth_promiscuous_enable(port);
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode for port %u: %s\n",
+				port, rte_strerror(-ret));
 
 		/* Init RX queues */
 		ret = rte_eth_rx_queue_setup(
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 07/13] app/testpmd: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (5 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-16 13:18     ` Iremonger, Bernard
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 08/13] app/eventdev: " Andrew Rybchenko
                     ` (6 subsequent siblings)
  13 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/testpmd
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-pmd/cmdline.c | 23 ++++++++++-------------
 app/test-pmd/testpmd.c | 14 +++++++++++---
 app/test-pmd/testpmd.h |  1 +
 app/test-pmd/util.c    | 16 ++++++++++++++++
 4 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b1be6b4c8..6b9444f42 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -6082,6 +6082,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 	struct cmd_create_bonded_device_result *res = parsed_result;
 	char ethdev_name[RTE_ETH_NAME_MAX_LEN];
 	int port_id;
+	int ret;
 
 	if (test_done == 0) {
 		printf("Please stop forwarding first\n");
@@ -6103,7 +6104,11 @@ static void cmd_create_bonded_device_parsed(void *parsed_result,
 		/* Update number of ports */
 		nb_ports = rte_eth_dev_count_avail();
 		reconfig(port_id, res->socket);
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Failed to enable promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+
 		ports[port_id].need_setup = 0;
 		ports[port_id].port_status = RTE_PORT_STOPPED;
 	}
@@ -6525,18 +6530,10 @@ static void cmd_set_promisc_mode_parsed(void *parsed_result,
 
 	/* all ports */
 	if (allports) {
-		RTE_ETH_FOREACH_DEV(i) {
-			if (enable)
-				rte_eth_promiscuous_enable(i);
-			else
-				rte_eth_promiscuous_disable(i);
-		}
-	}
-	else {
-		if (enable)
-			rte_eth_promiscuous_enable(res->port_num);
-		else
-			rte_eth_promiscuous_disable(res->port_num);
+		RTE_ETH_FOREACH_DEV(i)
+			eth_set_promisc_mode(i, enable);
+	} else {
+		eth_set_promisc_mode(res->port_num, enable);
 	}
 }
 
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index de91e1b72..2a57978fd 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2433,13 +2433,17 @@ static void
 setup_attached_port(portid_t pi)
 {
 	unsigned int socket_id;
+	int ret;
 
 	socket_id = (unsigned)rte_eth_dev_socket_id(pi);
 	/* if socket_id is invalid, set to the first available socket. */
 	if (check_socket_id(socket_id) < 0)
 		socket_id = socket_ids[0];
 	reconfig(pi, socket_id);
-	rte_eth_promiscuous_enable(pi);
+	ret = rte_eth_promiscuous_enable(pi);
+	if (ret != 0)
+		printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+			pi, rte_strerror(-ret));
 
 	ports_ids[nb_ports++] = pi;
 	fwd_ports_ids[nb_fwd_ports++] = pi;
@@ -3373,8 +3377,12 @@ main(int argc, char** argv)
 		rte_exit(EXIT_FAILURE, "Start ports failed\n");
 
 	/* set all ports to promiscuous mode by default */
-	RTE_ETH_FOREACH_DEV(port_id)
-		rte_eth_promiscuous_enable(port_id);
+	RTE_ETH_FOREACH_DEV(port_id) {
+		ret = rte_eth_promiscuous_enable(port_id);
+		if (ret != 0)
+			printf("Error during enabling promiscuous mode for port %u: %s - ignore\n",
+				port_id, rte_strerror(-ret));
+	}
 
 	/* Init metrics library */
 	rte_metrics_init(rte_socket_id());
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index d73955da1..ab9306292 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -824,6 +824,7 @@ void show_gro(portid_t port_id);
 void setup_gso(const char *mode, portid_t port_id);
 int eth_dev_info_get_print_err(uint16_t port_id,
 			struct rte_eth_dev_info *dev_info);
+void eth_set_promisc_mode(uint16_t port_id, int enable);
 
 
 /* Functions to manage the set of filtered Multicast MAC addresses */
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 009d22676..462675134 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -245,3 +245,19 @@ eth_dev_info_get_print_err(uint16_t port_id,
 
 	return ret;
 }
+
+void
+eth_set_promisc_mode(uint16_t port, int enable)
+{
+	int ret;
+
+	if (enable)
+		ret = rte_eth_promiscuous_enable(port);
+	else
+		ret = rte_eth_promiscuous_disable(port);
+
+	if (ret != 0)
+		printf("Error during %s promiscuous mode for port %u: %s\n",
+			enable ? "enabling" : "disabling",
+			port, rte_strerror(-ret));
+}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 08/13] app/eventdev: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (6 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 07/13] app/testpmd: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 09/13] app/pdump: " Andrew Rybchenko
                     ` (5 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Jerin Jacob; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/eventdev
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test-eventdev/test_perf_common.c     | 7 ++++++-
 app/test-eventdev/test_pipeline_common.c | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index e75582b1a..e24519179 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -726,7 +726,12 @@ perf_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index ef8ae28c9..616651681 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -233,7 +233,12 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 			return -EINVAL;
 		}
 
-		rte_eth_promiscuous_enable(i);
+		ret = rte_eth_promiscuous_enable(i);
+		if (ret != 0) {
+			evt_err("Failed to enable promiscuous mode for eth port [%d]: %s",
+				i, rte_strerror(-ret));
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 09/13] app/pdump: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (7 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 08/13] app/eventdev: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 10/13] app/test: " Andrew Rybchenko
                     ` (4 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Reshma Pattan; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/pdump
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/pdump/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index c1b901279..9d6be8ed1 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -614,7 +614,13 @@ configure_vdev(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		rte_exit(EXIT_FAILURE,
+			 "promiscuous mode enable failed: %s\n",
+			 rte_strerror(-ret));
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 10/13] app/test: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (8 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 09/13] app/pdump: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 11/13] kni: " Andrew Rybchenko
                     ` (3 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Nikhil Rao; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across app/test/test_event_eth_rx_adapter.c
and app/test/test_event_eth_tx_adapter.c according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_event_eth_rx_adapter.c | 4 +++-
 app/test/test_event_eth_tx_adapter.c | 4 +++-
 app/test/test_pmd_perf.c             | 6 +++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 950bc67c2..6254fcd33 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -90,7 +90,9 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c
index 208d20c53..73f6afea2 100644
--- a/app/test/test_event_eth_tx_adapter.c
+++ b/app/test/test_event_eth_tx_adapter.c
@@ -94,7 +94,9 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf,
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c
index 4f9fc0d87..85ef11899 100644
--- a/app/test/test_pmd_perf.c
+++ b/app/test/test_pmd_perf.c
@@ -745,7 +745,11 @@ test_pmd_perf(void)
 				ret, portid);
 
 		/* always eanble promiscuous */
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				 rte_strerror(-ret), portid);
 
 		lcore_conf[slave_id].portlist[num++] = portid;
 		lcore_conf[slave_id].nb_ports++;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 11/13] kni: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (9 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 10/13] app/test: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 12/13] test/bonding: " Andrew Rybchenko
                     ` (2 subsequent siblings)
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so modify usage of these
functions across lib/librte_kni according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_kni.c      |  7 ++++++-
 examples/kni/main.c      |  9 +++++++--
 lib/librte_kni/rte_kni.c | 14 +++++++++++---
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/app/test/test_kni.c b/app/test/test_kni.c
index 2c333748d..e47ab36e0 100644
--- a/app/test/test_kni.c
+++ b/app/test/test_kni.c
@@ -601,7 +601,12 @@ test_kni(void)
 		printf("fail to start port %d\n", port_id);
 		return -1;
 	}
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("fail to enable promiscuous mode for port %d: %s\n",
+			port_id, rte_strerror(-ret));
+		return -1;
+	}
 
 	/* basic test of kni processing */
 	fd = fopen(KNI_MODULE_PARAM_LO, "r");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index e43f17447..1069fd08b 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -636,8 +636,13 @@ init_port(uint16_t port)
 		rte_exit(EXIT_FAILURE, "Could not start port%u (%d)\n",
 						(unsigned)port, ret);
 
-	if (promiscuous_on)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous_on) {
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"Could not enable promiscuous mode for port%u: %s\n",
+				port, rte_strerror(-ret));
+	}
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c
index 4b51fb4fe..04806ebb4 100644
--- a/lib/librte_kni/rte_kni.c
+++ b/lib/librte_kni/rte_kni.c
@@ -472,6 +472,8 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[])
 static int
 kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 {
+	int ret;
+
 	if (!rte_eth_dev_is_valid_port(port_id)) {
 		RTE_LOG(ERR, KNI, "Invalid port id %d\n", port_id);
 		return -EINVAL;
@@ -481,11 +483,17 @@ kni_config_promiscusity(uint16_t port_id, uint8_t to_on)
 		port_id, to_on);
 
 	if (to_on)
-		rte_eth_promiscuous_enable(port_id);
+		ret = rte_eth_promiscuous_enable(port_id);
 	else
-		rte_eth_promiscuous_disable(port_id);
+		ret = rte_eth_promiscuous_disable(port_id);
 
-	return 0;
+	if (ret != 0)
+		RTE_LOG(ERR, KNI,
+			"Failed to %s promiscuous mode for port %u: %s\n",
+			to_on ? "enable" : "disable", port_id,
+			rte_strerror(-ret));
+
+	return ret;
 }
 
 int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 12/13] test/bonding: check code of promiscuous mode switch
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (10 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 11/13] kni: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
  2019-09-24  7:31   ` [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Chas Williams; +Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across test/bonding
according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/test/test_link_bonding.c       | 55 ++++++++++++++++++++++++------
 app/test/test_link_bonding_mode4.c | 16 +++++++--
 2 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 938fafca3..cbbbc98a1 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -1760,13 +1760,17 @@ static int
 test_roundrobin_verify_promiscuous_enable_disable(void)
 {
 	int i, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_ROUND_ROBIN, 0, 4, 1),
 			"Failed to initialize bonded device with slaves");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 1,
@@ -1781,7 +1785,10 @@ test_roundrobin_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, 0,
@@ -2200,6 +2207,7 @@ static int
 test_activebackup_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
@@ -2211,7 +2219,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -2232,7 +2243,10 @@ test_activebackup_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled\n",
@@ -3110,13 +3124,17 @@ static int
 test_balance_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BALANCE, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
 			"Port (%d) promiscuous mode not enabled",
@@ -3129,7 +3147,10 @@ test_balance_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -3696,13 +3717,17 @@ static int
 test_broadcast_verify_promiscuous_enable_disable(void)
 {
 	int i;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in round robin mode */
 	TEST_ASSERT_SUCCESS(initialize_bonded_device_with_slaves(
 			BONDING_MODE_BROADCAST, 0, 4, 1),
 			"Failed to initialise bonded device");
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 1,
@@ -3716,7 +3741,10 @@ test_broadcast_verify_promiscuous_enable_disable(void)
 				test_params->slave_port_ids[i]);
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	TEST_ASSERT_EQUAL(rte_eth_promiscuous_get(test_params->bonded_port_id), 0,
 			"Port (%d) promiscuous mode not disabled",
@@ -4174,6 +4202,7 @@ static int
 test_tlb_verify_promiscuous_enable_disable(void)
 {
 	int i, primary_port, promiscuous_en;
+	int ret;
 
 	/* Initialize bonded device with 4 slaves in transmit load balancing mode */
 	TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(
@@ -4185,7 +4214,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 			"failed to get primary slave for bonded port (%d)",
 			test_params->bonded_port_id);
 
-	rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_enable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to enable promiscuous mode for port %d: %s",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)1,
@@ -4206,7 +4238,10 @@ test_tlb_verify_promiscuous_enable_disable(void)
 
 	}
 
-	rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params->bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed to disable promiscuous mode for port %d: %s\n",
+		test_params->bonded_port_id, rte_strerror(-ret));
 
 	promiscuous_en = rte_eth_promiscuous_get(test_params->bonded_port_id);
 	TEST_ASSERT_EQUAL(promiscuous_en, (int)0,
diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c
index bbb4e9cce..70b95d040 100644
--- a/app/test/test_link_bonding_mode4.c
+++ b/app/test/test_link_bonding_mode4.c
@@ -312,6 +312,7 @@ static int
 initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 {
 	uint8_t i;
+	int ret;
 
 	RTE_VERIFY(test_params.bonded_port_id != INVALID_PORT_ID);
 
@@ -323,7 +324,10 @@ initialize_bonded_device_with_slaves(uint16_t slave_count, uint8_t external_sm)
 
 	/* Reset mode 4 configuration */
 	rte_eth_bond_8023ad_setup(test_params.bonded_port_id, NULL);
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	ret = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(ret,
+		"Failed disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-ret));
 
 	if (external_sm) {
 		struct rte_eth_bond_8023ad_conf conf;
@@ -824,7 +828,10 @@ test_mode4_rx(void)
 	/* First try with promiscuous mode enabled.
 	 * Add 2 packets to each slave. First with bonding MAC address, second with
 	 * different. Check if we received all of them. */
-	rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_enable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+			"Failed to enable promiscuous mode for port %d: %s",
+			test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
@@ -869,7 +876,10 @@ test_mode4_rx(void)
 
 	/* Now, disable promiscuous mode. When promiscuous mode is disabled we
 	 * expect to receive only packets that are directed to bonding port. */
-	rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	retval = rte_eth_promiscuous_disable(test_params.bonded_port_id);
+	TEST_ASSERT_SUCCESS(retval,
+		"Failed to disable promiscuous mode for port %d: %s",
+		test_params.bonded_port_id, rte_strerror(-retval));
 
 	expected_pkts_cnt = 0;
 	FOR_EACH_SLAVE(i, slave) {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* [dpdk-dev] [PATCH v3 13/13] examples: take promiscuous mode switch result into account
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (11 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 12/13] test/bonding: " Andrew Rybchenko
@ 2019-09-14 11:37   ` Andrew Rybchenko
  2019-09-24  7:31   ` [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
  13 siblings, 0 replies; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-14 11:37 UTC (permalink / raw)
  To: Nicolas Chautru, Chas Williams, David Hunt, Harry van Haaren,
	Marko Kovacevic, Ori Kam, Bruce Richardson, Radu Nicolau,
	Akhil Goyal, Tomasz Kantecki, Bernard Iremonger,
	Konstantin Ananyev, Cristian Dumitrescu, Declan Doherty,
	Anatoly Burakov, Reshma Pattan, John McNamara, Xiaoyun Li,
	Jasvinder Singh, Byron Marohn, Yipeng Wang, Maxime Coquelin,
	Tiwei Bie, Zhihong Wang
  Cc: dev, Ivan Ilchenko

From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>

rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
value was changed from void to int, so this patch modify usage
of these functions across examples according to new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 examples/bbdev_app/main.c                            |  7 ++++++-
 examples/bond/main.c                                 |  8 +++++++-
 examples/distributor/main.c                          |  4 +++-
 examples/eventdev_pipeline/main.c                    |  4 +++-
 examples/exception_path/main.c                       |  5 ++++-
 examples/flow_classify/flow_classify.c               |  4 +++-
 examples/flow_filtering/main.c                       |  7 ++++++-
 examples/ip_fragmentation/main.c                     |  6 +++++-
 examples/ip_pipeline/link.c                          |  7 +++++--
 examples/ip_reassembly/main.c                        |  6 +++++-
 examples/ipsec-secgw/ipsec-secgw.c                   |  9 +++++++--
 examples/l2fwd-cat/l2fwd-cat.c                       |  4 +++-
 examples/l2fwd-crypto/main.c                         |  7 ++++++-
 examples/l2fwd-jobstats/main.c                       |  9 ++++++++-
 examples/l2fwd-keepalive/main.c                      |  6 +++++-
 examples/l2fwd/main.c                                |  6 +++++-
 examples/l3fwd-acl/main.c                            |  9 +++++++--
 examples/l3fwd-power/main.c                          |  9 +++++++--
 examples/l3fwd/main.c                                |  9 +++++++--
 examples/link_status_interrupt/main.c                |  6 +++++-
 examples/load_balancer/init.c                        |  6 +++++-
 .../multi_process/client_server_mp/mp_server/init.c  |  4 +++-
 examples/multi_process/symmetric_mp/main.c           |  4 +++-
 examples/netmap_compat/bridge/bridge.c               |  6 +++++-
 examples/packet_ordering/main.c                      |  4 +++-
 examples/performance-thread/l3fwd-thread/main.c      |  9 +++++++--
 examples/ptpclient/ptpclient.c                       |  7 ++++++-
 examples/qos_meter/main.c                            | 12 ++++++++++--
 examples/qos_sched/init.c                            |  6 +++++-
 examples/quota_watermark/qw/init.c                   |  6 +++++-
 examples/rxtx_callbacks/main.c                       |  5 ++++-
 examples/server_node_efd/server/init.c               |  4 +++-
 examples/skeleton/basicfwd.c                         |  4 +++-
 examples/vhost/main.c                                | 11 +++++++++--
 examples/vm_power_manager/main.c                     |  4 +++-
 35 files changed, 181 insertions(+), 43 deletions(-)

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 9acf666dc..3d36629a1 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -477,7 +477,12 @@ initialize_ports(struct app_config_params *app_params,
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0) {
+		printf("Cannot enable promiscuous mode: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+		return ret;
+	}
 
 	rte_eth_macaddr_get(port_id, &bbdev_port_eth_addr);
 	print_mac(port_id, &bbdev_port_eth_addr);
diff --git a/examples/bond/main.c b/examples/bond/main.c
index be62c1713..39214cfee 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -299,7 +299,13 @@ bond_port_init(struct rte_mempool *mbuf_pool)
 			rte_exit(-1, "\nFailed to activate slaves\n");
 	}
 
-	rte_eth_promiscuous_enable(BOND_PORT);
+	retval = rte_eth_promiscuous_enable(BOND_PORT);
+	if (retval != 0) {
+		rte_exit(EXIT_FAILURE,
+				"port %u: promiscuous mode enable failed: %s\n",
+				BOND_PORT, rte_strerror(-retval));
+		return;
+	}
 
 	struct rte_ether_addr addr;
 
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8942f3607..125ee877f 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -194,7 +194,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 3789fbfd7..c734c7750 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -333,7 +333,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index d7f3598af..f3c0206b5 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -473,7 +473,10 @@ init_port(uint16_t port)
 	if (ret < 0)
 		FATAL_ERROR("Could not start port%u (%d)", port, ret);
 
-	rte_eth_promiscuous_enable(port);
+	ret = rte_eth_promiscuous_enable(port);
+	if (ret != 0)
+		FATAL_ERROR("Could not enable promiscuous mode for port%u (%s)",
+			    port, rte_strerror(-ret));
 }
 
 /* Check the link status of all ports in up to 9s, and print them finally */
diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c
index 2130c13d8..ae0faf621 100644
--- a/examples/flow_classify/flow_classify.c
+++ b/examples/flow_classify/flow_classify.c
@@ -251,7 +251,9 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index fe064fa02..c40cfd098 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -180,7 +180,12 @@ init_port(void)
 		}
 	}
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			":: promiscuous mode enable failed: err=%s, port=%u\n",
+			rte_strerror(-ret), port_id);
+
 	ret = rte_eth_dev_start(port_id);
 	if (ret < 0) {
 		rte_exit(EXIT_FAILURE,
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 6b832445a..70139ee4d 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -1038,7 +1038,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 
 		if (check_ptype(portid) == 0) {
 			rte_eth_add_rx_callback(portid, 0, cb_parse_ptype, NULL);
diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 4e3a40b5a..744abf394 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -176,8 +176,11 @@ link_create(const char *name, struct link_params *params)
 	if (status < 0)
 		return NULL;
 
-	if (params->promiscuous)
-		rte_eth_promiscuous_enable(port_id);
+	if (params->promiscuous) {
+		status = rte_eth_promiscuous_enable(port_id);
+		if (status != 0)
+			return NULL;
+	}
 
 	/* Port RX */
 	for (i = 0; i < params->rx.n_queues; i++) {
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 87d4b5c01..e810e9f3f 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -1169,7 +1169,11 @@ main(int argc, char **argv)
 			rte_exit(EXIT_FAILURE, "rte_eth_dev_start: err=%d, port=%d\n",
 				ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+				rte_strerror(-ret), portid);
 	}
 
 	if (init_routing_table() < 0)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 534830a8e..8154fc76a 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -2467,8 +2467,13 @@ main(int32_t argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%d\n",
+					rte_strerror(-ret), portid);
+		}
 
 		rte_eth_dev_callback_register(portid,
 			RTE_ETH_EVENT_IPSEC, inline_ipsec_event_callback, NULL);
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index b34b40a00..b15f0330b 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -83,7 +83,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 9a370f2de..c4ef31031 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2574,7 +2574,12 @@ initialize_ports(struct l2fwd_crypto_options *options)
 			return -1;
 		}
 
-		rte_eth_promiscuous_enable(portid);
+		retval = rte_eth_promiscuous_enable(portid);
+		if (retval != 0) {
+			printf("rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				rte_strerror(-retval), portid);
+			return -1;
+		}
 
 		rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
 
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 5fcba5c88..3dd6e45b8 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -916,7 +916,14 @@ main(int argc, char **argv)
 
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0) {
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
+			return ret;
+
+		}
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index a05139068..708f44ee0 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -709,7 +709,11 @@ main(int argc, char **argv)
 				"rte_eth_dev_start:err=%d, port=%u\n",
 				  ret, portid);
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: "
 			"%02X:%02X:%02X:%02X:%02X:%02X\n\n",
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index 8d4c53981..db070a18b 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -708,7 +708,11 @@ main(int argc, char **argv)
 
 		printf("done: \n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				 "rte_eth_promiscuous_enable:err=%s, port=%u\n",
+				 rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				portid,
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 60531ce0e..c974a357b 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -2085,8 +2085,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	check_all_ports_link_status(enabled_port_mask);
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index bfcaa46c5..8ddc9ceb1 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -2453,8 +2453,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 		/* initialize spinlock for each port */
 		rte_spinlock_init(&(locks[portid]));
 	}
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 3294ac2da..9ed495ee0 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -1035,8 +1035,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	printf("\n");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 0c3dfc691..be57e6a98 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -689,7 +689,11 @@ main(int argc, char **argv)
 				  ret, (unsigned) portid);
 		printf("done:\n");
 
-		rte_eth_promiscuous_enable(portid);
+		ret = rte_eth_promiscuous_enable(portid);
+		if (ret != 0)
+			rte_exit(EXIT_FAILURE,
+				"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+				rte_strerror(-ret), portid);
 
 		printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n",
 				(unsigned) portid,
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index 660f5a8ed..4d49c9514 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -440,7 +440,11 @@ app_init_nics(void)
 		if (ret < 0) {
 			rte_panic("Cannot init NIC port %u (%d)\n", port, ret);
 		}
-		rte_eth_promiscuous_enable(port);
+
+		ret = rte_eth_promiscuous_enable(port);
+		if (ret != 0)
+			rte_panic("Cannot enable promiscuous mode on port %u (%s)\n",
+				port, rte_strerror(-ret));
 
 		nic_rx_ring_size = app.nic_rx_ring_size;
 		nic_tx_ring_size = app.nic_tx_ring_size;
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index 3af5dc699..e55def84b 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -132,7 +132,9 @@ init_port(uint16_t port_num)
 		if (retval < 0) return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval < 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port_num);
 	if (retval < 0) return retval;
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 9ae8efb0b..95058a5dc 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -261,7 +261,9 @@ smp_port_init(uint16_t port, struct rte_mempool *mbuf_pool,
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	retval  = rte_eth_dev_start(port);
 	if (retval < 0)
diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c
index d40e163b0..f3819d222 100644
--- a/examples/netmap_compat/bridge/bridge.c
+++ b/examples/netmap_compat/bridge/bridge.c
@@ -261,7 +261,11 @@ int main(int argc, char *argv[])
 			rte_exit(EXIT_FAILURE, "Couldn't setup port %hhu\n",
 				ports.p[i].id);
 
-		rte_eth_promiscuous_enable(ports.p[i].id);
+		err = rte_eth_promiscuous_enable(ports.p[i].id);
+		if (err != 0)
+			rte_exit(EXIT_FAILURE,
+				"Couldn't enable promiscuous mode on port %u: %s\n",
+				ports.p[i].id, rte_strerror(-err));
 	}
 
 	for (i = 0; i != ports.num; i++) {
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index a99961f82..132f582a9 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -330,7 +330,9 @@ configure_eth_port(uint16_t port_id)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		return ret;
 
 	return 0;
 }
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 00f535053..9e25f064e 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3706,8 +3706,13 @@ main(int argc, char **argv)
 		 * to itself through 2 cross-connected  ports of the
 		 * target machine.
 		 */
-		if (promiscuous_on)
-			rte_eth_promiscuous_enable(portid);
+		if (promiscuous_on) {
+			ret = rte_eth_promiscuous_enable(portid);
+			if (ret != 0)
+				rte_exit(EXIT_FAILURE,
+					"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+					rte_strerror(-ret), portid);
+		}
 	}
 
 	for (i = 0; i < n_rx_thread; i++) {
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index bc427a526..6e273f644 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -247,7 +247,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	}
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0) {
+		printf("Promiscuous mode enable failed: %s\n",
+			rte_strerror(-retval));
+		return retval;
+	}
 
 	return 0;
 }
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index 13c85e940..e8112c83a 100644
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -439,9 +439,17 @@ main(int argc, char **argv)
 	if (ret < 0)
 		rte_exit(EXIT_FAILURE, "Port %d start error (%d)\n", port_tx, ret);
 
-	rte_eth_promiscuous_enable(port_rx);
+	ret = rte_eth_promiscuous_enable(port_rx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
-	rte_eth_promiscuous_enable(port_tx);
+	ret = rte_eth_promiscuous_enable(port_tx);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Port %d promiscuous mode enable error (%s)\n",
+			port_rx, rte_strerror(-ret));
 
 	/* App configuration */
 	ret = app_configure_flow_table();
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index cf9e8f4ac..dbdbdefea 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -163,7 +163,11 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
 	} else {
 		printf(" Link Down\n");
 	}
-	rte_eth_promiscuous_enable(portid);
+	ret = rte_eth_promiscuous_enable(portid);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"rte_eth_promiscuous_enable: err=%s, port=%u\n",
+			rte_strerror(-ret), portid);
 
 	/* mark port as initialized */
 	app_inited_port_mask |= 1u << portid;
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index 5a0f64f45..5ebcc83ac 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -103,7 +103,11 @@ void configure_eth_port(uint16_t port_id)
 				(unsigned int) port_id, ret);
 
 	/* Put it in promiscuous mode */
-	rte_eth_promiscuous_enable(port_id);
+	ret = rte_eth_promiscuous_enable(port_id);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Failed to enable promiscuous mode for port %u: %s\n",
+			port_id, rte_strerror(-ret));
 }
 
 void
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 9fd4b8efd..5d545115c 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -196,7 +196,10 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[2], addr.addr_bytes[3],
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
+
 	rte_eth_add_rx_callback(port, 0, add_timestamps, NULL);
 	rte_eth_add_tx_callback(port, 0, calc_latency, NULL);
 
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 773780b4d..335741a8f 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -150,7 +150,9 @@ init_port(uint16_t port_num)
 			return retval;
 	}
 
-	rte_eth_promiscuous_enable(port_num);
+	retval = rte_eth_promiscuous_enable(port_num);
+	if (retval != 0)
+		return retval;
 
 	retval = rte_eth_dev_start(port_num);
 	if (retval < 0)
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index 171ebde7b..8f1805aeb 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -98,7 +98,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 	return 0;
 }
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 794d12ba7..b5632d771 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -336,8 +336,15 @@ port_init(uint16_t port)
 		return retval;
 	}
 
-	if (promiscuous)
-		rte_eth_promiscuous_enable(port);
+	if (promiscuous) {
+		retval = rte_eth_promiscuous_enable(port);
+		if (retval != 0) {
+			RTE_LOG(ERR, VHOST_PORT,
+				"Failed to enable promiscuous mode on port %u: %s\n",
+				port, rte_strerror(-retval));
+			return retval;
+		}
+	}
 
 	rte_eth_macaddr_get(port, &vmdq_ports_eth_addr[port]);
 	RTE_LOG(INFO, VHOST_PORT, "Max virtio devices supported: %u\n", num_devices);
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 0f48ae926..3778b538c 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -121,7 +121,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 			addr.addr_bytes[4], addr.addr_bytes[5]);
 
 	/* Enable RX in promiscuous mode for the Ethernet device. */
-	rte_eth_promiscuous_enable(port);
+	retval = rte_eth_promiscuous_enable(port);
+	if (retval != 0)
+		return retval;
 
 
 	return 0;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 21:06       ` Andrew Rybchenko
@ 2019-09-16  6:48         ` Hyong Youb Kim (hyonkim)
  0 siblings, 0 replies; 77+ messages in thread
From: Hyong Youb Kim (hyonkim) @ 2019-09-16  6:48 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley (johndale),
	Gaetan Rivet, Xiao Wang, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Beilei Xing, Jingjing Wu, Qiming Yang, Rosen Xu,
	Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon, Ferruh Yigit
  Cc: dev

> -----Original Message-----
> From: Andrew Rybchenko <arybchenko@solarflare.com>
> Sent: Saturday, September 14, 2019 6:07 AM
[...]
> Subject: Re: [PATCH v2 04/13] ethdev: change promiscuous callbacks to
> return status
> 
> On 9/11/19 11:46 AM, Hyong Youb Kim (hyonkim) wrote:
> >> -----Original Message-----
> >> From: Andrew Rybchenko <arybchenko@solarflare.com>
> >> Sent: Monday, September 9, 2019 8:59 PM
> > [...]
> >> Subject: [PATCH v2 04/13] ethdev: change promiscuous callbacks to return
> >> status
> >>
> >> Enabling/disabling of promiscuous mode is not always successful and
> >> it should be taken into account to be able to handle it properly.
> >>
> >> When correct return status is unclear from driver code, -EAGAIN is used.
> >>
> >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> >> ---
> > [...]
> >>   drivers/net/enic/enic.h                   |  2 +-
> >>   drivers/net/enic/enic_ethdev.c            | 22 +++++++---
> >>   drivers/net/enic/enic_main.c              |  4 +-
> > [...]
> >>   static void
> >> diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
> >> index 5a92508f00..72b1e7956b 100644
> >> --- a/drivers/net/enic/enic.h
> >> +++ b/drivers/net/enic/enic.h
> >> @@ -305,7 +305,7 @@ int enic_get_link_status(struct enic *enic);
> >>   int enic_dev_stats_get(struct enic *enic,
> >>   		       struct rte_eth_stats *r_stats);
> >>   void enic_dev_stats_clear(struct enic *enic);
> >> -void enic_add_packet_filter(struct enic *enic);
> >> +int enic_add_packet_filter(struct enic *enic);
> >>   int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
> >>   int enic_del_mac_address(struct enic *enic, int mac_index);
> >>   unsigned int enic_cleanup_wq(struct enic *enic, struct vnic_wq *wq);
> >> diff --git a/drivers/net/enic/enic_ethdev.c
> b/drivers/net/enic/enic_ethdev.c
> >> index 90fdeda901..5d48930a9d 100644
> >> --- a/drivers/net/enic/enic_ethdev.c
> >> +++ b/drivers/net/enic/enic_ethdev.c
> >> @@ -603,29 +603,39 @@ static const uint32_t
> >> *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
> >>   	return NULL;
> >>   }
> >>
> >> -static void enicpmd_dev_promiscuous_enable(struct rte_eth_dev
> >> *eth_dev)
> >> +static int enicpmd_dev_promiscuous_enable(struct rte_eth_dev
> *eth_dev)
> >>   {
> >>   	struct enic *enic = pmd_priv(eth_dev);
> >> +	int ret;
> >>
> >>   	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> >> -		return;
> >> +		return -ENOTSUP;
> > Should return -E_RTE_SECONDARY to be consistent with other handlers
> > that check primary/secondary.
> 
> I'll fix in the next version, but please, note that -ENOTSUP has
> special handling in ethdev patch on config restore. It looks like
> different error code should not be a problem here, but please, check.
> 

Andrew,

I see v3 returns -E_RTE_SECONDARY. Thank you. For enic, it does not
affect the new error checking in config_restore. In a secondary
process, enic's dev_start handler fails first, so rte_eth_dev_start
never gets to call config_restore.

-Hyong

> >>   	ENICPMD_FUNC_TRACE();
> >>
> >>   	enic->promisc = 1;
> >> -	enic_add_packet_filter(enic);
> >> +	ret = enic_add_packet_filter(enic);
> >> +	if (ret != 0)
> >> +		enic->promisc = 0;
> >> +
> >> +	return ret;
> >>   }
> >>
> >> -static void enicpmd_dev_promiscuous_disable(struct rte_eth_dev
> >> *eth_dev)
> >> +static int enicpmd_dev_promiscuous_disable(struct rte_eth_dev
> *eth_dev)
> >>   {
> >>   	struct enic *enic = pmd_priv(eth_dev);
> >> +	int ret;
> >>
> >>   	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> >> -		return;
> >> +		return -ENOTSUP;
> > Should return -E_RTE_SECONDARY here too.
> >
> >>   	ENICPMD_FUNC_TRACE();
> >>   	enic->promisc = 0;
> >> -	enic_add_packet_filter(enic);
> >> +	ret = enic_add_packet_filter(enic);
> >> +	if (ret != 0)
> >> +		enic->promisc = 1;
> >> +
> >> +	return ret;
> >>   }
> >>
> >>   static void enicpmd_dev_allmulticast_enable(struct rte_eth_dev
> *eth_dev)
> >> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> >> index 40af3781b3..f4e76a057a 100644
> >> --- a/drivers/net/enic/enic_main.c
> >> +++ b/drivers/net/enic/enic_main.c
> >> @@ -1364,10 +1364,10 @@ int enic_set_vlan_strip(struct enic *enic)
> >>   			       enic->rss_enable);
> >>   }
> >>
> >> -void enic_add_packet_filter(struct enic *enic)
> >> +int enic_add_packet_filter(struct enic *enic)
> >>   {
> >>   	/* Args -> directed, multicast, broadcast, promisc, allmulti */
> >> -	vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
> >> +	return vnic_dev_packet_filter(enic->vdev, 1, 1, 1,
> >>   		enic->promisc, enic->allmulti);
> >>   }
> >>
> > A couple minor comments above. Other than those, patch works fine for
> enic.
> > Feel free to add my ack on v2..
> >
> > Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
> >
> 
> Thanks for review,
> Andrew.

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v3 07/13] app/testpmd: check code of promiscuous mode switch
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 07/13] app/testpmd: " Andrew Rybchenko
@ 2019-09-16 13:18     ` Iremonger, Bernard
  0 siblings, 0 replies; 77+ messages in thread
From: Iremonger, Bernard @ 2019-09-16 13:18 UTC (permalink / raw)
  To: Andrew Rybchenko, Lu, Wenzhuo, Wu, Jingjing; +Cc: dev, Ivan Ilchenko

> -----Original Message-----
> From: Andrew Rybchenko [mailto:arybchenko@solarflare.com]
> Sent: Saturday, September 14, 2019 12:37 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Iremonger, Bernard
> <bernard.iremonger@intel.com>
> Cc: dev@dpdk.org; Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Subject: [PATCH v3 07/13] app/testpmd: check code of promiscuous mode
> switch
> 
> From: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> 
> rte_eth_promiscuous_enable()/rte_eth_promiscuous_disable() return
> value was changed from void to int, so this patch modify usage of these
> functions across app/testpmd according to new return type.
> 
> Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>

Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-13 19:57           ` Andrew Rybchenko
@ 2019-09-16 13:22             ` Ferruh Yigit
  2019-09-16 15:45               ` Andrew Rybchenko
  0 siblings, 1 reply; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-16 13:22 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/13/2019 8:57 PM, Andrew Rybchenko wrote:
> On 9/13/19 7:34 PM, Ferruh Yigit wrote:
>> On 9/13/2019 5:05 PM, Andrew Rybchenko wrote:
>>> On 9/13/19 6:39 PM, Ferruh Yigit wrote:
>>>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>>>> Enabling/disabling of promiscuous mode is not always successful and
>>>>> it should be taken into account to be able to handle it properly.
>>>>>
>>>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>>>
>>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>> <...>
>>>>
>>>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>>>> index f85458c3cd..41612ce838 100644
>>>>> --- a/drivers/net/tap/rte_eth_tap.c
>>>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>>>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>>>>    	return 0;
>>>>>    }
>>>>>    
>>>>> -static void
>>>>> +static int
>>>>>    tap_promisc_enable(struct rte_eth_dev *dev)
>>>>>    {
>>>>>    	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>    	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>> +	int ret;
>>>>>    
>>>>> -	dev->data->promiscuous = 1;
>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>> +	if (ret != 0)
>>>>> +		return ret;
>>>>> +
>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>> +		dev->data->promiscuous = 1;
>>>> I think PMD shouldn't be setting this variable, it is already set by the API.
>>>> I quickly checked if an internal function requires this but it looks like it has
>>>> been set by mistake, I think we can remove this.
>>> It is set after callback in the case of enable.
>> I see, but do we need it enabled earlier?
> 
> Not sure that I understand the question, but tap_ioctl() does not use it.
> So, it is safe to move just before tap_flow_implicit_create().

I think 'dev->data->promiscuous' shouldn't be set be PMD dev_ops, and API
already does it. Is there a specific reason in tap to set this in dev_ops? If
not can we remove setting 'dev->data->promiscuous' from dev_ops?

> 
>>>>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>> +		if (ret != 0) {
>>>>> +			/* Rollback promisc flag */
>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>> +			/*
>>>>> +			 * rte_eth_dev_promiscuous_enable() rollback
>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>> +			 */
>>>>> +			return ret;
>>>>> +		}
>>>>> +	}
>>>>> +
>>>>> +	return 0;
>>>>>    }
>>>>>    
>>>>> -static void
>>>>> +static int
>>>>>    tap_promisc_disable(struct rte_eth_dev *dev)
>>>>>    {
>>>>>    	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>    	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>> +	int ret;
>>>>>    
>>>>> -	dev->data->promiscuous = 0;
>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>> +	if (ret != 0)
>>>>> +		return ret;
>>>>> +
>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>> +		dev->data->promiscuous = 0;
>>>> Ditto
>>>>
>>>>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>> +		if (ret != 0) {
>>>>> +			/* Rollback promisc flag */
>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>> +			/*
>>>>> +			 * rte_eth_dev_promiscuous_disable() rollback
>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>> +			 */
>>>>> +			return ret;
>>>>> +		}
>>>>> +	}
>>>>> +
>>>>> +	return 0;
>>>>>    }
> 


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-16 13:22             ` Ferruh Yigit
@ 2019-09-16 15:45               ` Andrew Rybchenko
  2019-09-16 15:58                 ` Ferruh Yigit
  0 siblings, 1 reply; 77+ messages in thread
From: Andrew Rybchenko @ 2019-09-16 15:45 UTC (permalink / raw)
  To: Ferruh Yigit, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/16/19 4:22 PM, Ferruh Yigit wrote:
> On 9/13/2019 8:57 PM, Andrew Rybchenko wrote:
>> On 9/13/19 7:34 PM, Ferruh Yigit wrote:
>>> On 9/13/2019 5:05 PM, Andrew Rybchenko wrote:
>>>> On 9/13/19 6:39 PM, Ferruh Yigit wrote:
>>>>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>>>>> Enabling/disabling of promiscuous mode is not always successful and
>>>>>> it should be taken into account to be able to handle it properly.
>>>>>>
>>>>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>>>>
>>>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>>> <...>
>>>>>
>>>>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>>>>> index f85458c3cd..41612ce838 100644
>>>>>> --- a/drivers/net/tap/rte_eth_tap.c
>>>>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>>>>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>>>>>     	return 0;
>>>>>>     }
>>>>>>     
>>>>>> -static void
>>>>>> +static int
>>>>>>     tap_promisc_enable(struct rte_eth_dev *dev)
>>>>>>     {
>>>>>>     	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>>     	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>>> +	int ret;
>>>>>>     
>>>>>> -	dev->data->promiscuous = 1;
>>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>> +	if (ret != 0)
>>>>>> +		return ret;
>>>>>> +
>>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>>> +		dev->data->promiscuous = 1;
>>>>> I think PMD shouldn't be setting this variable, it is already set by the API.
>>>>> I quickly checked if an internal function requires this but it looks like it has
>>>>> been set by mistake, I think we can remove this.
>>>> It is set after callback in the case of enable.
>>> I see, but do we need it enabled earlier?
>> Not sure that I understand the question, but tap_ioctl() does not use it.
>> So, it is safe to move just before tap_flow_implicit_create().
> I think 'dev->data->promiscuous' shouldn't be set be PMD dev_ops, and API
> already does it. Is there a specific reason in tap to set this in dev_ops? If
> not can we remove setting 'dev->data->promiscuous' from dev_ops?

The problem is the following: right now enable function sets
data->promiscuous after driver callback execution, some drivers
definitely use the variable internally and require it to be set before
some driver operations. That's why these drivers set it on entry.
However, it does not mean that no drivers rely on the fact that
data->promiscuous value is set to 1 after callback. Most likely these
drivers are buggy since it is false in the case of configuration restore
on startup, but anyway it is not that simply.

Yes, I would prefer to avoid setting data->promiscuous from driver
code in enable/disable callbacks, but it should be a separate patch
which change it.

Right now:

net/bnxt sets data->promiscuous=1 on configure if Rx mode is VMDQ_DCB

net/mlx4 sets data->promiscuous always on enable/disable entry

net/octeontx sets data->promiscuous before exit from callback and
I think it can be safely removed since API functions definitely do it
before or after callback.

net/softnic sets data->promiscuous=1 on driver register

net/tap sets data->promiscuous=1 in enable/disable hooks before
tap_flow_implicit_create()

net/nfb sets data->promiscuous in driver init

net/octeontx2 sets data->promiscuous in the middle of processing, but
I guess before it is really used


>>>>>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>>> +		if (ret != 0) {
>>>>>> +			/* Rollback promisc flag */
>>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>> +			/*
>>>>>> +			 * rte_eth_dev_promiscuous_enable() rollback
>>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>>> +			 */
>>>>>> +			return ret;
>>>>>> +		}
>>>>>> +	}
>>>>>> +
>>>>>> +	return 0;
>>>>>>     }
>>>>>>     
>>>>>> -static void
>>>>>> +static int
>>>>>>     tap_promisc_disable(struct rte_eth_dev *dev)
>>>>>>     {
>>>>>>     	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>>     	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>>> +	int ret;
>>>>>>     
>>>>>> -	dev->data->promiscuous = 0;
>>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>> +	if (ret != 0)
>>>>>> +		return ret;
>>>>>> +
>>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>>> +		dev->data->promiscuous = 0;
>>>>> Ditto
>>>>>
>>>>>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>>> +		if (ret != 0) {
>>>>>> +			/* Rollback promisc flag */
>>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>> +			/*
>>>>>> +			 * rte_eth_dev_promiscuous_disable() rollback
>>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>>> +			 */
>>>>>> +			return ret;
>>>>>> +		}
>>>>>> +	}
>>>>>> +
>>>>>> +	return 0;
>>>>>>     }


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status
  2019-09-16 15:45               ` Andrew Rybchenko
@ 2019-09-16 15:58                 ` Ferruh Yigit
  0 siblings, 0 replies; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-16 15:58 UTC (permalink / raw)
  To: Andrew Rybchenko, John W. Linville, Xiaolong Ye, Qi Zhang,
	Igor Russkikh, Pavel Belous, Allain Legacy, Matt Peters,
	Ravi Kumar, Rasesh Mody, Shahed Shaikh, Ajit Khaparde,
	Somnath Kotur, Chas Williams, Rahul Lakkireddy, Hemant Agrawal,
	Sachin Saxena, Wenzhuo Lu, Gagandeep Singh, John Daley,
	Hyong Youb Kim, Gaetan Rivet, Xiao Wang, Ziyang Xuan,
	Xiaoyun Wang, Guoyang Zhou, Beilei Xing, Jingjing Wu,
	Qiming Yang, Rosen Xu, Konstantin Ananyev, Shijith Thotton,
	Srisivasubramanian Srinivasan, Matan Azrad, Shahaf Shuler,
	Yongseok Koh, Viacheslav Ovsiienko, Zyta Szpak, Liron Himi,
	Tomasz Duszynski, Stephen Hemminger, K. Y. Srinivasan,
	Haiyang Zhang, Rastislav Cernay, Jan Remes, Alejandro Lucero,
	Jerin Jacob, Nithin Dabilpuram, Kiran Kumar K, Keith Wiles,
	Maciej Czekaj, Maxime Coquelin, Tiwei Bie, Zhihong Wang,
	Yong Wang, Thomas Monjalon
  Cc: dev

On 9/16/2019 4:45 PM, Andrew Rybchenko wrote:
> On 9/16/19 4:22 PM, Ferruh Yigit wrote:
>> On 9/13/2019 8:57 PM, Andrew Rybchenko wrote:
>>> On 9/13/19 7:34 PM, Ferruh Yigit wrote:
>>>> On 9/13/2019 5:05 PM, Andrew Rybchenko wrote:
>>>>> On 9/13/19 6:39 PM, Ferruh Yigit wrote:
>>>>>> On 9/9/2019 12:58 PM, Andrew Rybchenko wrote:
>>>>>>> Enabling/disabling of promiscuous mode is not always successful and
>>>>>>> it should be taken into account to be able to handle it properly.
>>>>>>>
>>>>>>> When correct return status is unclear from driver code, -EAGAIN is used.
>>>>>>>
>>>>>>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
>>>>>> <...>
>>>>>>
>>>>>>> diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
>>>>>>> index f85458c3cd..41612ce838 100644
>>>>>>> --- a/drivers/net/tap/rte_eth_tap.c
>>>>>>> +++ b/drivers/net/tap/rte_eth_tap.c
>>>>>>> @@ -1100,28 +1100,60 @@ tap_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused)
>>>>>>>     	return 0;
>>>>>>>     }
>>>>>>>     
>>>>>>> -static void
>>>>>>> +static int
>>>>>>>     tap_promisc_enable(struct rte_eth_dev *dev)
>>>>>>>     {
>>>>>>>     	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>>>     	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>>>> +	int ret;
>>>>>>>     
>>>>>>> -	dev->data->promiscuous = 1;
>>>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>>>> -		tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>>> +	if (ret != 0)
>>>>>>> +		return ret;
>>>>>>> +
>>>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>>>> +		dev->data->promiscuous = 1;
>>>>>> I think PMD shouldn't be setting this variable, it is already set by the API.
>>>>>> I quickly checked if an internal function requires this but it looks like it has
>>>>>> been set by mistake, I think we can remove this.
>>>>> It is set after callback in the case of enable.
>>>> I see, but do we need it enabled earlier?
>>> Not sure that I understand the question, but tap_ioctl() does not use it.
>>> So, it is safe to move just before tap_flow_implicit_create().
>> I think 'dev->data->promiscuous' shouldn't be set be PMD dev_ops, and API
>> already does it. Is there a specific reason in tap to set this in dev_ops? If
>> not can we remove setting 'dev->data->promiscuous' from dev_ops?
> 
> The problem is the following: right now enable function sets
> data->promiscuous after driver callback execution, some drivers
> definitely use the variable internally and require it to be set before
> some driver operations. That's why these drivers set it on entry.
> However, it does not mean that no drivers rely on the fact that
> data->promiscuous value is set to 1 after callback. Most likely these
> drivers are buggy since it is false in the case of configuration restore
> on startup, but anyway it is not that simply.
> 
> Yes, I would prefer to avoid setting data->promiscuous from driver
> code in enable/disable callbacks, but it should be a separate patch
> which change it.
> 
> Right now:
> 
> net/bnxt sets data->promiscuous=1 on configure if Rx mode is VMDQ_DCB
> 
> net/mlx4 sets data->promiscuous always on enable/disable entry
> 
> net/octeontx sets data->promiscuous before exit from callback and
> I think it can be safely removed since API functions definitely do it
> before or after callback.
> 
> net/softnic sets data->promiscuous=1 on driver register
> 
> net/tap sets data->promiscuous=1 in enable/disable hooks before
> tap_flow_implicit_create()
> 
> net/nfb sets data->promiscuous in driver init
> 
> net/octeontx2 sets data->promiscuous in the middle of processing, but
> I guess before it is really used

Thanks for the detailed clarification, I assumed it just introduced by mistake,
with current status agree to handle this on a separate patch.

Thanks,
ferruh

> 
> 
>>>>>>> +		ret = tap_flow_implicit_create(pmd, TAP_REMOTE_PROMISC);
>>>>>>> +		if (ret != 0) {
>>>>>>> +			/* Rollback promisc flag */
>>>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>>> +			/*
>>>>>>> +			 * rte_eth_dev_promiscuous_enable() rollback
>>>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>>>> +			 */
>>>>>>> +			return ret;
>>>>>>> +		}
>>>>>>> +	}
>>>>>>> +
>>>>>>> +	return 0;
>>>>>>>     }
>>>>>>>     
>>>>>>> -static void
>>>>>>> +static int
>>>>>>>     tap_promisc_disable(struct rte_eth_dev *dev)
>>>>>>>     {
>>>>>>>     	struct pmd_internals *pmd = dev->data->dev_private;
>>>>>>>     	struct ifreq ifr = { .ifr_flags = IFF_PROMISC };
>>>>>>> +	int ret;
>>>>>>>     
>>>>>>> -	dev->data->promiscuous = 0;
>>>>>>> -	tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>>> -	if (pmd->remote_if_index && !pmd->flow_isolate)
>>>>>>> -		tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>>>> +	ret = tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 0, LOCAL_AND_REMOTE);
>>>>>>> +	if (ret != 0)
>>>>>>> +		return ret;
>>>>>>> +
>>>>>>> +	if (pmd->remote_if_index && !pmd->flow_isolate) {
>>>>>>> +		dev->data->promiscuous = 0;
>>>>>> Ditto
>>>>>>
>>>>>>> +		ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_PROMISC);
>>>>>>> +		if (ret != 0) {
>>>>>>> +			/* Rollback promisc flag */
>>>>>>> +			tap_ioctl(pmd, SIOCSIFFLAGS, &ifr, 1, LOCAL_AND_REMOTE);
>>>>>>> +			/*
>>>>>>> +			 * rte_eth_dev_promiscuous_disable() rollback
>>>>>>> +			 * dev->data->promiscuous in the case of failure.
>>>>>>> +			 */
>>>>>>> +			return ret;
>>>>>>> +		}
>>>>>>> +	}
>>>>>>> +
>>>>>>> +	return 0;
>>>>>>>     }
> 


^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status
  2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
                     ` (12 preceding siblings ...)
  2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
@ 2019-09-24  7:31   ` Ferruh Yigit
  13 siblings, 0 replies; 77+ messages in thread
From: Ferruh Yigit @ 2019-09-24  7:31 UTC (permalink / raw)
  To: Andrew Rybchenko, Thomas Monjalon, Rasesh Mody, Shahed Shaikh,
	Wenzhuo Lu
  Cc: dev, Ivan Ilchenko

On 9/14/2019 12:37 PM, Andrew Rybchenko wrote:
> It is the second patch series to get rid of void returning functions
> in ethdev in accordance with deprecation notice [1].
> 
> It should be applied on top of the first one [2] which is already
> applied to dpdk-next-net, but not in main DPDK repo.
> It could be applied separately, but few simple conflicts should
> be resolved.
> 
> Functions which return void are bad since they do not provide explicit
> information to the caller if everything is OK or not.
> It is especially painful in the case of promiscuous mode since it is
> not always supported, there are real cases when it fails to apply and
> it affects traffic which is received by the port.
> 
> Driver maintainrs are encouraged to review the patch which changes
> driver callbacks prototype. Changes are not always trivial when I tried
> to provide real status of the operation. I used -EAGAIN when I failed
> to choose better error code.
> 
> The following two drivers ignore status of internal functions and
> definitely could be improved:
> 
> net/bnx2x: bnx2x_set_rx_mode() can report failure, but it is used in
> other places and should be updated carefully.
> 
> net/igbvf: e1000_promisc_set_vf() provides return status, but it is
> unclear how handle it properly.
> 
> [1] https://patches.dpdk.org/patch/56969/
> [2] https://patches.dpdk.org/project/dpdk/list/?series=6391
> 
> v3:
>  - list and describe return values of promiscuous mode enable/disalbe callbacks
>  - improve net/failsafe logging in the case of rollback failure to
>    distinguish operation and rollback failure cases
>  - fix build issue in AF_XDP PMD
>  - fix build issue in mlx4 PMD
>  - do not use goto and return error directly in mlx5
>  - return -E_RTE_SECONDARY in net/enic in the case of secondary process
>  - fix examples/vm_power_manager build
> 
> v2:
>  - minor style fix in app/testpmd
>  - use fs_err() in net/failsafe in accordance with review from Gaetan
>  - fix net/mvpp2 build
>  - use eth_err() in ethdev
> 
> 
> Andrew Rybchenko (2):
>   ethdev: change promiscuous callbacks to return status
>   ethdev: do nothing if promiscuous mode is applied again
> 
> Ivan Ilchenko (11):
>   ethdev: change promiscuous mode controllers to return errors
>   net/failsafe: check code of promiscuous mode switch
>   net/bonding: check code of promiscuous mode switch
>   app/pipeline: check code of promiscuous mode switch
>   app/testpmd: check code of promiscuous mode switch
>   app/eventdev: check code of promiscuous mode switch
>   app/pdump: check code of promiscuous mode switch
>   app/test: check code of promiscuous mode switch
>   kni: check code of promiscuous mode switch
>   test/bonding: check code of promiscuous mode switch
>   examples: take promiscuous mode switch result into account

Series applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2019-09-24  7:31 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 16:10 [dpdk-dev] [PATCH 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-05 16:25   ` Gaëtan Rivet
2019-09-05 16:32     ` Andrew Rybchenko
2019-09-05 16:36   ` Stephen Hemminger
2019-09-05 16:38     ` Andrew Rybchenko
2019-09-06  9:24       ` Gaëtan Rivet
2019-09-06 10:08         ` Andrew Rybchenko
2019-09-05 16:40   ` Stephen Hemminger
2019-09-05 16:49     ` Andrew Rybchenko
2019-09-05 17:13       ` Stephen Hemminger
2019-09-05 16:10 ` [dpdk-dev] [PATCH 03/13] net/bonding: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 07/13] app/testpmd: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 08/13] app/eventdev: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 09/13] app/pdump: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 10/13] app/test: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 11/13] kni: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 12/13] test/bonding: " Andrew Rybchenko
2019-09-05 16:10 ` [dpdk-dev] [PATCH 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-09 11:58 ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-13 15:35     ` Ferruh Yigit
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-09 12:48     ` Gaëtan Rivet
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 03/13] net/bonding: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-10  7:53     ` Matan Azrad
2019-09-13 21:05       ` Andrew Rybchenko
2019-09-11  8:46     ` Hyong Youb Kim (hyonkim)
2019-09-13 21:06       ` Andrew Rybchenko
2019-09-16  6:48         ` Hyong Youb Kim (hyonkim)
2019-09-13 15:34     ` Ferruh Yigit
2019-09-13 15:54       ` Andrew Rybchenko
2019-09-13 16:33         ` Ferruh Yigit
2019-09-13 15:39     ` Ferruh Yigit
2019-09-13 16:05       ` Andrew Rybchenko
2019-09-13 16:34         ` Ferruh Yigit
2019-09-13 19:57           ` Andrew Rybchenko
2019-09-16 13:22             ` Ferruh Yigit
2019-09-16 15:45               ` Andrew Rybchenko
2019-09-16 15:58                 ` Ferruh Yigit
2019-09-13 16:43     ` Ferruh Yigit
2019-09-13 20:33       ` Andrew Rybchenko
2019-09-13 16:56     ` Ferruh Yigit
2019-09-13 20:38       ` Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 07/13] app/testpmd: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 08/13] app/eventdev: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 09/13] app/pdump: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 10/13] app/test: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 11/13] kni: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 12/13] test/bonding: " Andrew Rybchenko
2019-09-09 11:58   ` [dpdk-dev] [PATCH v2 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-13 16:40     ` Ferruh Yigit
2019-09-13 18:30       ` Andrew Rybchenko
2019-09-13 16:37   ` [dpdk-dev] [PATCH v2 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit
2019-09-14 11:37 ` [dpdk-dev] [PATCH v3 " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 01/13] ethdev: change promiscuous mode controllers to return errors Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 02/13] net/failsafe: check code of promiscuous mode switch Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 03/13] net/bonding: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 04/13] ethdev: change promiscuous callbacks to return status Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 05/13] ethdev: do nothing if promiscuous mode is applied again Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 06/13] app/pipeline: check code of promiscuous mode switch Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 07/13] app/testpmd: " Andrew Rybchenko
2019-09-16 13:18     ` Iremonger, Bernard
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 08/13] app/eventdev: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 09/13] app/pdump: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 10/13] app/test: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 11/13] kni: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 12/13] test/bonding: " Andrew Rybchenko
2019-09-14 11:37   ` [dpdk-dev] [PATCH v3 13/13] examples: take promiscuous mode switch result into account Andrew Rybchenko
2019-09-24  7:31   ` [dpdk-dev] [PATCH v3 00/13] ethdev: change promiscuous mode functions to return status Ferruh Yigit

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).