[dpdk-dev,v4,3/3] ethdev: fix wrong error return refer to API definition

Message ID 1414129180-17669-4-git-send-email-cunming.liang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Cunming Liang Oct. 24, 2014, 5:39 a.m. UTC
  Per definition, rte_eth_rx_burst/rte_eth_tx_burst/rte_eth_rx_queue_count returns the packet number.
When RTE_LIBRTE_ETHDEV_DEBUG turns on, retval of FUNC_PTR_OR_ERR_RTE was set to -ENOTSUP.
It makes confusing.
The patch always return 0 no matter no packet or there's error.
Meanwhile set errno in such kind of checking.

Signed-off-by: Cunming Liang <cunming.liang@intel.com>
---
 lib/librte_ether/rte_ethdev.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 50f10d9..922a0c6 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2530,7 +2530,7 @@  rte_eth_rx_burst(uint8_t port_id, uint16_t queue_id,
 		return 0;
 	}
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, -ENOTSUP);
+	FUNC_PTR_OR_ERR_RET(*dev->rx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_rx_queues) {
 		PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", queue_id);
 		return 0;
@@ -2551,7 +2551,7 @@  rte_eth_tx_burst(uint8_t port_id, uint16_t queue_id,
 	}
 	dev = &rte_eth_devices[port_id];
 
-	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, -ENOTSUP);
+	FUNC_PTR_OR_ERR_RET(*dev->tx_pkt_burst, 0);
 	if (queue_id >= dev->data->nb_tx_queues) {
 		PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", queue_id);
 		return 0;
@@ -2570,7 +2570,7 @@  rte_eth_rx_queue_count(uint8_t port_id, uint16_t queue_id)
 		return 0;
 	}
 	dev = &rte_eth_devices[port_id];
-	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, -ENOTSUP);
+	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_count, 0);
 	return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
 }