Use ENODEV as the error code if specified port ID is invalid.
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
int ret = 0;
ret = rte_stats_bitrate_calc(bitrate_data, 33);
- TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for higher "
- "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+ TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for higher "
+ "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret);
return TEST_SUCCESS;
}
int ret = 0;
ret = rte_stats_bitrate_calc(bitrate_data, -1);
- TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for invalid "
- "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+ TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for invalid "
+ "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret);
return TEST_SUCCESS;
}
int ret = 0;
ret = rte_stats_bitrate_calc(bitrate_data, 31);
- TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for "
+ TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for "
"non-existing portid rte_stats_bitrate_calc ret:%d",
- EINVAL, ret);
+ ENODEV, ret);
return TEST_SUCCESS;
}
{
char *tmp;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
if (name == NULL) {
RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
struct rte_eth_dev *dev;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (!dev->data->dev_started) {
struct rte_eth_dev *dev;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
struct rte_eth_dev *dev;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (!dev->data->dev_started) {
struct rte_eth_dev *dev;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
int diag;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
int diag;
int ret, ret_stop;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
struct rte_eth_dev *dev;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ 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->dev_reset, -ENOTSUP);
struct rte_eth_rxconf local_conf;
void **rxq;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (rx_queue_id >= dev->data->nb_rx_queues) {
int i;
int count;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (rx_queue_id >= dev->data->nb_rx_queues) {
void **txq;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (tx_queue_id >= dev->data->nb_tx_queues) {
int count;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (tx_queue_id >= dev->data->nb_tx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", tx_queue_id);
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
return dev->data->promiscuous;
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
return dev->data->all_multicast;
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
memset(stats, 0, sizeof(*stats));
struct rte_eth_dev *dev;
int count;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
if (dev->dev_ops->xstats_get_names_by_id != NULL) {
count = (*dev->dev_ops->xstats_get_names_by_id)(dev, NULL,
uint16_t nb_rxqs, nb_txqs;
int ret;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
return -ENOTSUP;
#endif
/* Check input parameters. */
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
if (user_cb == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_rx_queues)
return -EINVAL;
return -ENOTSUP;
#endif
/* Check input parameters. */
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
if (user_cb == NULL ||
queue_id >= rte_eth_devices[port_id].data->nb_tx_queues)
return -EINVAL;
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ 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->hairpin_cap_get, -ENOTSUP);
* @return
* - 0: Success, receive queue correctly set up.
* - -EIO: if device is removed.
+ * - -ENODEV: if *port_id* is invalid.
* - -EINVAL: The memory pool pointer is null or the size of network buffers
* which can be allocated from this memory pool does not fit the various
* buffer sizes allowed by the device controller.
*
* @return
* - (0) if successful.
+ * - (-ENODEV) if *port_id* is invalid.
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
* - (-ENOMEM) if unable to allocate the resources.
*
* @return
* - (0) if successful.
+ * - (-ENODEV) if *port_id* is invalid.
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
* - (-ENOMEM) if unable to allocate the resources.
* to rte_eth_dev_configure().
* @return
* - 0: Success, the receive queue is started.
- * - -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: The queue_id out of range or belong to hairpin.
* - -EIO: if device is removed.
* - -ENOTSUP: The function not supported in PMD driver.
*/
* to rte_eth_dev_configure().
* @return
* - 0: Success, the receive queue is stopped.
- * - -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: The queue_id out of range or belong to hairpin.
* - -EIO: if device is removed.
* - -ENOTSUP: The function not supported in PMD driver.
*/
* to rte_eth_dev_configure().
* @return
* - 0: Success, the transmit queue is started.
- * - -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: The queue_id out of range or belong to hairpin.
* - -EIO: if device is removed.
* - -ENOTSUP: The function not supported in PMD driver.
*/
* to rte_eth_dev_configure().
* @return
* - 0: Success, the transmit queue is stopped.
- * - -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
+ * - -ENODEV: if *port_id* is invalid.
+ * - -EINVAL: The queue_id out of range or belong to hairpin.
* - -EIO: if device is removed.
* - -ENOTSUP: The function not supported in PMD driver.
*/
*
* @return
* - (0) if successful.
- * - (-EINVAL) if port identifier is invalid.
+ * - (-ENODEV) if *port_id* is invalid.
* - (-ENOTSUP) if hardware doesn't support this function.
* - (-EPERM) if not ran from the primary process.
* - (-EIO) if re-initialisation failed or device is removed.
* rte_eth_dev_info_get().
* @return
* - (0) if successful.
+ * - (-ENODEV) if *port_id* is invalid.
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
* - (-EIO) if device is removed.
* rte_eth_dev_info_get().
* @return
* - (0) if successful.
+ * - (-ENODEV) if *port_id* is invalid.
* - (-ENOTSUP) if hardware doesn't support.
* - (-EINVAL) if bad parameter.
* - (-EIO) if device is removed.
*
* @return
* - 0: Success. Callback was removed.
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: Callback support is not available.
- * - -EINVAL: The port_id or the queue_id is out of range, or the callback
+ * - -EINVAL: The queue_id is out of range, or the callback
* is NULL or not found for the port/queue.
*/
int rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
*
* @return
* - 0: Success. Callback was removed.
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: Callback support is not available.
- * - -EINVAL: The port_id or the queue_id is out of range, or the callback
+ * - -EINVAL: The queue_id is out of range, or the callback
* is NULL or not found for the port/queue.
*/
int rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
*
* @return
* - 0: Success
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: routine is not supported by the device PMD.
- * - -EINVAL: The port_id or the queue_id is out of range, or the queue
+ * - -EINVAL: The queue_id is out of range, or the queue
* is hairpin queue.
*/
int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
*
* @return
* - 0: Success
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: routine is not supported by the device PMD.
- * - -EINVAL: The port_id or the queue_id is out of range, or the queue
+ * - -EINVAL: The queue_id is out of range, or the queue
* is hairpin queue.
*/
int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
*
* @return
* - 0: Success
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: routine is not supported by the device PMD.
- * - -EINVAL: The port_id or the queue_id is out of range.
+ * - -EINVAL: The queue_id is out of range.
*/
__rte_experimental
int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
*
* @return
* - 0: Success
+ * - -ENODEV: If *port_id* is invalid.
* - -ENOTSUP: routine is not supported by the device PMD.
- * - -EINVAL: The port_id or the queue_id is out of range.
+ * - -EINVAL: The queue_id is out of range.
*/
__rte_experimental
int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id,
* Buffer of size RTE_ETH_NAME_MAX_LEN to store the name.
* @return
* - (0) if successful.
+* - (-ENODEV) if *port_id* is invalid.
* - (-EINVAL) on failure.
*/
int
* The queue id on the specific port.
* @return
* The number of used descriptors in the specific queue, or:
- * (-EINVAL) if *port_id* or *queue_id* is invalid
+ * - (-ENODEV) if *port_id* is invalid.
+ * (-EINVAL) if *queue_id* is invalid
* (-ENOTSUP) if the device does not support this function
*/
static inline int
{
struct rte_eth_dev *dev;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->rx_queue_count, -ENOTSUP);
if (queue_id >= dev->data->nb_rx_queues ||
* meet devices requirements with rte_errno set appropriately:
* - EINVAL: offload flags are not correctly set
* - ENOTSUP: the offload feature is not supported by the hardware
+ * - ENODEV: if *port_id* is invalid (with debug enabled only)
*
*/
#ifdef RTE_LIBRTE_ETHDEV_DEBUG
if (!rte_eth_dev_is_valid_port(port_id)) {
RTE_ETHDEV_LOG(ERR, "Invalid TX port_id=%u\n", port_id);
- rte_errno = EINVAL;
+ rte_errno = ENODEV;
return 0;
}
#endif