[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/51] vhost-user: Refactor vhost acked features saving
From: |
Michael S. Tsirkin |
Subject: |
[PULL 12/51] vhost-user: Refactor vhost acked features saving |
Date: |
Thu, 5 Jan 2023 04:14:55 -0500 |
From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Abstract vhost acked features saving into
vhost_user_save_acked_features, export it as util function.
Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Message-Id:
<50dc9b09b0635e3052551efcc1046c2a85332fcb.1671627406.git.huangy81@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/net/vhost-user.h | 1 +
net/vhost-user.c | 21 +++++++++++++++------
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/include/net/vhost-user.h b/include/net/vhost-user.h
index 5bcd8a6285..35bf619709 100644
--- a/include/net/vhost-user.h
+++ b/include/net/vhost-user.h
@@ -14,5 +14,6 @@
struct vhost_net;
struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc);
uint64_t vhost_user_get_acked_features(NetClientState *nc);
+void vhost_user_save_acked_features(NetClientState *nc);
#endif /* VHOST_USER_H */
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 3a6b90da86..f5cb095d5c 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -45,10 +45,23 @@ uint64_t vhost_user_get_acked_features(NetClientState *nc)
return s->acked_features;
}
-static void vhost_user_stop(int queues, NetClientState *ncs[])
+void vhost_user_save_acked_features(NetClientState *nc)
{
NetVhostUserState *s;
+
+ s = DO_UPCAST(NetVhostUserState, nc, nc);
+ if (s->vhost_net) {
+ uint64_t features = vhost_net_get_acked_features(s->vhost_net);
+ if (features) {
+ s->acked_features = features;
+ }
+ }
+}
+
+static void vhost_user_stop(int queues, NetClientState *ncs[])
+{
int i;
+ NetVhostUserState *s;
for (i = 0; i < queues; i++) {
assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
@@ -56,11 +69,7 @@ static void vhost_user_stop(int queues, NetClientState
*ncs[])
s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
if (s->vhost_net) {
- /* save acked features */
- uint64_t features = vhost_net_get_acked_features(s->vhost_net);
- if (features) {
- s->acked_features = features;
- }
+ vhost_user_save_acked_features(ncs[i]);
vhost_net_cleanup(s->vhost_net);
}
}
--
MST
- [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it, (continued)
- [PULL 02/51] virtio_net: copy VIRTIO_NET_S_ANNOUNCE if device model has it, Michael S. Tsirkin, 2023/01/05
- [PULL 03/51] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail, Michael S. Tsirkin, 2023/01/05
- [PULL 04/51] vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa, Michael S. Tsirkin, 2023/01/05
- [PULL 05/51] hw/acpi/Kconfig: Rename ACPI_X86_ICH to ACPI_ICH9, Michael S. Tsirkin, 2023/01/05
- [PULL 06/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_ICH9, Michael S. Tsirkin, 2023/01/05
- [PULL 07/51] hw/acpi/Kconfig: Do not needlessly build TYPE_PIIX4_PM in non-PC/Malta machines, Michael S. Tsirkin, 2023/01/05
- [PULL 08/51] hw/acpi/Kconfig: Add missing dependencies to ACPI_PIIX4, Michael S. Tsirkin, 2023/01/05
- [PULL 09/51] hw/isa/Kconfig: Add missing dependency to VT82C686, Michael S. Tsirkin, 2023/01/05
- [PULL 10/51] i386, mips: Resolve redundant ACPI and APM dependencies, Michael S. Tsirkin, 2023/01/05
- [PULL 11/51] hw/ppc/Kconfig: Remove unused dependencies from PEGASOS2, Michael S. Tsirkin, 2023/01/05
- [PULL 12/51] vhost-user: Refactor vhost acked features saving,
Michael S. Tsirkin <=
- [PULL 13/51] vhost-user: Refactor the chr_closed_bh, Michael S. Tsirkin, 2023/01/05
- [PULL 14/51] vhost-user: Fix the virtio features negotiation flaw, Michael S. Tsirkin, 2023/01/05
- [PULL 16/51] virtio-pci: decouple notifier from interrupt process, Michael S. Tsirkin, 2023/01/05
- [PULL 17/51] virtio-pci: decouple the single vector from the interrupt process, Michael S. Tsirkin, 2023/01/05
- [PULL 15/51] virtio: introduce macro VIRTIO_CONFIG_IRQ_IDX, Michael S. Tsirkin, 2023/01/05
- [PULL 18/51] vhost: introduce new VhostOps vhost_set_config_call, Michael S. Tsirkin, 2023/01/05
- [PULL 20/51] virtio: add support for configure interrupt, Michael S. Tsirkin, 2023/01/05
- [PULL 23/51] virtio-mmio: add support for configure interrupt, Michael S. Tsirkin, 2023/01/05
- [PULL 19/51] vhost-vdpa: add support for config interrupt, Michael S. Tsirkin, 2023/01/05
- [PULL 21/51] vhost: add support for configure interrupt, Michael S. Tsirkin, 2023/01/05