[dpdk-dev] ethdev: stop overriding rx_nombuf by rte_eth_stats_get
Checks
Commit Message
rte_eth_stats_get() unconditonally would set rx_nombuf
even if the device was setting the value. A check has
been added in rte_eth_stats_get() to leave the device
value in-tact when non-zero.
Signed-off-by: David Harton <dharton@cisco.com>
---
lib/librte_ether/rte_ethdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -1336,8 +1336,11 @@ struct rte_eth_dev *
memset(stats, 0, sizeof(*stats));
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
- stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
(*dev->dev_ops->stats_get)(dev, stats);
+ /* only set rx_nombuf if not set by the device */
+ if (!stats->rx_nombuf) {
+ stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
+ }
return 0;
}