From: Stefano Garzarella <sgarzare@redhat.com>
To: virtualization@lists.linux-foundation.org
Cc: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>,
kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
eperezma@redhat.com, stefanha@redhat.com
Subject: [PATCH v4 4/9] vringh: define the stride used for translation
Date: Fri, 24 Mar 2023 16:36:02 +0100 [thread overview]
Message-ID: <20230324153607.46836-5-sgarzare@redhat.com> (raw)
In-Reply-To: <20230324153607.46836-1-sgarzare@redhat.com>
Define a macro to be reused in the different parts of the code.
Useful for the next patches where we add more arrays to manage also
translations with user VA.
Suggested-by: Eugenio Perez Martin <eperezma@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
Notes:
v4:
- added this patch with the changes extracted from the next patch [Eugenio]
- used _STRIDE instead of _SIZE [Eugenio]
drivers/vhost/vringh.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
index 0ba3ef809e48..4aee230f7622 100644
--- a/drivers/vhost/vringh.c
+++ b/drivers/vhost/vringh.c
@@ -1141,13 +1141,15 @@ static int iotlb_translate(const struct vringh *vrh,
return ret;
}
+#define IOTLB_IOV_STRIDE 16
+
static inline int copy_from_iotlb(const struct vringh *vrh, void *dst,
void *src, size_t len)
{
u64 total_translated = 0;
while (total_translated < len) {
- struct bio_vec iov[16];
+ struct bio_vec iov[IOTLB_IOV_STRIDE];
struct iov_iter iter;
u64 translated;
int ret;
@@ -1180,7 +1182,7 @@ static inline int copy_to_iotlb(const struct vringh *vrh, void *dst,
u64 total_translated = 0;
while (total_translated < len) {
- struct bio_vec iov[16];
+ struct bio_vec iov[IOTLB_IOV_STRIDE];
struct iov_iter iter;
u64 translated;
int ret;
--
2.39.2
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2023-03-24 15:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 15:35 [PATCH v4 0/9] vdpa_sim: add support for user VA Stefano Garzarella
2023-03-24 15:35 ` [PATCH v4 1/9] vdpa: add bind_mm/unbind_mm callbacks Stefano Garzarella
2023-03-24 15:36 ` [PATCH v4 2/9] vhost-vdpa: use bind_mm/unbind_mm device callbacks Stefano Garzarella
2023-03-24 15:36 ` [PATCH v4 3/9] vringh: replace kmap_atomic() with kmap_local_page() Stefano Garzarella
2023-03-24 15:36 ` Stefano Garzarella [this message]
2023-03-24 15:39 ` [PATCH v4 5/9] vringh: support VA with iotlb Stefano Garzarella
[not found] ` <ZCWIXZbeWanvPJA3@corigine.com>
2023-03-31 7:45 ` Stefano Garzarella
2023-03-24 15:39 ` [PATCH v4 6/9] vdpa_sim: make devices agnostic for work management Stefano Garzarella
2023-03-24 15:39 ` [PATCH v4 7/9] vdpa_sim: use kthread worker Stefano Garzarella
2023-03-24 15:39 ` [PATCH v4 8/9] vdpa_sim: replace the spinlock with a mutex to protect the state Stefano Garzarella
2023-03-24 15:40 ` [PATCH v4 9/9] vdpa_sim: add support for user VA Stefano Garzarella
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=20230324153607.46836-5-sgarzare@redhat.com \
--to=sgarzare@redhat.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=eperezma@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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).