[dpdk-dev] [PATCH v3 05/21] net/virtio: dump packed virtqueue data

Tiwei Bie tiwei.bie at intel.com
Sun Apr 8 05:53:52 CEST 2018


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 at 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
> 


More information about the dev mailing list