On Thu, Dec 29, 2016 at 07:30:38AM +0000, Jianfeng Tan wrote:
>  /*
>   * Two types of mbuf to be cleaned:
>   * 1) mbuf that has been consumed by backend but not used by virtio.
> diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
> index f0bb089..62be136 100644
> --- a/drivers/net/virtio/virtqueue.h
> +++ b/drivers/net/virtio/virtqueue.h
> @@ -274,7 +274,29 @@ vring_desc_init(struct vring_desc *dp, uint16_t n)
>  /**
>   * Tell the backend not to interrupt us.
>   */
> -void virtqueue_disable_intr(struct virtqueue *vq);
> +static inline void
> +virtqueue_disable_intr(struct virtqueue *vq)
> +{
> +     /* Set VRING_AVAIL_F_NO_INTERRUPT to hint host
> +      * not to interrupt when it consumes packets
> +      * Note: this is only considered a hint to the host
> +      */
> +     vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
> +}
> +
> +/**
> + * Tell the backend to interrupt us.
> + */
> +static inline void
> +virtqueue_enable_intr(struct virtqueue *vq)
> +{
> +     /* Unset VRING_AVAIL_F_NO_INTERRUPT to hint host
> +      * to interrupt when it consumes packets
> +      * Note: this is only considered a hint to the host
> +      */

This kind of comment is a bit weird to me; it becomes weird-er when it
appears twice. Maybe we could just drop it, as the code already expains
it well (disabling interrupt regarding to NO_INTERRUPT). Or, you could
combine the two and write one comment before the two functions.

        --yliu

> +     vq->vq_ring.avail->flags &= (~VRING_AVAIL_F_NO_INTERRUPT);
> +}
> +
>  /**
>   *  Dump virtqueue internal structures, for debug purpose only.
>   */
> -- 
> 2.7.4

Reply via email to