ethdev: remove redundant id field in xstats name lookup
[dpdk.git] / drivers / net / virtio / virtio_ethdev.c
index 19d5d8a..480daa3 100644 (file)
@@ -222,12 +222,12 @@ virtio_send_command(struct virtnet_ctl *cvq, struct virtio_pmd_ctrl *ctrl,
        virtqueue_notify(vq);
 
        rte_rmb();
-       while (vq->vq_used_cons_idx == vq->vq_ring.used->idx) {
+       while (VIRTQUEUE_NUSED(vq) == 0) {
                rte_rmb();
                usleep(100);
        }
 
-       while (vq->vq_used_cons_idx != vq->vq_ring.used->idx) {
+       while (VIRTQUEUE_NUSED(vq)) {
                uint32_t idx, desc_idx, used_idx;
                struct vring_used_elem *uep;
 
@@ -776,7 +776,7 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
        unsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_TXQ_XSTATS +
                dev->data->nb_rx_queues * VIRTIO_NB_RXQ_XSTATS;
 
-       if (xstats_names == NULL) {
+       if (xstats_names != NULL) {
                /* Note: limit checked in rte_eth_xstats_names() */
 
                for (i = 0; i < dev->data->nb_rx_queues; i++) {
@@ -788,7 +788,6 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
                                        sizeof(xstats_names[count].name),
                                        "rx_q%u_%s", i,
                                        rte_virtio_rxq_stat_strings[t].name);
-                               xstats_names[count].id = count;
                                count++;
                        }
                }
@@ -802,7 +801,6 @@ static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
                                        sizeof(xstats_names[count].name),
                                        "tx_q%u_%s", i,
                                        rte_virtio_txq_stat_strings[t].name);
-                               xstats_names[count].id = count;
                                count++;
                        }
                }
@@ -833,7 +831,6 @@ virtio_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
                unsigned t;
 
                for (t = 0; t < VIRTIO_NB_RXQ_XSTATS; t++) {
-                       xstats[count].id = count;
                        xstats[count].value = *(uint64_t *)(((char *)rxvq) +
                                rte_virtio_rxq_stat_strings[t].offset);
                        count++;
@@ -849,7 +846,6 @@ virtio_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
                unsigned t;
 
                for (t = 0; t < VIRTIO_NB_TXQ_XSTATS; t++) {
-                       xstats[count].id = count;
                        xstats[count].value = *(uint64_t *)(((char *)txvq) +
                                rte_virtio_txq_stat_strings[t].offset);
                        count++;