return 0;
}
-static void
+static int
virtual_ethdev_stats_reset(struct rte_eth_dev *dev)
{
struct virtual_ethdev_private *dev_private = dev->data->dev_private;
/* Reset internal statistics */
memset(&dev_private->eth_stats, 0, sizeof(dev_private->eth_stats));
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
unsigned i;
internal->tx_queue[i].err_pkts = 0;
internal->tx_queue[i].tx_bytes = 0;
}
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
struct pmd_internals *internals = dev->data->dev_private;
memset(&internals->tx_queues[i].stats, 0,
sizeof(struct tx_stats));
}
+
+ return 0;
}
static void
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,
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,
struct rte_ether_addr *mac_addr);
static int eth_ark_macaddr_add(struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
if (ark->user_ext.stats_reset)
ark->user_ext.stats_reset(dev,
ark->user_data[dev->data->port_id]);
+
+ return 0;
}
static int
static int atl_dev_xstats_get(struct rte_eth_dev *dev,
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,
size_t fw_size);
return 0;
}
-static void
+static int
atl_dev_stats_reset(struct rte_eth_dev *dev)
{
struct atl_adapter *adapter = ATL_DEV_TO_ADAPTER(dev);
memset(&hw->curr_stats, 0, sizeof(hw->curr_stats));
memset(&adapter->sw_stats, 0, sizeof(adapter->sw_stats));
+
+ return 0;
}
static int
static int avp_dev_stats_get(struct rte_eth_dev *dev,
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
return 0;
}
-static void
+static int
avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
{
struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
txq->errors = 0;
}
}
+
+ return 0;
}
RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd);
int wait_to_complete);
static int axgbe_dev_stats_get(struct rte_eth_dev *dev,
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,
struct rte_eth_dev_info *dev_info);
return 0;
}
-static void
+static int
axgbe_dev_stats_reset(struct rte_eth_dev *dev)
{
struct axgbe_rx_queue *rxq;
txq->bytes = 0;
txq->errors = 0;
}
+
+ return 0;
}
static int
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;
unsigned int i;
+ int ret;
if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
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++) {
struct bnxt_rx_queue *rxq = bp->rx_queues[i];
rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail);
}
+
+ return ret;
}
int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
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;
+ int ret;
+
+ if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp)) {
+ ret = bnxt_hwrm_port_clr_stats(bp);
+ if (ret != 0) {
+ PMD_DRV_LOG(ERR, "Operation failed: %s\n",
+ strerror(-ret));
+ return ret;
+ }
+ }
- if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
- bnxt_hwrm_port_clr_stats(bp);
+ ret = 0;
- if (BNXT_VF(bp))
+ if (BNXT_VF(bp)) {
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");
- if (!(bp->flags & BNXT_FLAG_PORT_STATS))
+ ret = -ENOTSUP;
+ }
+ if (!(bp->flags & BNXT_FLAG_PORT_STATS)) {
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,
void bnxt_free_stats(struct bnxt *bp);
int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
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,
struct rte_eth_xstat_name *xstats_names,
__rte_unused unsigned int limit);
int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
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,
uint64_t *values, unsigned int limit);
int bnxt_dev_xstats_get_names_by_id_op(struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
bond_ethdev_stats_reset(struct rte_eth_dev *dev)
{
struct bond_dev_private *internals = dev->data->dev_private;
int i;
+ int err;
+ int ret;
- for (i = 0; i < internals->slave_count; i++)
- rte_eth_stats_reset(internals->slaves[i].port_id);
+ for (i = 0, err = 0; i < internals->slave_count; i++) {
+ ret = rte_eth_stats_reset(internals->slaves[i].port_id);
+ if (ret != 0)
+ err = ret;
+ }
+
+ return err;
}
static int
/*
* 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 adapter *adapter = pi->adapter;
txq->stats.tx_bytes = 0;
txq->stats.mapping_err = 0;
}
+
+ return 0;
}
static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
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;
PMD_INIT_FUNC_TRACE();
fman_if_stats_reset(dpaa_intf->fif);
+
+ return 0;
}
static int
return limit;
}
-static void
+static int
dpaa2_dev_stats_reset(struct rte_eth_dev *dev)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw;
- int32_t retcode;
+ int retcode;
int i;
struct dpaa2_queue *dpaa2_q;
if (dpni == NULL) {
DPAA2_PMD_ERR("dpni is NULL");
- return;
+ return -EINVAL;
}
retcode = dpni_reset_statistics(dpni, CMD_PRI_LOW, priv->token);
dpaa2_q->tx_pkts = 0;
}
- return;
+ return 0;
error:
DPAA2_PMD_ERR("Operation not completed:Error Code = %d", retcode);
- return;
+ return retcode;
};
/* return 0 means link status changed, -1 means not changed */
int wait_to_complete);
static int eth_em_stats_get(struct rte_eth_dev *dev,
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,
struct rte_eth_dev_info *dev_info);
static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
eth_em_stats_reset(struct rte_eth_dev *dev)
{
struct e1000_hw_stats *hw_stats =
/* Reset software totals */
memset(hw_stats, 0, sizeof(*hw_stats));
+
+ return 0;
}
static int
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,
unsigned int limit);
-static void eth_igb_stats_reset(struct rte_eth_dev *dev);
-static void eth_igb_xstats_reset(struct rte_eth_dev *dev);
+static int eth_igb_stats_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,
char *fw_version, size_t fw_size);
static int eth_igb_infos_get(struct rte_eth_dev *dev,
static int eth_igbvf_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names,
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,
uint16_t vlan_id, int on);
static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on);
return 0;
}
-static void
+static int
eth_igb_stats_reset(struct rte_eth_dev *dev)
{
struct e1000_hw_stats *hw_stats =
/* Reset software totals */
memset(hw_stats, 0, sizeof(*hw_stats));
+
+ return 0;
}
-static void
+static int
eth_igb_xstats_reset(struct rte_eth_dev *dev)
{
struct e1000_hw_stats *stats =
/* Reset software totals */
memset(stats, 0, sizeof(*stats));
+
+ return 0;
}
static int eth_igb_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
eth_igbvf_stats_reset(struct rte_eth_dev *dev)
{
struct e1000_vf_stats *hw_stats = (struct e1000_vf_stats*)
/* reset HW current stats*/
memset(&hw_stats->gprc, 0, sizeof(*hw_stats) -
offsetof(struct e1000_vf_stats, gprc));
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
enetc_stats_reset(struct rte_eth_dev *dev)
{
struct enetc_eth_hw *hw =
struct enetc_hw *enetc_hw = &hw->hw;
enetc_port_wr(enetc_hw, ENETC_PM0_STAT_CONFIG, ENETC_CLEAR_STATS);
+
+ return 0;
}
static void
int enic_get_link_status(struct enic *enic);
int enic_dev_stats_get(struct enic *enic,
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_set_mac_address(struct enic *enic, uint8_t *mac_addr);
int enic_del_mac_address(struct enic *enic, int mac_index);
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);
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)
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");
+ return ret;
+ }
enic_clear_soft_stats(enic);
+
+ return 0;
}
int enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
return 0;
}
-static void
+static int
fs_stats_reset(struct rte_eth_dev *dev)
{
struct sub_device *sdev;
uint8_t i;
+ int ret;
fs_lock(dev, 0);
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(&PRIV(dev)->stats_accumulator, 0, sizeof(struct rte_eth_stats));
fs_unlock(dev, 0);
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
fm10k_stats_reset(struct rte_eth_dev *dev)
{
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
memset(hw_stats, 0, sizeof(*hw_stats));
fm10k_rebind_hw_stats(hw, hw_stats);
+
+ return 0;
}
static int
}
/* 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 */
diag = fm10k_reset_hw(hw);
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;
u16 out_size = sizeof(clear_vport_stats);
if (!hwdev) {
PMD_DRV_LOG(ERR, "Hwdev is NULL");
- return;
+ return -EINVAL;
}
memset(&clear_vport_stats, 0, sizeof(clear_vport_stats));
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",
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;
u16 out_size = sizeof(clear_phy_port_stats);
if (!hwdev) {
PMD_DRV_LOG(ERR, "Hwdev is NULL");
- return;
+ return -EINVAL;
}
memset(&clear_phy_port_stats, 0, sizeof(clear_phy_port_stats));
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,
out_size);
+ return -EINVAL;
}
+
+ return 0;
}
int hinic_set_link_status_follow(void *hwdev,
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_ */
* @param dev
* 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;
struct hinic_rxq *rxq = NULL;
struct hinic_txq *txq = NULL;
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++) {
rxq = nic_dev->rxqs[qid];
txq = nic_dev->txqs[qid];
hinic_txq_stats_reset(txq);
}
+
+ return 0;
}
/**
* @param dev
* 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);
+ 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)
- hinic_clear_phy_port_stats(nic_dev->hwdev);
+ if (hinic_func_type(nic_dev->hwdev) != TYPE_VF) {
+ 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 int i40e_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names,
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,
char *fw_version, size_t fw_size);
static int i40e_dev_info_get(struct rte_eth_dev *dev,
}
/* Reset the statistics */
-static void
+static int
i40e_dev_stats_reset(struct rte_eth_dev *dev)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
/* read the stats, reading current register values into offset */
i40e_read_stats_registers(pf, hw);
+
+ return 0;
}
static uint32_t
static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names,
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,
uint16_t vlan_id, int on);
static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
i40evf_stat_update_32(&oes->tx_discards, &nes->tx_discards);
}
-static void
+static int
i40evf_dev_xstats_reset(struct rte_eth_dev *dev)
{
int ret;
/* set stats offset base on current values */
if (ret == 0)
vf->vsi.eth_stats_offset = *pstats;
+
+ return ret;
}
static int i40evf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
return ret;
}
-static void
+static int
i40e_vf_representor_stats_reset(struct rte_eth_dev *ethdev)
{
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->vf_id, &representor->stats_offset);
}
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,
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_disable(struct rte_eth_dev *dev);
static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
return -EIO;
}
-static void
+static int
iavf_dev_stats_reset(struct rte_eth_dev *dev)
{
int ret;
/* read stat values to clear hardware registers */
ret = iavf_query_stats(adapter, &pstats);
+ if (ret != 0)
+ return ret;
/* set stats offset base on current values */
- if (ret == 0)
- vsi->eth_stats_offset = *pstats;
+ vsi->eth_stats_offset = *pstats;
+
+ return 0;
}
static int
struct rte_dev_eeprom_info *eeprom);
static int ice_stats_get(struct rte_eth_dev *dev,
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,
struct rte_eth_xstat *xstats, unsigned int n);
static int ice_xstats_get_names(struct rte_eth_dev *dev,
}
/* Reset the statistics */
-static void
+static int
ice_stats_reset(struct rte_eth_dev *dev)
{
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
/* read the stats, reading current register values into offset */
ice_read_stats_registers(pf, hw);
+
+ return 0;
}
static uint32_t
0);
}
-static void
+static int
ipn3ke_rpst_stats_reset(struct rte_eth_dev *ethdev)
{
uint16_t port_id = 0;
if (!ethdev) {
IPN3KE_AFU_PMD_ERR("ethernet device to reset is NULL!");
- return;
+ return -EINVAL;
}
afu_dev = RTE_ETH_DEV_TO_AFU(ethdev);
if (!afu_dev) {
IPN3KE_AFU_PMD_ERR("afu device to reset is NULL!");
- return;
+ return -EINVAL;
}
if (!afu_dev->shared.data) {
IPN3KE_AFU_PMD_ERR("hardware data to reset is NULL!");
- return;
+ return -EINVAL;
}
hw = afu_dev->shared.data;
ch = ethdev->data->name;
if (!ch) {
IPN3KE_AFU_PMD_ERR("ethdev name is NULL!");
- return;
+ return -EINVAL;
}
while (ch) {
if (*ch == '_')
}
if (!ch) {
IPN3KE_AFU_PMD_ERR("Can not get port_id from ethdev name!");
- return;
+ return -EINVAL;
}
port_id = atoi(ch);
ipn3ke_rpst_10g_lineside_tx_stats_reset(hw, port_id);
ipn3ke_rpst_10g_lineside_rx_stats_reset(hw, port_id);
}
+
+ return 0;
}
static int
static int
ixgbe_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
uint64_t *values, unsigned int n);
-static void ixgbe_dev_stats_reset(struct rte_eth_dev *dev);
-static void ixgbe_dev_xstats_reset(struct rte_eth_dev *dev);
+static int ixgbe_dev_stats_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,
struct rte_eth_xstat_name *xstats_names,
unsigned int size);
static void ixgbevf_intr_enable(struct rte_eth_dev *dev);
static int ixgbevf_dev_stats_get(struct rte_eth_dev *dev,
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,
uint16_t vlan_id, int on);
static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev,
return 0;
}
-static void
+static int
ixgbe_dev_stats_reset(struct rte_eth_dev *dev)
{
struct ixgbe_hw_stats *stats =
/* Reset software totals */
memset(stats, 0, sizeof(*stats));
+
+ return 0;
}
/* This function calculates the number of xstats based on the current config */
return n;
}
-static void
+static int
ixgbe_dev_xstats_reset(struct rte_eth_dev *dev)
{
struct ixgbe_hw_stats *stats =
/* Reset software totals */
memset(stats, 0, sizeof(*stats));
memset(macsec_stats, 0, sizeof(*macsec_stats));
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
ixgbevf_dev_stats_reset(struct rte_eth_dev *dev)
{
struct ixgbevf_hw_stats *hw_stats = (struct ixgbevf_hw_stats *)
hw_stats->vfgorc = 0;
hw_stats->vfgptc = 0;
hw_stats->vfgotc = 0;
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_kni_stats_reset(struct rte_eth_dev *dev)
{
struct rte_eth_dev_data *data = dev->data;
q->tx.pkts = 0;
q->tx.bytes = 0;
}
+
+ return 0;
}
static const struct eth_dev_ops eth_kni_ops = {
}
/* Reset hw stats for the port */
-static void
+static int
lio_dev_xstats_reset(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
struct lio_dev_ctrl_cmd ctrl_cmd;
struct lio_ctrl_pkt ctrl_pkt;
+ int ret;
if (!lio_dev->intf_open) {
lio_dev_err(lio_dev, "Port %d down\n",
lio_dev->port_id);
- return;
+ return -EINVAL;
}
/* flush added to prevent cmd failure
ctrl_pkt.ncmd.s.cmd = LIO_CMD_CLEAR_STATS;
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");
- 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");
- return;
+ return ret;
}
/* clear stored per queue stats */
- RTE_FUNC_PTR_OR_RET(*eth_dev->dev_ops->stats_reset);
- (*eth_dev->dev_ops->stats_reset)(eth_dev);
+ RTE_FUNC_PTR_OR_ERR_RET(*eth_dev->dev_ops->stats_reset, 0);
+ return (*eth_dev->dev_ops->stats_reset)(eth_dev);
}
/* Retrieve the device statistics (# packets in/out, # bytes in/out, etc */
return 0;
}
-static void
+static int
lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
memset(oq_stats, 0, sizeof(struct lio_droq_stats));
}
}
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
memif_stats_reset(struct rte_eth_dev *dev)
{
struct pmd_internals *pmd = dev->data->dev_private;
mq->n_pkts = 0;
mq->n_bytes = 0;
}
+
+ return 0;
}
static int
uint32_t num);
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);
-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_dev_infos_get(struct rte_eth_dev *dev,
struct rte_eth_dev_info *info);
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * alwasy 0 on success
*/
-void
+int
mlx4_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
.idx = txq->stats.idx,
};
}
+
+ return 0;
}
/**
void mlx5_stats_init(struct rte_eth_dev *dev);
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,
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,
struct rte_eth_xstat_name *xstats_names,
unsigned int n);
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * always 0 on success and stats is reset
*/
-void
+int
mlx5_stats_reset(struct rte_eth_dev *dev)
{
struct mlx5_priv *priv = dev->data->dev_private;
#ifndef MLX5_PMD_SOFT_COUNTERS
/* FIXME: reset hardware counters. */
#endif
+
+ return 0;
}
/**
*
* @param dev
* 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)
{
struct mlx5_priv *priv = dev->data->dev_private;
if (stats_n < 0) {
DRV_LOG(ERR, "port %u cannot get stats: %s", dev->data->port_id,
strerror(-stats_n));
- return;
+ return stats_n;
}
if (xstats_ctrl->stats_n != stats_n)
mlx5_stats_init(dev);
if (ret) {
DRV_LOG(ERR, "port %u cannot read device counters: %s",
dev->data->port_id, strerror(rte_errno));
- return;
+ return ret;
}
for (i = 0; i != n; ++i)
xstats_ctrl->base[i] = counters[i];
+
+ return 0;
}
/**
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);
*
* @param dev
* 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)
{
struct mvneta_priv *priv = dev->data->dev_private;
unsigned int ret;
if (!priv->ppio)
- return;
+ return 0;
ret = mvneta_stats_get(dev, &priv->prev_stats);
if (unlikely(ret))
RTE_LOG(ERR, PMD, "Failed to reset port statistics");
+
+ return ret;
}
*
* @param dev
* 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)
{
struct mrvl_priv *priv = dev->data->dev_private;
int i;
if (!priv->ppio)
- return;
+ return 0;
for (i = 0; i < dev->data->nb_rx_queues; i++) {
struct mrvl_rxq *rxq = dev->data->rx_queues[i];
txq->bytes_sent = 0;
}
- pp2_ppio_get_statistics(priv->ppio, NULL, 1);
+ return pp2_ppio_get_statistics(priv->ppio, NULL, 1);
}
/**
*
* @param dev
* 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_stats_reset(dev);
+ return mrvl_stats_reset(dev);
}
/**
return 0;
}
-static void
+static int
hn_dev_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
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_stats_reset(dev);
- hn_vf_xstats_reset(dev);
+ int ret;
+
+ ret = hn_dev_stats_reset(dev);
+ if (ret != 0)
+ return 0;
+
+ return hn_vf_xstats_reset(dev);
}
static int
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);
-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,
struct rte_eth_xstat_name *xstats_names,
unsigned int size);
int hn_vf_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstat *xstats,
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,
struct rte_eth_rss_conf *rss_conf);
int hn_vf_reta_hash_update(struct rte_eth_dev *dev,
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)
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 rte_eth_dev *vf_dev;
+ int ret;
rte_spinlock_lock(&hv->vf_lock);
vf_dev = hn_get_vf_dev(hv);
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);
+
+ return ret;
}
int hn_vf_rss_hash_update(struct rte_eth_dev *dev,
return 0;
}
-void
+int
nfb_eth_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
tx_queue[i].tx_bytes = 0;
tx_queue[i].err_pkts = 0;
}
+
+ return 0;
}
*
* @param dev
* Pointer to Ethernet device structure.
+ *
+ * @return
+ * 0 on success, negative errno value otherwise.
*/
-void
+int
nfb_eth_stats_reset(struct rte_eth_dev *dev);
#endif /* _NFB_STATS_H_ */
static int nfp_net_start(struct rte_eth_dev *dev);
static int nfp_net_stats_get(struct rte_eth_dev *dev,
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 uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts);
return -EINVAL;
}
-static void
+static int
nfp_net_stats_reset(struct rte_eth_dev *dev)
{
int i;
hw->eth_stats_base.imissed =
nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS);
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
unsigned i;
struct pmd_internals *internal;
if (dev == NULL)
- return;
+ return -EINVAL;
internal = dev->data->dev_private;
for (i = 0; i < RTE_DIM(internal->rx_null_queues); i++)
internal->rx_null_queues[i].rx_pkts.cnt = 0;
for (i = 0; i < RTE_DIM(internal->tx_null_queues); i++)
internal->tx_null_queues[i].tx_pkts.cnt = 0;
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
octeontx_port_stats_clr(struct octeontx_nic *nic)
{
PMD_INIT_FUNC_TRACE();
- octeontx_bgx_port_stats_clr(nic->port_id);
+ return octeontx_bgx_port_stats_clr(nic->port_id);
}
static inline void
return octeontx_port_stats(nic, stats);
}
-static void
+static int
octeontx_dev_stats_reset(struct rte_eth_dev *dev)
{
struct octeontx_nic *nic = octeontx_pmd_priv(dev);
PMD_INIT_FUNC_TRACE();
- octeontx_port_stats_clr(nic);
+ return octeontx_port_stats_clr(nic);
}
static int
/* Stats */
int otx2_nix_dev_stats_get(struct rte_eth_dev *eth_dev,
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,
uint16_t queue_id, uint8_t stat_idx,
int otx2_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
struct rte_eth_xstat_name *xstats_names,
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,
const uint64_t *ids,
return 0;
}
-void
+int
otx2_nix_dev_stats_reset(struct rte_eth_dev *eth_dev)
{
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct otx2_mbox *mbox = dev->mbox;
- otx2_mbox_alloc_msg_nix_stats_rst(mbox);
- otx2_mbox_process(mbox);
+ if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
+ return -ENOMEM;
+
+ return otx2_mbox_process(mbox);
}
int
return n;
}
-static void
+static int
nix_queue_stats_reset(struct rte_eth_dev *eth_dev)
{
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
if (rc) {
otx2_err("Failed to read rq context");
- return;
+ return rc;
}
aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
aq->qidx = i;
rc = otx2_mbox_process(mbox);
if (rc) {
otx2_err("Failed to write rq context");
- return;
+ return rc;
}
}
rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
if (rc) {
otx2_err("Failed to read sq context");
- return;
+ return rc;
}
aq = otx2_mbox_alloc_msg_nix_aq_enq(mbox);
aq->qidx = i;
rc = otx2_mbox_process(mbox);
if (rc) {
otx2_err("Failed to write sq context");
- return;
+ return rc;
}
}
+
+ return 0;
}
-void
+int
otx2_nix_xstats_reset(struct rte_eth_dev *eth_dev)
{
struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
struct otx2_mbox *mbox = dev->mbox;
+ int ret;
+
+ if (otx2_mbox_alloc_msg_nix_stats_rst(mbox) == NULL)
+ return -ENOMEM;
- otx2_mbox_alloc_msg_nix_stats_rst(mbox);
- otx2_mbox_process(mbox);
+ ret = otx2_mbox_process(mbox);
+ if (ret != 0)
+ return ret;
/* Reset queue stats */
- nix_queue_stats_reset(eth_dev);
+ return nix_queue_stats_reset(eth_dev);
}
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
internal->tx_queue[i].tx_stat.bytes = 0;
internal->tx_queue[i].tx_stat.err_pkts = 0;
}
+
+ return 0;
}
static void
return stat_idx;
}
-static void
+static int
qede_reset_xstats(struct rte_eth_dev *dev)
{
struct qede_dev *qdev = dev->data->dev_private;
ecore_reset_vport_stats(edev);
qede_reset_queue_stats(qdev, true);
+
+ return 0;
}
int qede_dev_set_link_state(struct rte_eth_dev *eth_dev, bool link_up)
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 ecore_dev *edev = &qdev->edev;
ecore_reset_vport_stats(edev);
qede_reset_queue_stats(qdev, false);
+
+ return 0;
}
static void qede_allmulticast_enable(struct rte_eth_dev *eth_dev)
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
internal->rx_ring_queues[i].rx_pkts.cnt = 0;
for (i = 0; i < dev->data->nb_tx_queues; i++)
internal->tx_ring_queues[i].tx_pkts.cnt = 0;
+
+ return 0;
}
static void
return -ret;
}
-static void
+static int
sfc_stats_reset(struct rte_eth_dev *dev)
{
struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
* will be scheduled to be done during the next port start
*/
port->mac_stats_reset_pending = B_TRUE;
- return;
+ return 0;
}
rc = sfc_port_reset_mac_stats(sa);
if (rc != 0)
sfc_err(sa, "failed to reset statistics (rc = %d)", rc);
+
+ SFC_ASSERT(rc >= 0);
+ return -rc;
}
static int
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
uint16_t i;
txq->tx_bytes = 0;
txq->err_pkts = 0;
}
+
+ return 0;
}
static void
return 0;
}
-static void
+static int
tap_stats_reset(struct rte_eth_dev *dev)
{
int i;
pmd->txq[i].stats.errs = 0;
pmd->txq[i].stats.obytes = 0;
}
+
+ return 0;
}
static void
return ptypes;
}
-static void
+static int
nicvf_dev_stats_reset(struct rte_eth_dev *dev)
{
int i;
struct nicvf *nic = nicvf_pmd_priv(dev);
uint16_t rx_start, rx_end;
uint16_t tx_start, tx_end;
+ int ret;
/* Reset all primary nic counters */
nicvf_rx_range(dev, nic, &rx_start, &rx_end);
for (i = tx_start; i <= tx_end; i++)
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 */
for (i = 0; i < nic->sqs_count; i++) {
for (i = tx_start; i <= tx_end; i++)
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 */
#define VHOST_NB_XSTATS_TXPORT (sizeof(vhost_txport_stat_strings) / \
sizeof(vhost_txport_stat_strings[0]))
-static void
+static int
vhost_dev_xstats_reset(struct rte_eth_dev *dev)
{
struct vhost_queue *vq = NULL;
continue;
memset(&vq->stats, 0, sizeof(vq->stats));
}
+
+ return 0;
}
static int
return 0;
}
-static void
+static int
eth_stats_reset(struct rte_eth_dev *dev)
{
struct vhost_queue *vq;
vq->stats.bytes = 0;
vq->stats.missed_pkts = 0;
}
+
+ return 0;
}
static void
static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
struct rte_eth_xstat_name *xstats_names,
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 int virtio_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
return 0;
}
-static void
+static int
virtio_dev_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
memset(rxvq->stats.size_bins, 0,
sizeof(rxvq->stats.size_bins[0]) * 8);
}
+
+ return 0;
}
static void
static void vmxnet3_hw_stats_save(struct vmxnet3_hw *hw);
static int vmxnet3_dev_stats_get(struct rte_eth_dev *dev,
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,
struct rte_eth_xstat_name *xstats,
unsigned int n);
return 0;
}
-static void
+static int
vmxnet3_dev_stats_reset(struct rte_eth_dev *dev)
{
unsigned int i;
memcpy(&hw->snapshot_rx_stats[i], &rxStats,
sizeof(hw->snapshot_rx_stats[0]));
}
+
+ return 0;
}
static int
rte_eth_stats_reset(uint16_t port_id)
{
struct rte_eth_dev *dev;
+ int ret;
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->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;
return 0;
dev = &rte_eth_devices[port_id];
/* implemented by the driver */
- if (dev->dev_ops->xstats_reset != NULL) {
- (*dev->dev_ops->xstats_reset)(dev);
- return 0;
- }
+ if (dev->dev_ops->xstats_reset != NULL)
+ return eth_err(port_id, (*dev->dev_ops->xstats_reset)(dev));
/* fallback to default */
return rte_eth_stats_reset(port_id);
* - (0) if device notified to reset stats.
* - (-ENOTSUP) if hardware doesn't support.
* - (-ENODEV) if *port_id* invalid.
+ * - (<0): Error code of the driver stats reset function.
*/
int rte_eth_stats_reset(uint16_t port_id);
* - (-ENOTSUP) if pmd doesn't support both
* extended stats and basic stats reset.
* - (-ENODEV) if *port_id* invalid.
+ * - (<0): Error code of the driver xstats reset function.
*/
int rte_eth_xstats_reset(uint16_t port_id);
struct rte_eth_stats *igb_stats);
/**< @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,
struct rte_eth_xstat *stats, unsigned n);
unsigned int n);
/**< @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,
struct rte_eth_xstat_name *xstats_names, unsigned size);