1b95bd6fa114 ("vhost_user: fix multibuffer from linux") introduces
multibuffer with TX (from the guest), but with iPXE we need to handle
also multibuffer for RX (to the guest). This patch makes the parameter
generic and global.
No functional change.
Signed-off-by: Laurent Vivier
Reviewed-by: David Gibson
---
vu_common.c | 6 ++----
vu_common.h | 2 ++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/vu_common.c b/vu_common.c
index 94bd8d789a91..3225aca53ea6 100644
--- a/vu_common.c
+++ b/vu_common.c
@@ -20,8 +20,6 @@
#include "migrate.h"
#include "epoll_ctl.h"
-#define VU_MAX_TX_BUFFER_NB 2
-
/**
* vu_packet_check_range() - Check if a given memory zone is contained in
* a mapped guest memory region
@@ -203,11 +201,11 @@ static void vu_handle_tx(struct vu_dev *vdev, int index,
count = 0;
out_sg_count = 0;
while (count < ARRAY_SIZE(elem) &&
- out_sg_count + VU_MAX_TX_BUFFER_NB <= VIRTQUEUE_MAX_SIZE) {
+ out_sg_count + IOV_PER_ELEM <= VIRTQUEUE_MAX_SIZE) {
int ret;
struct iov_tail data;
- elem[count].out_num = VU_MAX_TX_BUFFER_NB;
+ elem[count].out_num = IOV_PER_ELEM;
elem[count].out_sg = &out_sg[out_sg_count];
elem[count].in_num = 0;
elem[count].in_sg = NULL;
diff --git a/vu_common.h b/vu_common.h
index c47e06885e3f..47490d91a57d 100644
--- a/vu_common.h
+++ b/vu_common.h
@@ -15,6 +15,8 @@
#include "ip.h"
#include "virtio.h"
+#define IOV_PER_ELEM (2)
+
static inline void *vu_eth(void *base)
{
return ((char *)base + VNET_HLEN);
--
2.53.0