ethdev: change xstats reset function to return int

Change rte_eth_xstats_reset() return value from void to int and
return negative errno values in case of error conditions.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Igor Romanov 2019-09-06 15:34:53 +01:00 committed by Ferruh Yigit
parent f430bbcecf
commit da328f7f11
6 changed files with 29 additions and 8 deletions

View File

@ -580,8 +580,16 @@ nic_xstats_display(uint16_t port_id)
static void
nic_xstats_clear(uint16_t port_id)
{
int ret;
printf("\n Clearing NIC xstats for port %d\n", port_id);
rte_eth_xstats_reset(port_id);
ret = rte_eth_xstats_reset(port_id);
if (ret != 0) {
printf("\n Error clearing xstats for port %d: %s\n", port_id,
strerror(-ret));
return;
}
printf("\n NIC extended statistics for port %d cleared\n", port_id);
}

View File

@ -273,7 +273,13 @@ nic_xstats_display(portid_t port_id)
void
nic_xstats_clear(portid_t port_id)
{
rte_eth_xstats_reset(port_id);
int ret;
ret = rte_eth_xstats_reset(port_id);
if (ret != 0) {
printf("%s: Error: failed to reset xstats (port %u): %s",
__func__, port_id, strerror(ret));
}
}
void

View File

@ -92,7 +92,6 @@ Deprecation Notices
- ``rte_eth_link_get`` and ``rte_eth_link_get_nowait``
- ``rte_eth_dev_stop``
- ``rte_eth_dev_close``
- ``rte_eth_xstats_reset``
- ``rte_eth_macaddr_get``
- ``rte_eth_dev_owner_delete``

View File

@ -130,6 +130,9 @@ API Changes
``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to
provide a way to report various error conditions.
* ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to
``int`` to provide a way to report various error conditions.
ABI Changes
-----------

View File

@ -2520,22 +2520,22 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,
}
/* reset ethdev extended statistics */
void
int
rte_eth_xstats_reset(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];
/* implemented by the driver */
if (dev->dev_ops->xstats_reset != NULL) {
(*dev->dev_ops->xstats_reset)(dev);
return;
return 0;
}
/* fallback to default */
rte_eth_stats_reset(port_id);
return rte_eth_stats_reset(port_id);
}
static int

View File

@ -2284,8 +2284,13 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
*
* @param port_id
* The port identifier of the Ethernet device.
* @return
* - (0) if device notified to reset extended stats.
* - (-ENOTSUP) if pmd doesn't support both
* extended stats and basic stats reset.
* - (-ENODEV) if *port_id* invalid.
*/
void rte_eth_xstats_reset(uint16_t port_id);
int rte_eth_xstats_reset(uint16_t port_id);
/**
* Set a mapping for the specified transmit queue to the specified per-queue