netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH vhost v4 03/10] virtio_ring: packed: structure the indirect desc table
Date: Fri, 22 Mar 2024 13:15:10 +0800	[thread overview]
Message-ID: <CACGkMEvimfmQRUZ04CykZs-6cOkASF8S02n2N7caJ4XivR8hNw@mail.gmail.com> (raw)
In-Reply-To: <1711009465.784253-4-xuanzhuo@linux.alibaba.com>

On Thu, Mar 21, 2024 at 4:29 PM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
>
> On Thu, 21 Mar 2024 12:47:18 +0800, Jason Wang <jasowang@redhat.com> wrote:
> > On Tue, Mar 12, 2024 at 11:36 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> > >
> > > This commit structure the indirect desc table.
> > > Then we can get the desc num directly when doing unmap.
> > >
> > > And save the dma info to the struct, then the indirect
> > > will not use the dma fields of the desc_extra. The subsequent
> > > commits will make the dma fields are optional. But for
> > > the indirect case, we must record the dma info.
> > >
> > > Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> > > ---
> > >  drivers/virtio/virtio_ring.c | 66 +++++++++++++++++++++---------------
> > >  1 file changed, 38 insertions(+), 28 deletions(-)
> > >
> > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
> > > index 0dfbd17e5a87..22a588bba166 100644
> > > --- a/drivers/virtio/virtio_ring.c
> > > +++ b/drivers/virtio/virtio_ring.c
> > > @@ -72,9 +72,16 @@ struct vring_desc_state_split {
> > >         struct vring_desc *indir_desc;  /* Indirect descriptor, if any. */
> > >  };
> > >
> > > +struct vring_packed_desc_indir {
> > > +       dma_addr_t addr;                /* Descriptor Array DMA addr. */
> > > +       u32 len;                        /* Descriptor Array length. */
> > > +       u32 num;
> > > +       struct vring_packed_desc desc[];
> > > +};
> > > +
> > >  struct vring_desc_state_packed {
> > >         void *data;                     /* Data for callback. */
> > > -       struct vring_packed_desc *indir_desc; /* Indirect descriptor, if any. */
> > > +       struct vring_packed_desc_indir *indir_desc; /* Indirect descriptor, if any. */
> >
> > Maybe it's better just to have a vring_desc_extra here.
>
>
> Do you mean replacing vring_packed_desc_indir by vring_desc_extra?

Just add a vring_desc_extra in vring_desc_state_packed.

>
> I am ok for that. But vring_desc_extra has two extra items:
>
>         u16 flags;                      /* Descriptor flags. */
>         u16 next;                       /* The next desc state in a list. */
>
> vring_packed_desc_indir has "desc". I think that is more convenient.
>
> So, I think vring_packed_desc_indir is appropriate.

It reuses the existing structure so we had the chance to reuse the
helper. And it could be used for future chained indirect (if it turns
out to be necessary).

Thanks

> Or I missed something.
>
>
> Thanks.
>
>
> >
> > Thanks
> >
>


  reply	other threads:[~2024-03-22  5:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  3:35 [PATCH vhost v4 00/10] virtio: drivers maintain dma info for premapped vq Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 01/10] virtio_ring: introduce vring_need_unmap_buffer Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 02/10] virtio_ring: packed: remove double check of the unmap ops Xuan Zhuo
2024-03-21  5:57   ` Jason Wang
2024-03-21  8:20     ` Xuan Zhuo
2024-03-22  5:10       ` Jason Wang
2024-03-26  7:32       ` Michael S. Tsirkin
2024-03-27  7:11         ` Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 03/10] virtio_ring: packed: structure the indirect desc table Xuan Zhuo
2024-03-21  4:47   ` Jason Wang
2024-03-21  8:24     ` Xuan Zhuo
2024-03-22  5:15       ` Jason Wang [this message]
2024-03-22  5:55         ` Xuan Zhuo
2024-03-22  7:51         ` Xuan Zhuo
2024-03-25  7:07           ` Jason Wang
2024-03-12  3:35 ` [PATCH vhost v4 04/10] virtio_ring: split: remove double check of the unmap ops Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 05/10] virtio_ring: split: structure the indirect desc table Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 06/10] virtio_ring: no store dma info when unmap is not needed Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 07/10] virtio: find_vqs: add new parameter premapped Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 08/10] virtio_ring: export premapped to driver by struct virtqueue Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 09/10] virtio_net: set premapped mode by find_vqs() Xuan Zhuo
2024-03-12  3:35 ` [PATCH vhost v4 10/10] virtio_ring: virtqueue_set_dma_premapped support disable Xuan Zhuo
2024-03-21  6:02   ` Jason Wang
2024-03-21  8:21     ` Xuan Zhuo
2024-03-22  5:13       ` Jason Wang
2024-03-22  6:03         ` Xuan Zhuo
2024-03-25  7:10           ` Jason Wang
2024-03-19  6:56 ` [PATCH vhost v4 00/10] virtio: drivers maintain dma info for premapped vq Michael S. Tsirkin
2024-03-20  9:25   ` Jason Wang
2024-03-21  4:45 ` Jason Wang
2024-03-21  8:30   ` Xuan Zhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACGkMEvimfmQRUZ04CykZs-6cOkASF8S02n2N7caJ4XivR8hNw@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).