From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yuanhan.liu@linux.intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id B1E199AA1
 for <dev@dpdk.org>; Mon, 20 Jun 2016 12:43:06 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga103.fm.intel.com with ESMTP; 20 Jun 2016 03:43:05 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.26,497,1459839600"; d="scan'208";a="722181479"
Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162])
 by FMSMGA003.fm.intel.com with ESMTP; 20 Jun 2016 03:43:00 -0700
Date: Mon, 20 Jun 2016 18:43:56 +0800
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Remy Horton <remy.horton@intel.com>
Cc: dev@dpdk.org, Thomas Monjalon <thomas.monjalon@6wind.com>
Message-ID: <20160620104356.GG23111@yliu-dev.sh.intel.com>
References: <1466004333-18469-1-git-send-email-remy.horton@intel.com>
 <1466004333-18469-7-git-send-email-remy.horton@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1466004333-18469-7-git-send-email-remy.horton@intel.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Subject: Re: [dpdk-dev] [PATCH v5 6/7] drivers/net/virtio: change xstats to
 use integer ids
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 20 Jun 2016 10:43:07 -0000

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;
> +}