public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH v2] vhost-user: Implement an empty VHOST_USER_SEND_RARP command
Date: Fri, 24 Jan 2025 20:07:41 +0100	[thread overview]
Message-ID: <20250124190741.2313736-1-lvivier@redhat.com> (raw)

Passt cannot manage and doesn't need to manage the broadcast of a fake RARP,
but QEMU will report an error message if Passt doesn't implement it.

Implement an empty SEND_RARP command to silence QEMU error message.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 vhost_user.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/vhost_user.c b/vhost_user.c
index f12dec5ddc58..6bf0dda84d90 100644
--- a/vhost_user.c
+++ b/vhost_user.c
@@ -914,7 +914,8 @@ static bool vu_get_protocol_features_exec(struct vu_dev *vdev,
 {
 	uint64_t features = 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK |
 			    1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD |
-			    1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE;
+			    1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE |
+			    1ULL << VHOST_USER_PROTOCOL_F_RARP;
 
 	(void)vdev;
 	vmsg_set_reply_u64(msg, features);
@@ -981,6 +982,32 @@ static bool vu_set_vring_enable_exec(struct vu_dev *vdev,
 	return false;
 }
 
+/**
+ * vu_set_send_rarp_exec() - vhost-user specification says: "Broadcast a fake
+ * 			     RARP to notify the migration is terminated",
+ * 			     but passt doesn't need to update any ARP table,
+ * 			     so do nothing to silence QEMU bogus error message
+ * @vdev:	vhost-user device
+ * @vmsg:	vhost-user message
+ *
+ * Return: False as no reply is requested
+ */
+static bool vu_send_rarp_exec(struct vu_dev *vdev,
+			      struct vhost_user_msg *msg)
+{
+	char macstr[ETH_ADDRSTRLEN];
+
+	(void)vdev;
+
+	/* ignore the command */
+
+	debug("Ignore command VHOST_USER_SEND_RARP for %s",
+	      eth_ntop((unsigned char *)&msg->payload.u64, macstr,
+		       sizeof(macstr)));
+
+	return false;
+}
+
 /**
  * vu_set_migration_watch() - Add the migration file descriptor to epoll
  * @vdev:	vhost-user device
@@ -1177,6 +1204,7 @@ static bool (*vu_handle[VHOST_USER_MAX])(struct vu_dev *vdev,
 	[VHOST_USER_SET_VRING_CALL]	   = vu_set_vring_call_exec,
 	[VHOST_USER_SET_VRING_ERR]	   = vu_set_vring_err_exec,
 	[VHOST_USER_SET_VRING_ENABLE]	   = vu_set_vring_enable_exec,
+	[VHOST_USER_SEND_RARP]		   = vu_send_rarp_exec,
 	[VHOST_USER_SET_DEVICE_STATE_FD]   = vu_set_device_state_fd_exec,
 	[VHOST_USER_CHECK_DEVICE_STATE]    = vu_check_device_state_exec,
 };
-- 
@@ -914,7 +914,8 @@ static bool vu_get_protocol_features_exec(struct vu_dev *vdev,
 {
 	uint64_t features = 1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK |
 			    1ULL << VHOST_USER_PROTOCOL_F_LOG_SHMFD |
-			    1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE;
+			    1ULL << VHOST_USER_PROTOCOL_F_DEVICE_STATE |
+			    1ULL << VHOST_USER_PROTOCOL_F_RARP;
 
 	(void)vdev;
 	vmsg_set_reply_u64(msg, features);
@@ -981,6 +982,32 @@ static bool vu_set_vring_enable_exec(struct vu_dev *vdev,
 	return false;
 }
 
+/**
+ * vu_set_send_rarp_exec() - vhost-user specification says: "Broadcast a fake
+ * 			     RARP to notify the migration is terminated",
+ * 			     but passt doesn't need to update any ARP table,
+ * 			     so do nothing to silence QEMU bogus error message
+ * @vdev:	vhost-user device
+ * @vmsg:	vhost-user message
+ *
+ * Return: False as no reply is requested
+ */
+static bool vu_send_rarp_exec(struct vu_dev *vdev,
+			      struct vhost_user_msg *msg)
+{
+	char macstr[ETH_ADDRSTRLEN];
+
+	(void)vdev;
+
+	/* ignore the command */
+
+	debug("Ignore command VHOST_USER_SEND_RARP for %s",
+	      eth_ntop((unsigned char *)&msg->payload.u64, macstr,
+		       sizeof(macstr)));
+
+	return false;
+}
+
 /**
  * vu_set_migration_watch() - Add the migration file descriptor to epoll
  * @vdev:	vhost-user device
@@ -1177,6 +1204,7 @@ static bool (*vu_handle[VHOST_USER_MAX])(struct vu_dev *vdev,
 	[VHOST_USER_SET_VRING_CALL]	   = vu_set_vring_call_exec,
 	[VHOST_USER_SET_VRING_ERR]	   = vu_set_vring_err_exec,
 	[VHOST_USER_SET_VRING_ENABLE]	   = vu_set_vring_enable_exec,
+	[VHOST_USER_SEND_RARP]		   = vu_send_rarp_exec,
 	[VHOST_USER_SET_DEVICE_STATE_FD]   = vu_set_device_state_fd_exec,
 	[VHOST_USER_CHECK_DEVICE_STATE]    = vu_check_device_state_exec,
 };
-- 
2.48.1


             reply	other threads:[~2025-01-24 19:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 19:07 Laurent Vivier [this message]
2025-01-24 21:19 ` [PATCH v2] vhost-user: Implement an empty VHOST_USER_SEND_RARP command Stefano Brivio

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=20250124190741.2313736-1-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).