Re: [PATCH vhost v2 08/12] virtio_ring: update document for virtqueue_add_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Mar 2023 15:58:22 +0800, Jason Wang <jasowang@xxxxxxxxxx> wrote:
> On Wed, Mar 8, 2023 at 2:44 PM Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx> wrote:
> >
> > Update the document of virtqueue_add_* series API, allowing the callers to
> > use sg->dma_address to pass the dma address to Virtio Core.
> >
> > Signed-off-by: Xuan Zhuo <xuanzhuo@xxxxxxxxxxxxxxxxx>
> > ---
> >  drivers/virtio/virtio_ring.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > index b23d301effb5..216ac8654982 100644
> > --- a/drivers/virtio/virtio_ring.c
> > +++ b/drivers/virtio/virtio_ring.c
> > @@ -2190,6 +2190,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
> >   * Caller must ensure we don't call this with other virtqueue operations
> >   * at the same time (except where noted).
> >   *
> > + * If the caller has done dma map then use sg->dma_address to pass dma address.
> > + * If one sg->dma_address is used, then all sgs must use sg->dma_address;
> > + * otherwise all sg->dma_address must be NULL.
>
> Is it worth adding checks for those requirements?

If we want to check, we need to check every SG, and I think the overhead is a
bit big.

If the driver is not implemented as these requirements, I think he will always
encounter some abnormalities when testing.

Thanks.

>
> Thanks
>
> > + *
> >   * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> >   */
> >  int virtqueue_add_sgs(struct virtqueue *_vq,
> > @@ -2224,6 +2228,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_sgs);
> >   * Caller must ensure we don't call this with other virtqueue operations
> >   * at the same time (except where noted).
> >   *
> > + * If the caller has done dma map then use sg->dma_address to pass dma address.
> > + * If one sg->dma_address is used, then all sgs must use sg->dma_address;
> > + * otherwise all sg->dma_address must be NULL.
> > + *
> >   * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> >   */
> >  int virtqueue_add_outbuf(struct virtqueue *vq,
> > @@ -2246,6 +2254,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_outbuf);
> >   * Caller must ensure we don't call this with other virtqueue operations
> >   * at the same time (except where noted).
> >   *
> > + * If the caller has done dma map then use sg->dma_address to pass dma address.
> > + * If one sg->dma_address is used, then all sgs must use sg->dma_address;
> > + * otherwise all sg->dma_address must be NULL.
> > + *
> >   * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> >   */
> >  int virtqueue_add_inbuf(struct virtqueue *vq,
> > @@ -2269,6 +2281,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_inbuf);
> >   * Caller must ensure we don't call this with other virtqueue operations
> >   * at the same time (except where noted).
> >   *
> > + * If the caller has done dma map then use sg->dma_address to pass dma address.
> > + * If one sg->dma_address is used, then all sgs must use sg->dma_address;
> > + * otherwise all sg->dma_address must be NULL.
> > + *
> >   * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
> >   */
> >  int virtqueue_add_inbuf_ctx(struct virtqueue *vq,
> > --
> > 2.32.0.3.g01195cf9f
> >
>
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux