[dpdk-dev,v3,05/21] net/virtio: dump packed virtqueue data
Checks
Commit Message
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(+)
Comments
On 04/05/2018 12:10 PM, 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;" \
> + (vq)->vq_nentries, (vq)->vq_free_cnt, nused); \
> + break; \
> + } \
> + if (vtpci_packed_queue((vq)->hw)) break; \
> uint16_t used_idx, nused; \
> used_idx = (vq)->vq_ring.used->idx; \
> nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
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
>
@@ -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;" \
+ (vq)->vq_nentries, (vq)->vq_free_cnt, nused); \
+ break; \
+ } \
+ if (vtpci_packed_queue((vq)->hw)) break; \
uint16_t used_idx, nused; \
used_idx = (vq)->vq_ring.used->idx; \
nused = (uint16_t)(used_idx - (vq)->vq_used_cons_idx); \