From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tiwei.bie@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id C86771C82E
 for <dev@dpdk.org>; Sun,  8 Apr 2018 05:55:56 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 07 Apr 2018 20:55:54 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.48,421,1517904000"; d="scan'208";a="48893566"
Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164])
 by orsmga002.jf.intel.com with ESMTP; 07 Apr 2018 20:55:53 -0700
Date: Sun, 8 Apr 2018 11:53:52 +0800
From: Tiwei Bie <tiwei.bie@intel.com>
To: Jens Freimann <jfreimann@redhat.com>
Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com,
 mst@redhat.com
Message-ID: <20180408035351.cjuoo3uxef6h76tw@debian>
References: <20180405101031.26468-1-jfreimann@redhat.com>
 <20180405101031.26468-6-jfreimann@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <20180405101031.26468-6-jfreimann@redhat.com>
User-Agent: NeoMutt/20170113 (1.7.2)
Subject: Re: [dpdk-dev] [PATCH v3 05/21] net/virtio: dump packed virtqueue
	data
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://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: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Apr 2018 03:55:57 -0000

On Thu, Apr 05, 2018 at 12:10:15PM +0200, Jens Freimann wrote:
> Add support to dump packed virtqueue data to the
> VIRTQUEUE_DUMP() macro.
> 
> Signed-off-by: Jens Freimann <jfreimann@redhat.com>
> ---
>  drivers/net/virtio/virtqueue.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
> index cc2e7c0f6..7e265bf93 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -360,6 +360,13 @@ virtqueue_notify(struct virtqueue *vq)
>  
>  #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP
>  #define VIRTQUEUE_DUMP(vq) do { \
> +       if (vtpci_packed_queue((vq)->hw)) { \
> +         PMD_INIT_LOG(DEBUG, \
> +         "VQ: - size=%d; free=%d; last_used_idx=%d;" \

You missed the `,` after the format string.

> +         (vq)->vq_nentries, (vq)->vq_free_cnt, nused); \

There is no way to make sure that nused (the last param
in PMD_INIT_LOG()) will be defined and have the meaning
of last_used_idx. It's not the right way to use a variable
in MACRO.

> +         break; \
> +         } \
> +	if (vtpci_packed_queue((vq)->hw)) break; \

Why do the check twice?


>  	uint16_t used_idx, nused; \
>  	used_idx = (vq)->vq_ring.used->idx; \
>  	nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \
> -- 
> 2.14.3
>