``rte_eth_dev_l2_tunnel_offload_set`` which were not marked as deprecated,
will be removed in DPDK 20.11.
-* ethdev: Update API functions returning ``void`` to return ``int`` with
- negative errno values to indicate various error conditions (e.g.
- invalid port ID, unsupported operation, failed operation):
-
- - ``rte_eth_dev_stop``
-
* ethdev: New offload flags ``DEV_RX_OFFLOAD_FLOW_MARK`` will be added in 19.11.
This will allow application to enable or disable PMDs from updating
``rte_mbuf::hash::fdir``.
struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
int diag;
- int ret;
+ int ret, ret_stop;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
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);
+ ret_stop = rte_eth_dev_stop(port_id);
+ if (ret_stop != 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Failed to stop device (port %u): %s\n",
+ port_id, rte_strerror(-ret_stop));
+ }
+
return ret;
}
return 0;
}
-void
+int
rte_eth_dev_stop(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->dev_stop);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_stop, -ENOTSUP);
if (dev->data->dev_started == 0) {
RTE_ETHDEV_LOG(INFO,
"Device with port_id=%"PRIu16" already stopped\n",
port_id);
- return;
+ return 0;
}
dev->data->dev_started = 0;
(*dev->dev_ops->dev_stop)(dev);
rte_ethdev_trace_stop(port_id);
+
+ return 0;
}
int
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, -ENOTSUP);
- rte_eth_dev_stop(port_id);
+ ret = rte_eth_dev_stop(port_id);
+ if (ret != 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Failed to stop device (port %u) before reset: %s - ignore\n",
+ port_id, rte_strerror(-ret));
+ }
ret = dev->dev_ops->dev_reset(dev);
return eth_err(port_id, ret);
*
* @param port_id
* The port identifier of the Ethernet device.
+ * @return
+ * - 0: Success, Ethernet device stopped.
+ * - <0: Error code of the driver device stop function.
*/
-void rte_eth_dev_stop(uint16_t port_id);
+int rte_eth_dev_stop(uint16_t port_id);
/**
* Link up an Ethernet device.