On Wed, Jun 15, 2016 at 04:25:32PM +0100, Remy Horton wrote:
>  
> +static int virtio_dev_xstats_get_names(struct rte_eth_dev *dev,
> +                                    struct rte_eth_xstat_name *xstats_names,
> +                                    __rte_unused unsigned limit)
> +{
> +     unsigned i;
> +     unsigned count = 0;
> +     unsigned t;
> +
> +     unsigned nstats = dev->data->nb_tx_queues * VIRTIO_NB_Q_XSTATS +
> +             dev->data->nb_rx_queues * VIRTIO_NB_Q_XSTATS;
> +
> +     if (xstats_names == NULL) {
> +             /* Note: limit checked in rte_eth_xstats_names() */
> +

That crashes testpmd while I run "show port xstats 0" with virtio PMD.
Will send a fix soon.

BTW, would you CC to the maintainer for corresponding subsystems next
time, say CC me for virtio/vhost changes?

        --yliu

> +             for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +                     struct virtqueue *rxvq = dev->data->rx_queues[i];
> +                     if (rxvq == NULL)
> +                             continue;
> +                     for (t = 0; t < VIRTIO_NB_Q_XSTATS; t++) {
> +                             snprintf(xstats_names[count].name,
> +                                     sizeof(xstats_names[count].name),
> +                                     "rx_q%u_%s", i,
> +                                     rte_virtio_q_stat_strings[t].name);
> +                             xstats_names[count].id = count;
> +                             count++;
> +                     }
> +             }
> +
> +             for (i = 0; i < dev->data->nb_tx_queues; i++) {
> +                     struct virtqueue *txvq = dev->data->tx_queues[i];
> +                     if (txvq == NULL)
> +                             continue;
> +                     for (t = 0; t < VIRTIO_NB_Q_XSTATS; t++) {
> +                             snprintf(xstats_names[count].name,
> +                                     sizeof(xstats_names[count].name),
> +                                     "tx_q%u_%s", i,
> +                                     rte_virtio_q_stat_strings[t].name);
> +                             xstats_names[count].id = count;
> +                             count++;
> +                     }
> +             }
> +             return count;
> +     }
> +     return nstats;
> +}

Reply via email to