ethdev: make stats and xstats reset callbacks return int

Change return value of the callbacks from void to int. Make
implementations across all drivers return negative errno
values in case of error conditions.

Both callbacks are updated together because a large number of
drivers assign the same function to both callbacks.

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:54 +01:00 committed by Ferruh Yigit
parent da328f7f11
commit 9970a9ad07
63 changed files with 425 additions and 173 deletions

View File

@ -197,7 +197,7 @@ virtual_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
virtual_ethdev_stats_reset(struct rte_eth_dev *dev) virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
{ {
struct virtual_ethdev_private *dev_private = dev->data->dev_private; struct virtual_ethdev_private *dev_private = dev->data->dev_private;
@ -208,6 +208,8 @@ virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
/* Reset internal statistics */ /* Reset internal statistics */
memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats)); memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
return 0;
} }
static int static int

View File

@ -349,7 +349,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned i; unsigned i;
@ -365,6 +365,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
internal->tx_queue[i].err_pkts = 0; internal->tx_queue[i].err_pkts = 0;
internal->tx_queue[i].tx_bytes = 0; internal->tx_queue[i].tx_bytes = 0;
} }
return 0;
} }
static void static void

View File

@ -463,7 +463,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
struct pmd_internals *internals = dev->data->dev_private; struct pmd_internals *internals = dev->data->dev_private;
@ -475,6 +475,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
memset(&internals->tx_queues[i].stats, 0, memset(&internals->tx_queues[i].stats, 0,
sizeof(struct tx_stats)); sizeof(struct tx_stats));
} }
return 0;
} }
static void static void

View File

@ -39,7 +39,7 @@ static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev);
static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev); static int eth_ark_dev_set_link_down(struct rte_eth_dev *dev);
static int eth_ark_dev_stats_get(struct rte_eth_dev *dev, static int eth_ark_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev); static int eth_ark_dev_stats_reset(struct rte_eth_dev *dev);
static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
struct rte_ether_addr *mac_addr); struct rte_ether_addr *mac_addr);
static int eth_ark_macaddr_add(struct rte_eth_dev *dev, static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
@ -813,7 +813,7 @@ eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_ark_dev_stats_reset(struct rte_eth_dev *dev) eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
{ {
uint16_t i; uint16_t i;
@ -826,6 +826,8 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
if (ark->user_ext.stats_reset) if (ark->user_ext.stats_reset)
ark->user_ext.stats_reset(dev, ark->user_ext.stats_reset(dev,
ark->user_data[dev->data->port_id]); ark->user_data[dev->data->port_id]);
return 0;
} }
static int static int

View File

@ -40,7 +40,7 @@ static int atl_dev_stats_get(struct rte_eth_dev *dev,
static int atl_dev_xstats_get(struct rte_eth_dev *dev, static int atl_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *stats, unsigned int n); struct rte_eth_xstat *stats, unsigned int n);
static void atl_dev_stats_reset(struct rte_eth_dev *dev); static int atl_dev_stats_reset(struct rte_eth_dev *dev);
static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
size_t fw_size); size_t fw_size);
@ -975,7 +975,7 @@ atl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
atl_dev_stats_reset(struct rte_eth_dev *dev) atl_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev); struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev);
@ -987,6 +987,8 @@ atl_dev_stats_reset(struct rte_eth_dev *dev)
memset(&hw->curr_stats, 0, sizeof(hw->curr_stats)); memset(&hw->curr_stats, 0, sizeof(hw->curr_stats));
memset(&adapter->sw_stats, 0, sizeof(adapter->sw_stats)); memset(&adapter->sw_stats, 0, sizeof(adapter->sw_stats));
return 0;
} }
static int static int

View File

@ -82,7 +82,7 @@ static void avp_dev_tx_queue_release(void *txq);
static int avp_dev_stats_get(struct rte_eth_dev *dev, static int avp_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void avp_dev_stats_reset(struct rte_eth_dev *dev); static int avp_dev_stats_reset(struct rte_eth_dev *dev);
#define AVP_MAX_RX_BURST 64 #define AVP_MAX_RX_BURST 64
@ -2275,7 +2275,7 @@ avp_dev_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
avp_dev_stats_reset(struct rte_eth_dev *eth_dev) avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@ -2300,6 +2300,8 @@ avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
txq->errors = 0; txq->errors = 0;
} }
} }
return 0;
} }
RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd); RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd);

View File

@ -23,7 +23,7 @@ static int axgbe_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete); int wait_to_complete);
static int axgbe_dev_stats_get(struct rte_eth_dev *dev, static int axgbe_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void axgbe_dev_stats_reset(struct rte_eth_dev *dev); static int axgbe_dev_stats_reset(struct rte_eth_dev *dev);
static int axgbe_dev_info_get(struct rte_eth_dev *dev, static int axgbe_dev_info_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info); struct rte_eth_dev_info *dev_info);
@ -337,7 +337,7 @@ axgbe_dev_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void static int
axgbe_dev_stats_reset(struct rte_eth_dev *dev) axgbe_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct axgbe_rx_queue *rxq; struct axgbe_rx_queue *rxq;
@ -356,6 +356,8 @@ axgbe_dev_stats_reset(struct rte_eth_dev *dev)
txq->bytes = 0; txq->bytes = 0;
txq->errors = 0; txq->errors = 0;
} }
return 0;
} }
static int static int

View File

@ -392,22 +392,25 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
return rc; return rc;
} }
void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev) int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
{ {
struct bnxt *bp = eth_dev->data->dev_private; struct bnxt *bp = eth_dev->data->dev_private;
unsigned int i; unsigned int i;
int ret;
if (!(bp->flags & BNXT_FLAG_INIT_DONE)) { if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
PMD_DRV_LOG(ERR, "Device Initialization not complete!\n"); PMD_DRV_LOG(ERR, "Device Initialization not complete!\n");
return; return -EINVAL;
} }
bnxt_clear_all_hwrm_stat_ctxs(bp); ret = bnxt_clear_all_hwrm_stat_ctxs(bp);
for (i = 0; i < bp->rx_cp_nr_rings; i++) { for (i = 0; i < bp->rx_cp_nr_rings; i++) {
struct bnxt_rx_queue *rxq = bp->rx_queues[i]; struct bnxt_rx_queue *rxq = bp->rx_queues[i];
rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail); rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail);
} }
return ret;
} }
int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
@ -543,19 +546,36 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
return stat_cnt; return stat_cnt;
} }
void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev) int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
{ {
struct bnxt *bp = eth_dev->data->dev_private; struct bnxt *bp = eth_dev->data->dev_private;
int ret;
if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) {
bnxt_hwrm_port_clr_stats(bp); ret = bnxt_hwrm_port_clr_stats(bp);
if (ret != 0) {
PMD_DRV_LOG(ERR, "Operation failed: %s\n",
strerror(-ret));
return ret;
}
}
if (BNXT_VF(bp)) ret = 0;
if (BNXT_VF(bp)) {
PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n"); PMD_DRV_LOG(ERR, "Operation not supported on a VF device\n");
if (!BNXT_SINGLE_PF(bp)) ret = -ENOTSUP;
}
if (!BNXT_SINGLE_PF(bp)) {
PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n"); PMD_DRV_LOG(ERR, "Operation not supported on a MF device\n");
if (!(bp->flags & BNXT_FLAG_PORT_STATS)) ret = -ENOTSUP;
}
if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
PMD_DRV_LOG(ERR, "Operation not supported\n"); PMD_DRV_LOG(ERR, "Operation not supported\n");
ret = -ENOTSUP;
}
return ret;
} }
int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,

View File

@ -11,13 +11,13 @@
void bnxt_free_stats(struct bnxt *bp); void bnxt_free_stats(struct bnxt *bp);
int bnxt_stats_get_op(struct rte_eth_dev *eth_dev, int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *bnxt_stats); struct rte_eth_stats *bnxt_stats);
void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev); int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev);
int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev, int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit); __rte_unused unsigned int limit);
int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev, int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat *xstats, unsigned int n); struct rte_eth_xstat *xstats, unsigned int n);
void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev); int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev);
int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids, int bnxt_dev_xstats_get_by_id_op(struct rte_eth_dev *dev, const uint64_t *ids,
uint64_t *values, unsigned int limit); uint64_t *values, unsigned int limit);
int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev, int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,

View File

@ -2472,14 +2472,21 @@ bond_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
bond_ethdev_stats_reset(struct rte_eth_dev *dev) bond_ethdev_stats_reset(struct rte_eth_dev *dev)
{ {
struct bond_dev_private *internals = dev->data->dev_private; struct bond_dev_private *internals = dev->data->dev_private;
int i; int i;
int err;
int ret;
for (i = 0; i < internals->slave_count; i++) for (i = 0, err = 0; i < internals->slave_count; i++) {
rte_eth_stats_reset(internals->slaves[i].port_id); ret = rte_eth_stats_reset(internals->slaves[i].port_id);
if (ret != 0)
err = ret;
}
return err;
} }
static int static int

View File

@ -724,7 +724,7 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
/* /*
* Reset port statistics. * Reset port statistics.
*/ */
static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev) static int cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct port_info *pi = eth_dev->data->dev_private; struct port_info *pi = eth_dev->data->dev_private;
struct adapter *adapter = pi->adapter; struct adapter *adapter = pi->adapter;
@ -747,6 +747,8 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
txq->stats.tx_bytes = 0; txq->stats.tx_bytes = 0;
txq->stats.mapping_err = 0; txq->stats.mapping_err = 0;
} }
return 0;
} }
static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev, static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,

View File

@ -399,13 +399,15 @@ static int dpaa_eth_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void dpaa_eth_stats_reset(struct rte_eth_dev *dev) static int dpaa_eth_stats_reset(struct rte_eth_dev *dev)
{ {
struct dpaa_if *dpaa_intf = dev->data->dev_private; struct dpaa_if *dpaa_intf = dev->data->dev_private;
PMD_INIT_FUNC_TRACE(); PMD_INIT_FUNC_TRACE();
fman_if_stats_reset(dpaa_intf->fif); fman_if_stats_reset(dpaa_intf->fif);
return 0;
} }
static int static int

View File

@ -1429,12 +1429,12 @@ dpaa2_xstats_get_names_by_id(
return limit; return limit;
} }
static void static int
dpaa2_dev_stats_reset(struct rte_eth_dev *dev) dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct dpaa2_dev_priv *priv = dev->data->dev_private; struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw;
int32_t retcode; int retcode;
int i; int i;
struct dpaa2_queue *dpaa2_q; struct dpaa2_queue *dpaa2_q;
@ -1442,7 +1442,7 @@ dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
if (dpni == NULL) { if (dpni == NULL) {
DPAA2_PMD_ERR("dpni is NULL"); DPAA2_PMD_ERR("dpni is NULL");
return; return -EINVAL;
} }
retcode = dpni_reset_statistics(dpni, CMD_PRI_LOW, priv->token); retcode = dpni_reset_statistics(dpni, CMD_PRI_LOW, priv->token);
@ -1462,11 +1462,11 @@ dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
dpaa2_q->tx_pkts = 0; dpaa2_q->tx_pkts = 0;
} }
return; return 0;
error: error:
DPAA2_PMD_ERR("Operation not completed:Error Code = %d", retcode); DPAA2_PMD_ERR("Operation not completed:Error Code = %d", retcode);
return; return retcode;
}; };
/* return 0 means link status changed, -1 means not changed */ /* return 0 means link status changed, -1 means not changed */

View File

@ -43,7 +43,7 @@ static int eth_em_link_update(struct rte_eth_dev *dev,
int wait_to_complete); int wait_to_complete);
static int eth_em_stats_get(struct rte_eth_dev *dev, static int eth_em_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *rte_stats); struct rte_eth_stats *rte_stats);
static void eth_em_stats_reset(struct rte_eth_dev *dev); static int eth_em_stats_reset(struct rte_eth_dev *dev);
static int eth_em_infos_get(struct rte_eth_dev *dev, static int eth_em_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info); struct rte_eth_dev_info *dev_info);
static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev, static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
@ -984,7 +984,7 @@ eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
return 0; return 0;
} }
static void static int
eth_em_stats_reset(struct rte_eth_dev *dev) eth_em_stats_reset(struct rte_eth_dev *dev)
{ {
struct e1000_hw_stats *hw_stats = struct e1000_hw_stats *hw_stats =
@ -995,6 +995,8 @@ eth_em_stats_reset(struct rte_eth_dev *dev)
/* Reset software totals */ /* Reset software totals */
memset(hw_stats, 0, sizeof(*hw_stats)); memset(hw_stats, 0, sizeof(*hw_stats));
return 0;
} }
static int static int

View File

@ -98,8 +98,8 @@ static int eth_igb_xstats_get_names(struct rte_eth_dev *dev,
static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev, static int eth_igb_xstats_get_names_by_id(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
unsigned int limit); unsigned int limit);
static void eth_igb_stats_reset(struct rte_eth_dev *dev); static int eth_igb_stats_reset(struct rte_eth_dev *dev);
static void eth_igb_xstats_reset(struct rte_eth_dev *dev); static int eth_igb_xstats_reset(struct rte_eth_dev *dev);
static int eth_igb_fw_version_get(struct rte_eth_dev *dev, static int eth_igb_fw_version_get(struct rte_eth_dev *dev,
char *fw_version, size_t fw_size); char *fw_version, size_t fw_size);
static int eth_igb_infos_get(struct rte_eth_dev *dev, static int eth_igb_infos_get(struct rte_eth_dev *dev,
@ -168,7 +168,7 @@ static int eth_igbvf_xstats_get(struct rte_eth_dev *dev,
static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev, static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned limit); unsigned limit);
static void eth_igbvf_stats_reset(struct rte_eth_dev *dev); static int eth_igbvf_stats_reset(struct rte_eth_dev *dev);
static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, static int igbvf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on); uint16_t vlan_id, int on);
static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);
@ -1870,7 +1870,7 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
return 0; return 0;
} }
static void static int
eth_igb_stats_reset(struct rte_eth_dev *dev) eth_igb_stats_reset(struct rte_eth_dev *dev)
{ {
struct e1000_hw_stats *hw_stats = struct e1000_hw_stats *hw_stats =
@ -1881,9 +1881,11 @@ eth_igb_stats_reset(struct rte_eth_dev *dev)
/* Reset software totals */ /* Reset software totals */
memset(hw_stats, 0, sizeof(*hw_stats)); memset(hw_stats, 0, sizeof(*hw_stats));
return 0;
} }
static void static int
eth_igb_xstats_reset(struct rte_eth_dev *dev) eth_igb_xstats_reset(struct rte_eth_dev *dev)
{ {
struct e1000_hw_stats *stats = struct e1000_hw_stats *stats =
@ -1894,6 +1896,8 @@ eth_igb_xstats_reset(struct rte_eth_dev *dev)
/* Reset software totals */ /* Reset software totals */
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
return 0;
} }
static int eth_igb_xstats_get_names(__rte_unused struct rte_eth_dev *dev, static int eth_igb_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
@ -2127,7 +2131,7 @@ eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
return 0; return 0;
} }
static void static int
eth_igbvf_stats_reset(struct rte_eth_dev *dev) eth_igbvf_stats_reset(struct rte_eth_dev *dev)
{ {
struct e1000_vf_stats *hw_stats = (struct e1000_vf_stats*) struct e1000_vf_stats *hw_stats = (struct e1000_vf_stats*)
@ -2139,6 +2143,8 @@ eth_igbvf_stats_reset(struct rte_eth_dev *dev)
/* reset HW current stats*/ /* reset HW current stats*/
memset(&hw_stats->gprc, 0, sizeof(*hw_stats) - memset(&hw_stats->gprc, 0, sizeof(*hw_stats) -
offsetof(struct e1000_vf_stats, gprc)); offsetof(struct e1000_vf_stats, gprc));
return 0;
} }
static int static int

View File

@ -492,7 +492,7 @@ int enetc_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void static int
enetc_stats_reset(struct rte_eth_dev *dev) enetc_stats_reset(struct rte_eth_dev *dev)
{ {
struct enetc_eth_hw *hw = struct enetc_eth_hw *hw =
@ -500,6 +500,8 @@ enetc_stats_reset(struct rte_eth_dev *dev)
struct enetc_hw *enetc_hw = &hw->hw; struct enetc_hw *enetc_hw = &hw->hw;
enetc_port_wr(enetc_hw, ENETC_PM0_STAT_CONFIG, ENETC_CLEAR_STATS); enetc_port_wr(enetc_hw, ENETC_PM0_STAT_CONFIG, ENETC_CLEAR_STATS);
return 0;
} }
static void static void

View File

@ -304,7 +304,7 @@ void enic_remove(struct enic *enic);
int enic_get_link_status(struct enic *enic); int enic_get_link_status(struct enic *enic);
int enic_dev_stats_get(struct enic *enic, int enic_dev_stats_get(struct enic *enic,
struct rte_eth_stats *r_stats); struct rte_eth_stats *r_stats);
void enic_dev_stats_clear(struct enic *enic); int enic_dev_stats_clear(struct enic *enic);
int enic_add_packet_filter(struct enic *enic); int enic_add_packet_filter(struct enic *enic);
int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr); int enic_set_mac_address(struct enic *enic, uint8_t *mac_addr);
int enic_del_mac_address(struct enic *enic, int mac_index); int enic_del_mac_address(struct enic *enic, int mac_index);

View File

@ -474,12 +474,12 @@ static int enicpmd_dev_stats_get(struct rte_eth_dev *eth_dev,
return enic_dev_stats_get(enic, stats); return enic_dev_stats_get(enic, stats);
} }
static void enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev) static int enicpmd_dev_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct enic *enic = pmd_priv(eth_dev); struct enic *enic = pmd_priv(eth_dev);
ENICPMD_FUNC_TRACE(); ENICPMD_FUNC_TRACE();
enic_dev_stats_clear(enic); return enic_dev_stats_clear(enic);
} }
static uint32_t speed_capa_from_pci_id(struct rte_eth_dev *eth_dev) static uint32_t speed_capa_from_pci_id(struct rte_eth_dev *eth_dev)

View File

@ -115,11 +115,18 @@ static void enic_init_soft_stats(struct enic *enic)
enic_clear_soft_stats(enic); enic_clear_soft_stats(enic);
} }
void enic_dev_stats_clear(struct enic *enic) int enic_dev_stats_clear(struct enic *enic)
{ {
if (vnic_dev_stats_clear(enic->vdev)) int ret;
ret = vnic_dev_stats_clear(enic->vdev);
if (ret != 0) {
dev_err(enic, "Error in clearing stats\n"); dev_err(enic, "Error in clearing stats\n");
return ret;
}
enic_clear_soft_stats(enic); enic_clear_soft_stats(enic);
return 0;
} }
int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats) int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)

View File

@ -814,19 +814,31 @@ fs_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void static int
fs_stats_reset(struct rte_eth_dev *dev) fs_stats_reset(struct rte_eth_dev *dev)
{ {
struct sub_device *sdev; struct sub_device *sdev;
uint8_t i; uint8_t i;
int ret;
fs_lock(dev, 0); fs_lock(dev, 0);
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
rte_eth_stats_reset(PORT_ID(sdev)); ret = rte_eth_stats_reset(PORT_ID(sdev));
if (ret) {
if (!fs_err(sdev, ret))
continue;
ERROR("Operation rte_eth_stats_reset failed for sub_device %d with error %d",
i, ret);
fs_unlock(dev, 0);
return ret;
}
memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats)); memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats));
} }
memset(&PRIV(dev)->stats_accumulator, 0, sizeof(struct rte_eth_stats)); memset(&PRIV(dev)->stats_accumulator, 0, sizeof(struct rte_eth_stats));
fs_unlock(dev, 0); fs_unlock(dev, 0);
return 0;
} }
static void static void

View File

@ -1355,7 +1355,7 @@ fm10k_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
fm10k_stats_reset(struct rte_eth_dev *dev) fm10k_stats_reset(struct rte_eth_dev *dev)
{ {
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@ -1366,6 +1366,8 @@ fm10k_stats_reset(struct rte_eth_dev *dev)
memset(hw_stats, 0, sizeof(*hw_stats)); memset(hw_stats, 0, sizeof(*hw_stats));
fm10k_rebind_hw_stats(hw, hw_stats); fm10k_rebind_hw_stats(hw, hw_stats);
return 0;
} }
static int static int
@ -3114,7 +3116,11 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
} }
/* Reset the hw statistics */ /* Reset the hw statistics */
fm10k_stats_reset(dev); diag = fm10k_stats_reset(dev);
if (diag != 0) {
PMD_INIT_LOG(ERR, "Stats reset failed: %d", diag);
return diag;
}
/* Reset the hw */ /* Reset the hw */
diag = fm10k_reset_hw(hw); diag = fm10k_reset_hw(hw);

View File

@ -1131,7 +1131,7 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode)
return 0; return 0;
} }
void hinic_clear_vport_stats(struct hinic_hwdev *hwdev) int hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
{ {
struct hinic_clear_vport_stats clear_vport_stats; struct hinic_clear_vport_stats clear_vport_stats;
u16 out_size = sizeof(clear_vport_stats); u16 out_size = sizeof(clear_vport_stats);
@ -1139,7 +1139,7 @@ void hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
if (!hwdev) { if (!hwdev) {
PMD_DRV_LOG(ERR, "Hwdev is NULL"); PMD_DRV_LOG(ERR, "Hwdev is NULL");
return; return -EINVAL;
} }
memset(&clear_vport_stats, 0, sizeof(clear_vport_stats)); memset(&clear_vport_stats, 0, sizeof(clear_vport_stats));
@ -1153,10 +1153,13 @@ void hinic_clear_vport_stats(struct hinic_hwdev *hwdev)
if (err || !out_size || clear_vport_stats.mgmt_msg_head.status) { if (err || !out_size || clear_vport_stats.mgmt_msg_head.status) {
PMD_DRV_LOG(ERR, "Failed to clear vport statistics, err: %d, status: 0x%x, out size: 0x%x", PMD_DRV_LOG(ERR, "Failed to clear vport statistics, err: %d, status: 0x%x, out size: 0x%x",
err, clear_vport_stats.mgmt_msg_head.status, out_size); err, clear_vport_stats.mgmt_msg_head.status, out_size);
return -EINVAL;
} }
return 0;
} }
void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev) int hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
{ {
struct hinic_clear_port_stats clear_phy_port_stats; struct hinic_clear_port_stats clear_phy_port_stats;
u16 out_size = sizeof(clear_phy_port_stats); u16 out_size = sizeof(clear_phy_port_stats);
@ -1164,7 +1167,7 @@ void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
if (!hwdev) { if (!hwdev) {
PMD_DRV_LOG(ERR, "Hwdev is NULL"); PMD_DRV_LOG(ERR, "Hwdev is NULL");
return; return -EINVAL;
} }
memset(&clear_phy_port_stats, 0, sizeof(clear_phy_port_stats)); memset(&clear_phy_port_stats, 0, sizeof(clear_phy_port_stats));
@ -1180,7 +1183,10 @@ void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev)
PMD_DRV_LOG(ERR, "Failed to clear phy port statistics, err: %d, status: 0x%x, out size: 0x%x", PMD_DRV_LOG(ERR, "Failed to clear phy port statistics, err: %d, status: 0x%x, out size: 0x%x",
err, clear_phy_port_stats.mgmt_msg_head.status, err, clear_phy_port_stats.mgmt_msg_head.status,
out_size); out_size);
return -EINVAL;
} }
return 0;
} }
int hinic_set_link_status_follow(void *hwdev, int hinic_set_link_status_follow(void *hwdev,

View File

@ -651,8 +651,8 @@ int hinic_set_fast_recycle_mode(void *hwdev, u8 mode);
int hinic_get_base_qpn(void *hwdev, u16 *global_qpn); int hinic_get_base_qpn(void *hwdev, u16 *global_qpn);
void hinic_clear_vport_stats(struct hinic_hwdev *hwdev); int hinic_clear_vport_stats(struct hinic_hwdev *hwdev);
void hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev); int hinic_clear_phy_port_stats(struct hinic_hwdev *hwdev);
#endif /* _HINIC_PMD_NICCFG_H_ */ #endif /* _HINIC_PMD_NICCFG_H_ */

View File

@ -1203,14 +1203,17 @@ hinic_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*/ */
static void hinic_dev_stats_reset(struct rte_eth_dev *dev) static int hinic_dev_stats_reset(struct rte_eth_dev *dev)
{ {
int qid; int qid;
struct hinic_rxq *rxq = NULL; struct hinic_rxq *rxq = NULL;
struct hinic_txq *txq = NULL; struct hinic_txq *txq = NULL;
struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
int ret;
hinic_clear_vport_stats(nic_dev->hwdev); ret = hinic_clear_vport_stats(nic_dev->hwdev);
if (ret != 0)
return ret;
for (qid = 0; qid < nic_dev->num_rq; qid++) { for (qid = 0; qid < nic_dev->num_rq; qid++) {
rxq = nic_dev->rxqs[qid]; rxq = nic_dev->rxqs[qid];
@ -1221,6 +1224,8 @@ static void hinic_dev_stats_reset(struct rte_eth_dev *dev)
txq = nic_dev->txqs[qid]; txq = nic_dev->txqs[qid];
hinic_txq_stats_reset(txq); hinic_txq_stats_reset(txq);
} }
return 0;
} }
/** /**
@ -1229,14 +1234,22 @@ static void hinic_dev_stats_reset(struct rte_eth_dev *dev)
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
**/ **/
static void hinic_dev_xstats_reset(struct rte_eth_dev *dev) static int hinic_dev_xstats_reset(struct rte_eth_dev *dev)
{ {
struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
int ret;
hinic_dev_stats_reset(dev); ret = hinic_dev_stats_reset(dev);
if (ret != 0)
return ret;
if (hinic_func_type(nic_dev->hwdev) != TYPE_VF) if (hinic_func_type(nic_dev->hwdev) != TYPE_VF) {
hinic_clear_phy_port_stats(nic_dev->hwdev); ret = hinic_clear_phy_port_stats(nic_dev->hwdev);
if (ret != 0)
return ret;
}
return 0;
} }
static void hinic_gen_random_mac_addr(struct rte_ether_addr *mac_addr) static void hinic_gen_random_mac_addr(struct rte_ether_addr *mac_addr)

View File

@ -236,7 +236,7 @@ static int i40e_dev_xstats_get(struct rte_eth_dev *dev,
static int i40e_dev_xstats_get_names(struct rte_eth_dev *dev, static int i40e_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned limit); unsigned limit);
static void i40e_dev_stats_reset(struct rte_eth_dev *dev); static int i40e_dev_stats_reset(struct rte_eth_dev *dev);
static int i40e_fw_version_get(struct rte_eth_dev *dev, static int i40e_fw_version_get(struct rte_eth_dev *dev,
char *fw_version, size_t fw_size); char *fw_version, size_t fw_size);
static int i40e_dev_info_get(struct rte_eth_dev *dev, static int i40e_dev_info_get(struct rte_eth_dev *dev,
@ -3313,7 +3313,7 @@ i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
} }
/* Reset the statistics */ /* Reset the statistics */
static void static int
i40e_dev_stats_reset(struct rte_eth_dev *dev) i40e_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@ -3326,6 +3326,8 @@ i40e_dev_stats_reset(struct rte_eth_dev *dev)
/* read the stats, reading current register values into offset */ /* read the stats, reading current register values into offset */
i40e_read_stats_registers(pf, hw); i40e_read_stats_registers(pf, hw);
return 0;
} }
static uint32_t static uint32_t

View File

@ -86,7 +86,7 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev,
static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev, static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned limit); unsigned limit);
static void i40evf_dev_xstats_reset(struct rte_eth_dev *dev); static int i40evf_dev_xstats_reset(struct rte_eth_dev *dev);
static int i40evf_vlan_filter_set(struct rte_eth_dev *dev, static int i40evf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on); uint16_t vlan_id, int on);
static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
@ -950,7 +950,7 @@ i40evf_update_stats(struct i40e_vsi *vsi,
i40evf_stat_update_32(&oes->tx_discards, &nes->tx_discards); i40evf_stat_update_32(&oes->tx_discards, &nes->tx_discards);
} }
static void static int
i40evf_dev_xstats_reset(struct rte_eth_dev *dev) i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
{ {
int ret; int ret;
@ -963,6 +963,8 @@ i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
/* set stats offset base on current values */ /* set stats offset base on current values */
if (ret == 0) if (ret == 0)
vf->vsi.eth_stats_offset = *pstats; vf->vsi.eth_stats_offset = *pstats;
return ret;
} }
static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,

View File

@ -264,12 +264,12 @@ i40e_vf_representor_stats_get(struct rte_eth_dev *ethdev,
return ret; return ret;
} }
static void static int
i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev) i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
{ {
struct i40e_vf_representor *representor = ethdev->data->dev_private; struct i40e_vf_representor *representor = ethdev->data->dev_private;
rte_pmd_i40e_get_vf_native_stats( return rte_pmd_i40e_get_vf_native_stats(
representor->adapter->eth_dev->data->port_id, representor->adapter->eth_dev->data->port_id,
representor->vf_id, &representor->stats_offset); representor->vf_id, &representor->stats_offset);
} }

View File

@ -42,7 +42,7 @@ static int iavf_dev_info_get(struct rte_eth_dev *dev,
static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
static int iavf_dev_stats_get(struct rte_eth_dev *dev, static int iavf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void iavf_dev_stats_reset(struct rte_eth_dev *dev); static int iavf_dev_stats_reset(struct rte_eth_dev *dev);
static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev); static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev); static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
@ -1065,7 +1065,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return -EIO; return -EIO;
} }
static void static int
iavf_dev_stats_reset(struct rte_eth_dev *dev) iavf_dev_stats_reset(struct rte_eth_dev *dev)
{ {
int ret; int ret;
@ -1077,10 +1077,13 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
/* read stat values to clear hardware registers */ /* read stat values to clear hardware registers */
ret = iavf_query_stats(adapter, &pstats); ret = iavf_query_stats(adapter, &pstats);
if (ret != 0)
return ret;
/* set stats offset base on current values */ /* set stats offset base on current values */
if (ret == 0) vsi->eth_stats_offset = *pstats;
vsi->eth_stats_offset = *pstats;
return 0;
} }
static int static int

View File

@ -94,7 +94,7 @@ static int ice_get_eeprom(struct rte_eth_dev *dev,
struct rte_dev_eeprom_info *eeprom); struct rte_dev_eeprom_info *eeprom);
static int ice_stats_get(struct rte_eth_dev *dev, static int ice_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void ice_stats_reset(struct rte_eth_dev *dev); static int ice_stats_reset(struct rte_eth_dev *dev);
static int ice_xstats_get(struct rte_eth_dev *dev, static int ice_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, unsigned int n); struct rte_eth_xstat *xstats, unsigned int n);
static int ice_xstats_get_names(struct rte_eth_dev *dev, static int ice_xstats_get_names(struct rte_eth_dev *dev,
@ -3750,7 +3750,7 @@ ice_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
} }
/* Reset the statistics */ /* Reset the statistics */
static void static int
ice_stats_reset(struct rte_eth_dev *dev) ice_stats_reset(struct rte_eth_dev *dev)
{ {
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
@ -3763,6 +3763,8 @@ ice_stats_reset(struct rte_eth_dev *dev)
/* read the stats, reading current register values into offset */ /* read the stats, reading current register values into offset */
ice_read_stats_registers(pf, hw); ice_read_stats_registers(pf, hw);
return 0;
} }
static uint32_t static uint32_t

View File

@ -2047,7 +2047,7 @@ uint16_t port_id)
0); 0);
} }
static void static int
ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev) ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
{ {
uint16_t port_id = 0; uint16_t port_id = 0;
@ -2058,18 +2058,18 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
if (!ethdev) { if (!ethdev) {
IPN3KE_AFU_PMD_ERR("ethernet device to reset is NULL!"); IPN3KE_AFU_PMD_ERR("ethernet device to reset is NULL!");
return; return -EINVAL;
} }
afu_dev = RTE_ETH_DEV_TO_AFU(ethdev); afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
if (!afu_dev) { if (!afu_dev) {
IPN3KE_AFU_PMD_ERR("afu device to reset is NULL!"); IPN3KE_AFU_PMD_ERR("afu device to reset is NULL!");
return; return -EINVAL;
} }
if (!afu_dev->shared.data) { if (!afu_dev->shared.data) {
IPN3KE_AFU_PMD_ERR("hardware data to reset is NULL!"); IPN3KE_AFU_PMD_ERR("hardware data to reset is NULL!");
return; return -EINVAL;
} }
hw = afu_dev->shared.data; hw = afu_dev->shared.data;
@ -2077,7 +2077,7 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
ch = ethdev->data->name; ch = ethdev->data->name;
if (!ch) { if (!ch) {
IPN3KE_AFU_PMD_ERR("ethdev name is NULL!"); IPN3KE_AFU_PMD_ERR("ethdev name is NULL!");
return; return -EINVAL;
} }
while (ch) { while (ch) {
if (*ch == '_') if (*ch == '_')
@ -2088,7 +2088,7 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
} }
if (!ch) { if (!ch) {
IPN3KE_AFU_PMD_ERR("Can not get port_id from ethdev name!"); IPN3KE_AFU_PMD_ERR("Can not get port_id from ethdev name!");
return; return -EINVAL;
} }
port_id = atoi(ch); port_id = atoi(ch);
@ -2104,6 +2104,8 @@ ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
ipn3ke_rpst_10g_lineside_tx_stats_reset(hw, port_id); ipn3ke_rpst_10g_lineside_tx_stats_reset(hw, port_id);
ipn3ke_rpst_10g_lineside_rx_stats_reset(hw, port_id); ipn3ke_rpst_10g_lineside_rx_stats_reset(hw, port_id);
} }
return 0;
} }
static int static int

View File

@ -164,8 +164,8 @@ static int ixgbevf_dev_xstats_get(struct rte_eth_dev *dev,
static int static int
ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
uint64_t *values, unsigned int n); uint64_t *values, unsigned int n);
static void ixgbe_dev_stats_reset(struct rte_eth_dev *dev); static int ixgbe_dev_stats_reset(struct rte_eth_dev *dev);
static void ixgbe_dev_xstats_reset(struct rte_eth_dev *dev); static int ixgbe_dev_xstats_reset(struct rte_eth_dev *dev);
static int ixgbe_dev_xstats_get_names(struct rte_eth_dev *dev, static int ixgbe_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned int size); unsigned int size);
@ -255,7 +255,7 @@ static void ixgbevf_intr_disable(struct rte_eth_dev *dev);
static void ixgbevf_intr_enable(struct rte_eth_dev *dev); static void ixgbevf_intr_enable(struct rte_eth_dev *dev);
static int ixgbevf_dev_stats_get(struct rte_eth_dev *dev, static int ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void ixgbevf_dev_stats_reset(struct rte_eth_dev *dev); static int ixgbevf_dev_stats_reset(struct rte_eth_dev *dev);
static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on); uint16_t vlan_id, int on);
static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev,
@ -3317,7 +3317,7 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
ixgbe_dev_stats_reset(struct rte_eth_dev *dev) ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct ixgbe_hw_stats *stats = struct ixgbe_hw_stats *stats =
@ -3328,6 +3328,8 @@ ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
/* Reset software totals */ /* Reset software totals */
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
return 0;
} }
/* This function calculates the number of xstats based on the current config */ /* This function calculates the number of xstats based on the current config */
@ -3649,7 +3651,7 @@ ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
return n; return n;
} }
static void static int
ixgbe_dev_xstats_reset(struct rte_eth_dev *dev) ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
{ {
struct ixgbe_hw_stats *stats = struct ixgbe_hw_stats *stats =
@ -3666,6 +3668,8 @@ ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
/* Reset software totals */ /* Reset software totals */
memset(stats, 0, sizeof(*stats)); memset(stats, 0, sizeof(*stats));
memset(macsec_stats, 0, sizeof(*macsec_stats)); memset(macsec_stats, 0, sizeof(*macsec_stats));
return 0;
} }
static void static void
@ -3740,7 +3744,7 @@ ixgbevf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
ixgbevf_dev_stats_reset(struct rte_eth_dev *dev) ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *) struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
@ -3754,6 +3758,8 @@ ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
hw_stats->vfgorc = 0; hw_stats->vfgorc = 0;
hw_stats->vfgptc = 0; hw_stats->vfgptc = 0;
hw_stats->vfgotc = 0; hw_stats->vfgotc = 0;
return 0;
} }
static int static int

View File

@ -318,7 +318,7 @@ eth_kni_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_kni_stats_reset(struct rte_eth_dev *dev) eth_kni_stats_reset(struct rte_eth_dev *dev)
{ {
struct rte_eth_dev_data *data = dev->data; struct rte_eth_dev_data *data = dev->data;
@ -335,6 +335,8 @@ eth_kni_stats_reset(struct rte_eth_dev *dev)
q->tx.pkts = 0; q->tx.pkts = 0;
q->tx.bytes = 0; q->tx.bytes = 0;
} }
return 0;
} }
static const struct eth_dev_ops eth_kni_ops = { static const struct eth_dev_ops eth_kni_ops = {

View File

@ -243,17 +243,18 @@ lio_dev_xstats_get_names(struct rte_eth_dev *eth_dev,
} }
/* Reset hw stats for the port */ /* Reset hw stats for the port */
static void static int
lio_dev_xstats_reset(struct rte_eth_dev *eth_dev) lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
{ {
struct lio_device *lio_dev = LIO_DEV(eth_dev); struct lio_device *lio_dev = LIO_DEV(eth_dev);
struct lio_dev_ctrl_cmd ctrl_cmd; struct lio_dev_ctrl_cmd ctrl_cmd;
struct lio_ctrl_pkt ctrl_pkt; struct lio_ctrl_pkt ctrl_pkt;
int ret;
if (!lio_dev->intf_open) { if (!lio_dev->intf_open) {
lio_dev_err(lio_dev, "Port %d down\n", lio_dev_err(lio_dev, "Port %d down\n",
lio_dev->port_id); lio_dev->port_id);
return; return -EINVAL;
} }
/* flush added to prevent cmd failure /* flush added to prevent cmd failure
@ -270,19 +271,21 @@ lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
ctrl_pkt.ncmd.s.cmd = LIO_CMD_CLEAR_STATS; ctrl_pkt.ncmd.s.cmd = LIO_CMD_CLEAR_STATS;
ctrl_pkt.ctrl_cmd = &ctrl_cmd; ctrl_pkt.ctrl_cmd = &ctrl_cmd;
if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) { ret = lio_send_ctrl_pkt(lio_dev, &ctrl_pkt);
if (ret != 0) {
lio_dev_err(lio_dev, "Failed to send clear stats command\n"); lio_dev_err(lio_dev, "Failed to send clear stats command\n");
return; return ret;
} }
if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) { ret = lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd);
if (ret != 0) {
lio_dev_err(lio_dev, "Clear stats command timed out\n"); lio_dev_err(lio_dev, "Clear stats command timed out\n");
return; return ret;
} }
/* clear stored per queue stats */ /* clear stored per queue stats */
RTE_FUNC_PTR_OR_RET(*eth_dev->dev_ops->stats_reset); RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
(*eth_dev->dev_ops->stats_reset)(eth_dev); return (*eth_dev->dev_ops->stats_reset)(eth_dev);
} }
/* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */ /* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */
@ -338,7 +341,7 @@ lio_dev_stats_get(struct rte_eth_dev *eth_dev,
return 0; return 0;
} }
static void static int
lio_dev_stats_reset(struct rte_eth_dev *eth_dev) lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct lio_device *lio_dev = LIO_DEV(eth_dev); struct lio_device *lio_dev = LIO_DEV(eth_dev);
@ -365,6 +368,8 @@ lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
memset(oq_stats, 0, sizeof(struct lio_droq_stats)); memset(oq_stats, 0, sizeof(struct lio_droq_stats));
} }
} }
return 0;
} }
static int static int

View File

@ -968,7 +968,7 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
memif_stats_reset(struct rte_eth_dev *dev) memif_stats_reset(struct rte_eth_dev *dev)
{ {
struct pmd_internals *pmd = dev->data->dev_private; struct pmd_internals *pmd = dev->data->dev_private;
@ -987,6 +987,8 @@ memif_stats_reset(struct rte_eth_dev *dev)
mq->n_pkts = 0; mq->n_pkts = 0;
mq->n_bytes = 0; mq->n_bytes = 0;
} }
return 0;
} }
static int static int

View File

@ -217,7 +217,7 @@ int mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list,
uint32_t num); uint32_t num);
int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
void mlx4_stats_reset(struct rte_eth_dev *dev); int mlx4_stats_reset(struct rte_eth_dev *dev);
int mlx4_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); int mlx4_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size);
int mlx4_dev_infos_get(struct rte_eth_dev *dev, int mlx4_dev_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *info); struct rte_eth_dev_info *info);

View File

@ -746,8 +746,11 @@ mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* alwasy 0 on success
*/ */
void int
mlx4_stats_reset(struct rte_eth_dev *dev) mlx4_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -768,6 +771,8 @@ mlx4_stats_reset(struct rte_eth_dev *dev)
.idx = txq->stats.idx, .idx = txq->stats.idx,
}; };
} }
return 0;
} }
/** /**

View File

@ -769,10 +769,10 @@ void mlx5_allmulticast_disable(struct rte_eth_dev *dev);
void mlx5_stats_init(struct rte_eth_dev *dev); void mlx5_stats_init(struct rte_eth_dev *dev);
int mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); int mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
void mlx5_stats_reset(struct rte_eth_dev *dev); int mlx5_stats_reset(struct rte_eth_dev *dev);
int mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, int mlx5_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
unsigned int n); unsigned int n);
void mlx5_xstats_reset(struct rte_eth_dev *dev); int mlx5_xstats_reset(struct rte_eth_dev *dev);
int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused, int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned int n); unsigned int n);

View File

@ -434,8 +434,11 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* always 0 on success and stats is reset
*/ */
void int
mlx5_stats_reset(struct rte_eth_dev *dev) mlx5_stats_reset(struct rte_eth_dev *dev)
{ {
struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_priv *priv = dev->data->dev_private;
@ -458,6 +461,8 @@ mlx5_stats_reset(struct rte_eth_dev *dev)
#ifndef MLX5_PMD_SOFT_COUNTERS #ifndef MLX5_PMD_SOFT_COUNTERS
/* FIXME: reset hardware counters. */ /* FIXME: reset hardware counters. */
#endif #endif
return 0;
} }
/** /**
@ -465,8 +470,12 @@ mlx5_stats_reset(struct rte_eth_dev *dev)
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* 0 on success and stats is reset, negative errno value otherwise and
* rte_errno is set.
*/ */
void int
mlx5_xstats_reset(struct rte_eth_dev *dev) mlx5_xstats_reset(struct rte_eth_dev *dev)
{ {
struct mlx5_priv *priv = dev->data->dev_private; struct mlx5_priv *priv = dev->data->dev_private;
@ -481,7 +490,7 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
if (stats_n < 0) { if (stats_n < 0) {
DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id, DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
strerror(-stats_n)); strerror(-stats_n));
return; return stats_n;
} }
if (xstats_ctrl->stats_n != stats_n) if (xstats_ctrl->stats_n != stats_n)
mlx5_stats_init(dev); mlx5_stats_init(dev);
@ -489,10 +498,12 @@ mlx5_xstats_reset(struct rte_eth_dev *dev)
if (ret) { if (ret) {
DRV_LOG(ERR, "port %u cannot read device counters: %s", DRV_LOG(ERR, "port %u cannot read device counters: %s",
dev->data->port_id, strerror(rte_errno)); dev->data->port_id, strerror(rte_errno));
return; return ret;
} }
for (i = 0; i != n; ++i) for (i = 0; i != n; ++i)
xstats_ctrl->base[i] = counters[i]; xstats_ctrl->base[i] = counters[i];
return 0;
} }
/** /**

View File

@ -48,7 +48,7 @@ struct mvneta_ifnames {
static int mvneta_dev_num; static int mvneta_dev_num;
static void mvneta_stats_reset(struct rte_eth_dev *dev); static int mvneta_stats_reset(struct rte_eth_dev *dev);
static int rte_pmd_mvneta_remove(struct rte_vdev_device *vdev); static int rte_pmd_mvneta_remove(struct rte_vdev_device *vdev);
@ -736,19 +736,24 @@ mvneta_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* 0 on success, negative error value otherwise.
*/ */
static void static int
mvneta_stats_reset(struct rte_eth_dev *dev) mvneta_stats_reset(struct rte_eth_dev *dev)
{ {
struct mvneta_priv *priv = dev->data->dev_private; struct mvneta_priv *priv = dev->data->dev_private;
unsigned int ret; unsigned int ret;
if (!priv->ppio) if (!priv->ppio)
return; return 0;
ret = mvneta_stats_get(dev, &priv->prev_stats); ret = mvneta_stats_get(dev, &priv->prev_stats);
if (unlikely(ret)) if (unlikely(ret))
RTE_LOG(ERR, PMD, "Failed to reset port statistics"); RTE_LOG(ERR, PMD, "Failed to reset port statistics");
return ret;
} }

View File

@ -1315,15 +1315,18 @@ mrvl_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* 0 on success, negative error value otherwise.
*/ */
static void static int
mrvl_stats_reset(struct rte_eth_dev *dev) mrvl_stats_reset(struct rte_eth_dev *dev)
{ {
struct mrvl_priv *priv = dev->data->dev_private; struct mrvl_priv *priv = dev->data->dev_private;
int i; int i;
if (!priv->ppio) if (!priv->ppio)
return; return 0;
for (i = 0; i < dev->data->nb_rx_queues; i++) { for (i = 0; i < dev->data->nb_rx_queues; i++) {
struct mrvl_rxq *rxq = dev->data->rx_queues[i]; struct mrvl_rxq *rxq = dev->data->rx_queues[i];
@ -1341,7 +1344,7 @@ mrvl_stats_reset(struct rte_eth_dev *dev)
txq->bytes_sent = 0; txq->bytes_sent = 0;
} }
pp2_ppio_get_statistics(priv->ppio, NULL, 1); return pp2_ppio_get_statistics(priv->ppio, NULL, 1);
} }
/** /**
@ -1392,11 +1395,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev,
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* 0 on success, negative error value otherwise.
*/ */
static void static int
mrvl_xstats_reset(struct rte_eth_dev *dev) mrvl_xstats_reset(struct rte_eth_dev *dev)
{ {
mrvl_stats_reset(dev); return mrvl_stats_reset(dev);
} }
/** /**

View File

@ -630,7 +630,7 @@ static int hn_dev_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void static int
hn_dev_stats_reset(struct rte_eth_dev *dev) hn_dev_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -653,13 +653,20 @@ hn_dev_stats_reset(struct rte_eth_dev *dev)
memset(&rxq->stats, 0, sizeof(struct hn_stats)); memset(&rxq->stats, 0, sizeof(struct hn_stats));
} }
return 0;
} }
static void static int
hn_dev_xstats_reset(struct rte_eth_dev *dev) hn_dev_xstats_reset(struct rte_eth_dev *dev)
{ {
hn_dev_stats_reset(dev); int ret;
hn_vf_xstats_reset(dev);
ret = hn_dev_stats_reset(dev);
if (ret != 0)
return 0;
return hn_vf_xstats_reset(dev);
} }
static int static int

View File

@ -235,14 +235,14 @@ int hn_vf_rx_queue_setup(struct rte_eth_dev *dev,
void hn_vf_rx_queue_release(struct hn_data *hv, uint16_t queue_id); void hn_vf_rx_queue_release(struct hn_data *hv, uint16_t queue_id);
int hn_vf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); int hn_vf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
void hn_vf_stats_reset(struct rte_eth_dev *dev); int hn_vf_stats_reset(struct rte_eth_dev *dev);
int hn_vf_xstats_get_names(struct rte_eth_dev *dev, int hn_vf_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned int size); unsigned int size);
int hn_vf_xstats_get(struct rte_eth_dev *dev, int hn_vf_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats, struct rte_eth_xstat *xstats,
unsigned int offset, unsigned int n); unsigned int offset, unsigned int n);
void hn_vf_xstats_reset(struct rte_eth_dev *dev); int hn_vf_xstats_reset(struct rte_eth_dev *dev);
int hn_vf_rss_hash_update(struct rte_eth_dev *dev, int hn_vf_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf); struct rte_eth_rss_conf *rss_conf);
int hn_vf_reta_hash_update(struct rte_eth_dev *dev, int hn_vf_reta_hash_update(struct rte_eth_dev *dev,

View File

@ -395,9 +395,9 @@ void hn_vf_close(struct rte_eth_dev *dev)
rte_spinlock_unlock(&hv->vf_lock); rte_spinlock_unlock(&hv->vf_lock);
} }
void hn_vf_stats_reset(struct rte_eth_dev *dev) int hn_vf_stats_reset(struct rte_eth_dev *dev)
{ {
VF_ETHDEV_FUNC(dev, rte_eth_stats_reset); VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_stats_reset);
} }
void hn_vf_allmulticast_enable(struct rte_eth_dev *dev) void hn_vf_allmulticast_enable(struct rte_eth_dev *dev)
@ -573,16 +573,21 @@ int hn_vf_xstats_get(struct rte_eth_dev *dev,
return count; return count;
} }
void hn_vf_xstats_reset(struct rte_eth_dev *dev) int hn_vf_xstats_reset(struct rte_eth_dev *dev)
{ {
struct hn_data *hv = dev->data->dev_private; struct hn_data *hv = dev->data->dev_private;
struct rte_eth_dev *vf_dev; struct rte_eth_dev *vf_dev;
int ret;
rte_spinlock_lock(&hv->vf_lock); rte_spinlock_lock(&hv->vf_lock);
vf_dev = hn_get_vf_dev(hv); vf_dev = hn_get_vf_dev(hv);
if (vf_dev) if (vf_dev)
rte_eth_xstats_reset(vf_dev->data->port_id); ret = rte_eth_xstats_reset(vf_dev->data->port_id);
else
ret = -EINVAL;
rte_spinlock_unlock(&hv->vf_lock); rte_spinlock_unlock(&hv->vf_lock);
return ret;
} }
int hn_vf_rss_hash_update(struct rte_eth_dev *dev, int hn_vf_rss_hash_update(struct rte_eth_dev *dev,

View File

@ -52,7 +52,7 @@ nfb_eth_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
void int
nfb_eth_stats_reset(struct rte_eth_dev *dev) nfb_eth_stats_reset(struct rte_eth_dev *dev)
{ {
uint16_t i; uint16_t i;
@ -74,4 +74,6 @@ nfb_eth_stats_reset(struct rte_eth_dev *dev)
tx_queue[i].tx_bytes = 0; tx_queue[i].tx_bytes = 0;
tx_queue[i].err_pkts = 0; tx_queue[i].err_pkts = 0;
} }
return 0;
} }

View File

@ -31,8 +31,11 @@ nfb_eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
* *
* @param dev * @param dev
* Pointer to Ethernet device structure. * Pointer to Ethernet device structure.
*
* @return
* 0 on success, negative errno value otherwise.
*/ */
void int
nfb_eth_stats_reset(struct rte_eth_dev *dev); nfb_eth_stats_reset(struct rte_eth_dev *dev);
#endif /* _NFB_STATS_H_ */ #endif /* _NFB_STATS_H_ */

View File

@ -105,7 +105,7 @@ static int nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
static int nfp_net_start(struct rte_eth_dev *dev); static int nfp_net_start(struct rte_eth_dev *dev);
static int nfp_net_stats_get(struct rte_eth_dev *dev, static int nfp_net_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void nfp_net_stats_reset(struct rte_eth_dev *dev); static int nfp_net_stats_reset(struct rte_eth_dev *dev);
static void nfp_net_stop(struct rte_eth_dev *dev); static void nfp_net_stop(struct rte_eth_dev *dev);
static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts); uint16_t nb_pkts);
@ -1149,7 +1149,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return -EINVAL; return -EINVAL;
} }
static void static int
nfp_net_stats_reset(struct rte_eth_dev *dev) nfp_net_stats_reset(struct rte_eth_dev *dev)
{ {
int i; int i;
@ -1210,6 +1210,8 @@ nfp_net_stats_reset(struct rte_eth_dev *dev)
hw->eth_stats_base.imissed = hw->eth_stats_base.imissed =
nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS); nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS);
return 0;
} }
static int static int

View File

@ -315,20 +315,22 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *igb_stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned i; unsigned i;
struct pmd_internals *internal; struct pmd_internals *internal;
if (dev == NULL) if (dev == NULL)
return; return -EINVAL;
internal = dev->data->dev_private; internal = dev->data->dev_private;
for (i = 0; i < RTE_DIM(internal->rx_null_queues); i++) for (i = 0; i < RTE_DIM(internal->rx_null_queues); i++)
internal->rx_null_queues[i].rx_pkts.cnt = 0; internal->rx_null_queues[i].rx_pkts.cnt = 0;
for (i = 0; i < RTE_DIM(internal->tx_null_queues); i++) for (i = 0; i < RTE_DIM(internal->tx_null_queues); i++)
internal->tx_null_queues[i].tx_pkts.cnt = 0; internal->tx_null_queues[i].tx_pkts.cnt = 0;
return 0;
} }
static void static void

View File

@ -228,12 +228,12 @@ octeontx_port_stats(struct octeontx_nic *nic, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
octeontx_port_stats_clr(struct octeontx_nic *nic) octeontx_port_stats_clr(struct octeontx_nic *nic)
{ {
PMD_INIT_FUNC_TRACE(); PMD_INIT_FUNC_TRACE();
octeontx_bgx_port_stats_clr(nic->port_id); return octeontx_bgx_port_stats_clr(nic->port_id);
} }
static inline void static inline void
@ -549,13 +549,13 @@ octeontx_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return octeontx_port_stats(nic, stats); return octeontx_port_stats(nic, stats);
} }
static void static int
octeontx_dev_stats_reset(struct rte_eth_dev *dev) octeontx_dev_stats_reset(struct rte_eth_dev *dev)
{ {
struct octeontx_nic *nic = octeontx_pmd_priv(dev); struct octeontx_nic *nic = octeontx_pmd_priv(dev);
PMD_INIT_FUNC_TRACE(); PMD_INIT_FUNC_TRACE();
octeontx_port_stats_clr(nic); return octeontx_port_stats_clr(nic);
} }
static int static int

View File

@ -422,7 +422,7 @@ void otx2_nix_cqe_dump(const struct nix_cqe_hdr_s *cq);
/* Stats */ /* Stats */
int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev, int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
void otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev); int otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev);
int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev, int otx2_nix_queue_stats_mapping(struct rte_eth_dev *dev,
uint16_t queue_id, uint8_t stat_idx, uint16_t queue_id, uint8_t stat_idx,
@ -432,7 +432,7 @@ int otx2_nix_xstats_get(struct rte_eth_dev *eth_dev,
int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev, int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned int limit); unsigned int limit);
void otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev); int otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev);
int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, int otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev,
const uint64_t *ids, const uint64_t *ids,

View File

@ -131,14 +131,16 @@ otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
return 0; return 0;
} }
void int
otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev) otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct otx2_mbox *mbox = dev->mbox; struct otx2_mbox *mbox = dev->mbox;
otx2_mbox_alloc_msg_nix_stats_rst(mbox); if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
otx2_mbox_process(mbox); return -ENOMEM;
return otx2_mbox_process(mbox);
} }
int int
@ -296,7 +298,7 @@ otx2_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
return n; return n;
} }
static void static int
nix_queue_stats_reset(struct rte_eth_dev *eth_dev) nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
{ {
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
@ -314,7 +316,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
rc = otx2_mbox_process_msg(mbox, (void *)&rsp); rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
if (rc) { if (rc) {
otx2_err("Failed to read rq context"); otx2_err("Failed to read rq context");
return; return rc;
} }
aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox); aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
aq->qidx = i; aq->qidx = i;
@ -336,7 +338,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
rc = otx2_mbox_process(mbox); rc = otx2_mbox_process(mbox);
if (rc) { if (rc) {
otx2_err("Failed to write rq context"); otx2_err("Failed to write rq context");
return; return rc;
} }
} }
@ -348,7 +350,7 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
rc = otx2_mbox_process_msg(mbox, (void *)&rsp); rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
if (rc) { if (rc) {
otx2_err("Failed to read sq context"); otx2_err("Failed to read sq context");
return; return rc;
} }
aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox); aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
aq->qidx = i; aq->qidx = i;
@ -368,20 +370,27 @@ nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
rc = otx2_mbox_process(mbox); rc = otx2_mbox_process(mbox);
if (rc) { if (rc) {
otx2_err("Failed to write sq context"); otx2_err("Failed to write sq context");
return; return rc;
} }
} }
return 0;
} }
void int
otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev) otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev)
{ {
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct otx2_mbox *mbox = dev->mbox; struct otx2_mbox *mbox = dev->mbox;
int ret;
otx2_mbox_alloc_msg_nix_stats_rst(mbox); if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
otx2_mbox_process(mbox); return -ENOMEM;
ret = otx2_mbox_process(mbox);
if (ret != 0)
return ret;
/* Reset queue stats */ /* Reset queue stats */
nix_queue_stats_reset(eth_dev); return nix_queue_stats_reset(eth_dev);
} }

View File

@ -703,7 +703,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -719,6 +719,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
internal->tx_queue[i].tx_stat.bytes = 0; internal->tx_queue[i].tx_stat.bytes = 0;
internal->tx_queue[i].tx_stat.err_pkts = 0; internal->tx_queue[i].tx_stat.err_pkts = 0;
} }
return 0;
} }
static void static void

View File

@ -1710,7 +1710,7 @@ qede_get_xstats(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
return stat_idx; return stat_idx;
} }
static void static int
qede_reset_xstats(struct rte_eth_dev *dev) qede_reset_xstats(struct rte_eth_dev *dev)
{ {
struct qede_dev *qdev = dev->data->dev_private; struct qede_dev *qdev = dev->data->dev_private;
@ -1718,6 +1718,8 @@ qede_reset_xstats(struct rte_eth_dev *dev)
ecore_reset_vport_stats(edev); ecore_reset_vport_stats(edev);
qede_reset_queue_stats(qdev, true); qede_reset_queue_stats(qdev, true);
return 0;
} }
int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up) int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up)
@ -1747,13 +1749,15 @@ static int qede_dev_set_link_down(struct rte_eth_dev *eth_dev)
return qede_dev_set_link_state(eth_dev, false); return qede_dev_set_link_state(eth_dev, false);
} }
static void qede_reset_stats(struct rte_eth_dev *eth_dev) static int qede_reset_stats(struct rte_eth_dev *eth_dev)
{ {
struct qede_dev *qdev = eth_dev->data->dev_private; struct qede_dev *qdev = eth_dev->data->dev_private;
struct ecore_dev *edev = &qdev->edev; struct ecore_dev *edev = &qdev->edev;
ecore_reset_vport_stats(edev); ecore_reset_vport_stats(edev);
qede_reset_queue_stats(qdev, false); qede_reset_queue_stats(qdev, false);
return 0;
} }
static void qede_allmulticast_enable(struct rte_eth_dev *eth_dev) static void qede_allmulticast_enable(struct rte_eth_dev *eth_dev)

View File

@ -191,7 +191,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -201,6 +201,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
internal->rx_ring_queues[i].rx_pkts.cnt = 0; internal->rx_ring_queues[i].rx_pkts.cnt = 0;
for (i = 0; i < dev->data->nb_tx_queues; i++) for (i = 0; i < dev->data->nb_tx_queues; i++)
internal->tx_ring_queues[i].tx_pkts.cnt = 0; internal->tx_ring_queues[i].tx_pkts.cnt = 0;
return 0;
} }
static void static void

View File

@ -637,7 +637,7 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return -ret; return -ret;
} }
static void static int
sfc_stats_reset(struct rte_eth_dev *dev) sfc_stats_reset(struct rte_eth_dev *dev)
{ {
struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
@ -650,12 +650,15 @@ sfc_stats_reset(struct rte_eth_dev *dev)
* will be scheduled to be done during the next port start * will be scheduled to be done during the next port start
*/ */
port->mac_stats_reset_pending = B_TRUE; port->mac_stats_reset_pending = B_TRUE;
return; return 0;
} }
rc = sfc_port_reset_mac_stats(sa); rc = sfc_port_reset_mac_stats(sa);
if (rc != 0) if (rc != 0)
sfc_err(sa, "failed to reset statistics (rc = %d)", rc); sfc_err(sa, "failed to reset statistics (rc = %d)", rc);
SFC_ASSERT(rc >= 0);
return -rc;
} }
static int static int

View File

@ -1111,7 +1111,7 @@ eth_stats_get(struct rte_eth_dev *dev,
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
uint16_t i; uint16_t i;
@ -1130,6 +1130,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
txq->tx_bytes = 0; txq->tx_bytes = 0;
txq->err_pkts = 0; txq->err_pkts = 0;
} }
return 0;
} }
static void static void

View File

@ -986,7 +986,7 @@ tap_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *tap_stats)
return 0; return 0;
} }
static void static int
tap_stats_reset(struct rte_eth_dev *dev) tap_stats_reset(struct rte_eth_dev *dev)
{ {
int i; int i;
@ -1002,6 +1002,8 @@ tap_stats_reset(struct rte_eth_dev *dev)
pmd->txq[i].stats.errs = 0; pmd->txq[i].stats.errs = 0;
pmd->txq[i].stats.obytes = 0; pmd->txq[i].stats.obytes = 0;
} }
return 0;
} }
static void static void

View File

@ -362,7 +362,7 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev)
return ptypes; return ptypes;
} }
static void static int
nicvf_dev_stats_reset(struct rte_eth_dev *dev) nicvf_dev_stats_reset(struct rte_eth_dev *dev)
{ {
int i; int i;
@ -370,6 +370,7 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
struct nicvf *nic = nicvf_pmd_priv(dev); struct nicvf *nic = nicvf_pmd_priv(dev);
uint16_t rx_start, rx_end; uint16_t rx_start, rx_end;
uint16_t tx_start, tx_end; uint16_t tx_start, tx_end;
int ret;
/* Reset all primary nic counters */ /* Reset all primary nic counters */
nicvf_rx_range(dev, nic, &rx_start, &rx_end); nicvf_rx_range(dev, nic, &rx_start, &rx_end);
@ -380,7 +381,9 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
for (i = tx_start; i <= tx_end; i++) for (i = tx_start; i <= tx_end; i++)
txqs |= (0x3 << (i * 2)); txqs |= (0x3 << (i * 2));
nicvf_mbox_reset_stat_counters(nic, 0x3FFF, 0x1F, rxqs, txqs); ret = nicvf_mbox_reset_stat_counters(nic, 0x3FFF, 0x1F, rxqs, txqs);
if (ret != 0)
return ret;
/* Reset secondary nic queue counters */ /* Reset secondary nic queue counters */
for (i = 0; i < nic->sqs_count; i++) { for (i = 0; i < nic->sqs_count; i++) {
@ -396,8 +399,12 @@ nicvf_dev_stats_reset(struct rte_eth_dev *dev)
for (i = tx_start; i <= tx_end; i++) for (i = tx_start; i <= tx_end; i++)
txqs |= (0x3 << ((i % MAX_SND_QUEUES_PER_QS) * 2)); txqs |= (0x3 << ((i % MAX_SND_QUEUES_PER_QS) * 2));
nicvf_mbox_reset_stat_counters(snic, 0, 0, rxqs, txqs); ret = nicvf_mbox_reset_stat_counters(snic, 0, 0, rxqs, txqs);
if (ret != 0)
return ret;
} }
return 0;
} }
/* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */ /* Promiscuous mode enabled by default in LMAC to VF 1:1 map configuration */

View File

@ -216,7 +216,7 @@ static const struct vhost_xstats_name_off vhost_txport_stat_strings[] = {
#define VHOST_NB_XSTATS_TXPORT (sizeof(vhost_txport_stat_strings) / \ #define VHOST_NB_XSTATS_TXPORT (sizeof(vhost_txport_stat_strings) / \
sizeof(vhost_txport_stat_strings[0])) sizeof(vhost_txport_stat_strings[0]))
static void static int
vhost_dev_xstats_reset(struct rte_eth_dev *dev) vhost_dev_xstats_reset(struct rte_eth_dev *dev)
{ {
struct vhost_queue *vq = NULL; struct vhost_queue *vq = NULL;
@ -234,6 +234,8 @@ vhost_dev_xstats_reset(struct rte_eth_dev *dev)
continue; continue;
memset(&vq->stats, 0, sizeof(vq->stats)); memset(&vq->stats, 0, sizeof(vq->stats));
} }
return 0;
} }
static int static int
@ -1119,7 +1121,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
eth_stats_reset(struct rte_eth_dev *dev) eth_stats_reset(struct rte_eth_dev *dev)
{ {
struct vhost_queue *vq; struct vhost_queue *vq;
@ -1140,6 +1142,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
vq->stats.bytes = 0; vq->stats.bytes = 0;
vq->stats.missed_pkts = 0; vq->stats.missed_pkts = 0;
} }
return 0;
} }
static void static void

View File

@ -61,7 +61,7 @@ static int virtio_dev_xstats_get(struct rte_eth_dev *dev,
static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev, static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, struct rte_eth_xstat_name *xstats_names,
unsigned limit); unsigned limit);
static void virtio_dev_stats_reset(struct rte_eth_dev *dev); static int virtio_dev_stats_reset(struct rte_eth_dev *dev);
static void virtio_dev_free_mbufs(struct rte_eth_dev *dev); static void virtio_dev_free_mbufs(struct rte_eth_dev *dev);
static int virtio_vlan_filter_set(struct rte_eth_dev *dev, static int virtio_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on); uint16_t vlan_id, int on);
@ -1076,7 +1076,7 @@ virtio_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
virtio_dev_stats_reset(struct rte_eth_dev *dev) virtio_dev_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -1107,6 +1107,8 @@ virtio_dev_stats_reset(struct rte_eth_dev *dev)
memset(rxvq->stats.size_bins, 0, memset(rxvq->stats.size_bins, 0,
sizeof(rxvq->stats.size_bins[0]) * 8); sizeof(rxvq->stats.size_bins[0]) * 8);
} }
return 0;
} }
static void static void

View File

@ -76,7 +76,7 @@ static int vmxnet3_dev_link_update(struct rte_eth_dev *dev,
static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw); static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw);
static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev, static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats); struct rte_eth_stats *stats);
static void vmxnet3_dev_stats_reset(struct rte_eth_dev *dev); static int vmxnet3_dev_stats_reset(struct rte_eth_dev *dev);
static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev, static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats, struct rte_eth_xstat_name *xstats,
unsigned int n); unsigned int n);
@ -1125,7 +1125,7 @@ vmxnet3_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
return 0; return 0;
} }
static void static int
vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) vmxnet3_dev_stats_reset(struct rte_eth_dev *dev)
{ {
unsigned int i; unsigned int i;
@ -1147,6 +1147,8 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev)
memcpy(&hw->snapshot_rx_stats[i], &rxStats, memcpy(&hw->snapshot_rx_stats[i], &rxStats,
sizeof(hw->snapshot_rx_stats[0])); sizeof(hw->snapshot_rx_stats[0]));
} }
return 0;
} }
static int static int

View File

@ -2039,12 +2039,16 @@ int
rte_eth_stats_reset(uint16_t port_id) rte_eth_stats_reset(uint16_t port_id)
{ {
struct rte_eth_dev *dev; struct rte_eth_dev *dev;
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id]; dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP); RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_reset, -ENOTSUP);
(*dev->dev_ops->stats_reset)(dev); ret = (*dev->dev_ops->stats_reset)(dev);
if (ret != 0)
return eth_err(port_id, ret);
dev->data->rx_mbuf_alloc_failed = 0; dev->data->rx_mbuf_alloc_failed = 0;
return 0; return 0;
@ -2529,10 +2533,8 @@ rte_eth_xstats_reset(uint16_t port_id)
dev = &rte_eth_devices[port_id]; dev = &rte_eth_devices[port_id];
/* implemented by the driver */ /* implemented by the driver */
if (dev->dev_ops->xstats_reset != NULL) { if (dev->dev_ops->xstats_reset != NULL)
(*dev->dev_ops->xstats_reset)(dev); return eth_err(port_id, (*dev->dev_ops->xstats_reset)(dev));
return 0;
}
/* fallback to default */ /* fallback to default */
return rte_eth_stats_reset(port_id); return rte_eth_stats_reset(port_id);

View File

@ -2137,6 +2137,7 @@ int rte_eth_stats_get(uint16_t port_id, struct rte_eth_stats *stats);
* - (0) if device notified to reset stats. * - (0) if device notified to reset stats.
* - (-ENOTSUP) if hardware doesn't support. * - (-ENOTSUP) if hardware doesn't support.
* - (-ENODEV) if *port_id* invalid. * - (-ENODEV) if *port_id* invalid.
* - (<0): Error code of the driver stats reset function.
*/ */
int rte_eth_stats_reset(uint16_t port_id); int rte_eth_stats_reset(uint16_t port_id);
@ -2289,6 +2290,7 @@ int rte_eth_xstats_get_id_by_name(uint16_t port_id, const char *xstat_name,
* - (-ENOTSUP) if pmd doesn't support both * - (-ENOTSUP) if pmd doesn't support both
* extended stats and basic stats reset. * extended stats and basic stats reset.
* - (-ENODEV) if *port_id* invalid. * - (-ENODEV) if *port_id* invalid.
* - (<0): Error code of the driver xstats reset function.
*/ */
int rte_eth_xstats_reset(uint16_t port_id); int rte_eth_xstats_reset(uint16_t port_id);

View File

@ -116,8 +116,26 @@ typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev,
struct rte_eth_stats *igb_stats); struct rte_eth_stats *igb_stats);
/**< @internal Get global I/O statistics of an Ethernet device. */ /**< @internal Get global I/O statistics of an Ethernet device. */
typedef void (*eth_stats_reset_t)(struct rte_eth_dev *dev); /**
/**< @internal Reset global I/O statistics of an Ethernet device to 0. */ * @internal
* Reset global I/O statistics of an Ethernet device to 0.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, statistics has been reset.
* @retval -ENOTSUP
* Resetting statistics is not supported.
* @retval -EINVAL
* Resetting statistics is not valid.
* @retval -ENOMEM
* Not enough memory to get the stats.
*/
typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev);
typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev, typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev,
struct rte_eth_xstat *stats, unsigned n); struct rte_eth_xstat *stats, unsigned n);
@ -129,8 +147,26 @@ typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev,
unsigned int n); unsigned int n);
/**< @internal Get extended stats of an Ethernet device. */ /**< @internal Get extended stats of an Ethernet device. */
typedef void (*eth_xstats_reset_t)(struct rte_eth_dev *dev); /**
/**< @internal Reset extended stats of an Ethernet device. */ * @internal
* Reset extended stats of an Ethernet device.
*
* @param dev
* ethdev handle of port.
*
* @return
* Negative errno value on error, 0 on success.
*
* @retval 0
* Success, statistics has been reset.
* @retval -ENOTSUP
* Resetting statistics is not supported.
* @retval -EINVAL
* Resetting statistics is not valid.
* @retval -ENOMEM
* Not enough memory to get the stats.
*/
typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev);
typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev, typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names, unsigned size); struct rte_eth_xstat_name *xstats_names, unsigned size);