ethdev: make stats and xstats reset callbacks return int
[dpdk.git] / drivers / net / vhost / rte_eth_vhost.c
index 57f382c..c3ba602 100644 (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) / \
                                sizeof(vhost_txport_stat_strings[0]))
 
-static void
+static int
 vhost_dev_xstats_reset(struct rte_eth_dev *dev)
 {
        struct vhost_queue *vq = NULL;
@@ -234,6 +234,8 @@ vhost_dev_xstats_reset(struct rte_eth_dev *dev)
                        continue;
                memset(&vq->stats, 0, sizeof(vq->stats));
        }
+
+       return 0;
 }
 
 static int
@@ -1054,7 +1056,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id,
        return 0;
 }
 
-static void
+static int
 eth_dev_info(struct rte_eth_dev *dev,
             struct rte_eth_dev_info *dev_info)
 {
@@ -1063,7 +1065,7 @@ eth_dev_info(struct rte_eth_dev *dev,
        internal = dev->data->dev_private;
        if (internal == NULL) {
                VHOST_LOG(ERR, "Invalid device specified\n");
-               return;
+               return -ENODEV;
        }
 
        dev_info->max_mac_addrs = 1;
@@ -1075,13 +1077,15 @@ eth_dev_info(struct rte_eth_dev *dev,
        dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS |
                                DEV_TX_OFFLOAD_VLAN_INSERT;
        dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;
+
+       return 0;
 }
 
 static int
 eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
        unsigned i;
-       unsigned long rx_total = 0, tx_total = 0, tx_missed_total = 0;
+       unsigned long rx_total = 0, tx_total = 0;
        unsigned long rx_total_bytes = 0, tx_total_bytes = 0;
        struct vhost_queue *vq;
 
@@ -1103,7 +1107,6 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
                        continue;
                vq = dev->data->tx_queues[i];
                stats->q_opackets[i] = vq->stats.pkts;
-               tx_missed_total += vq->stats.missed_pkts;
                tx_total += stats->q_opackets[i];
 
                stats->q_obytes[i] = vq->stats.bytes;
@@ -1112,14 +1115,13 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
        stats->ipackets = rx_total;
        stats->opackets = tx_total;
-       stats->oerrors = tx_missed_total;
        stats->ibytes = rx_total_bytes;
        stats->obytes = tx_total_bytes;
 
        return 0;
 }
 
-static void
+static int
 eth_stats_reset(struct rte_eth_dev *dev)
 {
        struct vhost_queue *vq;
@@ -1140,6 +1142,8 @@ eth_stats_reset(struct rte_eth_dev *dev)
                vq->stats.bytes = 0;
                vq->stats.missed_pkts = 0;
        }
+
+       return 0;
 }
 
 static void