diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2023-04-04 15:13:21 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-04-21 03:02:33 -0400 |
commit | f609d6cbb36ab1c9c7434f67d555c57a2f7d3dde (patch) | |
tree | bdb0f24ba2b00a3dd6587f65b498ff139bdb0304 /drivers/vhost | |
parent | c0371782500c5314741da9ccbfbf0375a0d379fc (diff) |
vringh: define the stride used for translation
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>
Message-Id: <20230404131326.44403-5-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/vringh.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index a98adc469f19..3d5f6bb4ac31 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; |