From: Tiwei Bie <tiwei.bie@intel.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: jasowang@redhat.com, wexu@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
jfreimann@redhat.com
Subject: Re: [RFC v2] virtio: support packed ring
Date: Sat, 14 Apr 2018 19:22:11 +0800 [thread overview]
Message-ID: <20180414112211.pf6on4mzewb2d56c@debian> (raw)
In-Reply-To: <20180413181808-mutt-send-email-mst@kernel.org>
On Fri, Apr 13, 2018 at 06:22:45PM +0300, Michael S. Tsirkin wrote:
> On Sun, Apr 01, 2018 at 10:12:16PM +0800, Tiwei Bie wrote:
> > +static inline bool more_used(const struct vring_virtqueue *vq)
> > +{
> > + return vq->packed ? more_used_packed(vq) : more_used_split(vq);
> > +}
> > +
> > +void *virtqueue_get_buf_ctx_split(struct virtqueue *_vq, unsigned int *len,
> > + void **ctx)
> > +{
> > + struct vring_virtqueue *vq = to_vvq(_vq);
> > + void *ret;
> > + unsigned int i;
> > + u16 last_used;
> > +
> > + START_USE(vq);
> > +
> > + if (unlikely(vq->broken)) {
> > + END_USE(vq);
> > + return NULL;
> > + }
> > +
> > + if (!more_used(vq)) {
> > + pr_debug("No more buffers in queue\n");
> > + END_USE(vq);
> > + return NULL;
> > + }
>
> So virtqueue_get_buf_ctx_split should only call more_used_split.
Yeah, you're right! Will fix this in the next version.
>
> to avoid such issues I think we should lay out the code like this:
>
> XXX_split
>
> XXX_packed
>
> XXX wrappers
I'll do it. Thanks for the suggestion!
>
> > +/* The standard layout
>
> I'd drop standard here.
Got it. I'll drop the word "standard".
>
> > for the packed ring is a continuous chunk of memory
> > + * which looks like this.
> > + *
> > + * struct vring_packed
> > + * {
>
> Can the opening bracket go on the prev line pls?
Sure.
>
> > + * // The actual descriptors (16 bytes each)
> > + * struct vring_packed_desc desc[num];
> > + *
> > + * // Padding to the next align boundary.
> > + * char pad[];
> > + *
> > + * // Driver Event Suppression
> > + * struct vring_packed_desc_event driver;
> > + *
> > + * // Device Event Suppression
> > + * struct vring_packed_desc_event device;
>
> Maybe that's how our driver does it but it's not based on spec
> so I don't think this belongs in the header.
I will move it to the place where vring_packed_init()
is defined.
>
> > + * };
> > + */
> > +
> > +static inline unsigned vring_packed_size(unsigned int num, unsigned long align)
> > +{
> > + return ((sizeof(struct vring_packed_desc) * num + align - 1)
> > + & ~(align - 1)) + sizeof(struct vring_packed_desc_event) * 2;
> > +}
> > +
>
> Cant say this API makes sense for me.
Hmm, do you have any suggestion? Also move it out of this header?
Thanks for the review! :)
Best regards,
Tiwei Bie
>
>
> > #endif /* _UAPI_LINUX_VIRTIO_RING_H */
> > --
> > 2.11.0
next prev parent reply other threads:[~2018-04-14 11:24 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-01 14:12 [RFC v2] virtio: support packed ring Tiwei Bie
2018-04-10 2:55 ` Jason Wang
2018-04-10 2:55 ` Jason Wang
2018-04-10 3:21 ` Tiwei Bie
2018-04-10 3:21 ` Tiwei Bie
2018-04-13 4:30 ` Jason Wang
2018-04-13 7:15 ` Tiwei Bie
2018-04-13 7:15 ` Tiwei Bie
2018-04-17 2:11 ` Jason Wang
2018-04-17 2:17 ` Michael S. Tsirkin
2018-04-17 2:17 ` Michael S. Tsirkin
2018-04-17 2:24 ` Jason Wang
2018-04-17 2:37 ` Michael S. Tsirkin
2018-04-17 2:37 ` Michael S. Tsirkin
2018-04-17 2:24 ` Jason Wang
2018-04-17 2:51 ` Tiwei Bie
2018-04-17 2:51 ` Tiwei Bie
2018-04-17 12:17 ` Michael S. Tsirkin
2018-04-17 12:47 ` Tiwei Bie
2018-04-17 12:47 ` Tiwei Bie
2018-04-17 14:04 ` Michael S. Tsirkin
2018-04-17 14:56 ` Tiwei Bie
2018-04-17 14:56 ` Tiwei Bie
2018-04-17 15:54 ` Michael S. Tsirkin
2018-04-18 1:17 ` Tiwei Bie
2018-04-18 1:17 ` Tiwei Bie
2018-04-17 15:54 ` Michael S. Tsirkin
2018-04-17 14:04 ` Michael S. Tsirkin
2018-04-17 12:17 ` Michael S. Tsirkin
2018-04-17 2:11 ` Jason Wang
2018-04-13 4:30 ` Jason Wang
2018-04-13 15:22 ` Michael S. Tsirkin
2018-04-13 15:22 ` Michael S. Tsirkin
2018-04-14 11:22 ` Tiwei Bie [this message]
2018-04-14 11:22 ` Tiwei Bie
2018-04-23 5:42 ` Jason Wang
2018-04-23 9:29 ` Tiwei Bie
2018-04-23 9:29 ` Tiwei Bie
2018-04-24 0:54 ` Jason Wang
2018-04-24 0:54 ` Jason Wang
2018-04-24 1:05 ` Michael S. Tsirkin
2018-04-24 1:05 ` Michael S. Tsirkin
2018-04-24 1:14 ` Jason Wang
2018-04-24 1:14 ` Jason Wang
2018-04-24 1:16 ` Tiwei Bie
2018-04-24 1:29 ` Michael S. Tsirkin
2018-04-24 1:37 ` Tiwei Bie
2018-04-24 1:43 ` Michael S. Tsirkin
2018-04-24 1:43 ` Michael S. Tsirkin
2018-04-24 1:49 ` Tiwei Bie
2018-04-24 1:49 ` Tiwei Bie
2018-04-24 1:37 ` Tiwei Bie
2018-04-24 1:29 ` Michael S. Tsirkin
2018-04-24 1:16 ` Tiwei Bie
2018-04-23 5:42 ` Jason Wang
-- strict thread matches above, loose matches on Subject: below --
2018-04-01 14:12 Tiwei Bie
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=20180414112211.pf6on4mzewb2d56c@debian \
--to=tiwei.bie@intel.com \
--cc=jasowang@redhat.com \
--cc=jfreimann@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wexu@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.