Blame SOURCES/kvm-vdpa-add-net_vhost_vdpa_cvq_info-NetClientInfo.patch

586cba
From f92b0ef80b4889ae0beb0b2a026ec3892d576d79 Mon Sep 17 00:00:00 2001
586cba
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
586cba
Date: Tue, 23 Aug 2022 20:30:32 +0200
586cba
Subject: [PATCH 17/23] vdpa: add net_vhost_vdpa_cvq_info NetClientInfo
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Eugenio Pérez <eperezma@redhat.com>
586cba
RH-MergeRequest: 116: vdpa: Restore device state on destination
586cba
RH-Bugzilla: 2114060
586cba
RH-Acked-by: Cindy Lu <lulu@redhat.com>
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Commit: [16/21] c80c9fd89e81fc389e7d02e9d764331ab9fc7a0a (eperezmartin/qemu-kvm)
586cba
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2114060
586cba
Upstream status: git@github.com:jasowang/qemu.git net-next
586cba
586cba
Next patches will add a new info callback to restore NIC status through
586cba
CVQ. Since only the CVQ vhost device is needed, create it with a new
586cba
NetClientInfo.
586cba
586cba
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
586cba
Acked-by: Jason Wang <jasowang@redhat.com>
586cba
Signed-off-by: Jason Wang <jasowang@redhat.com>
586cba
(cherry picked from commit 9d379453404303069f93f9b8163ae3805bcd8c2e)
586cba
---
586cba
 net/vhost-vdpa.c | 12 +++++++++++-
586cba
 1 file changed, 11 insertions(+), 1 deletion(-)
586cba
586cba
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
586cba
index ba65736f83..03e4cf1abc 100644
586cba
--- a/net/vhost-vdpa.c
586cba
+++ b/net/vhost-vdpa.c
586cba
@@ -334,6 +334,16 @@ static bool vhost_vdpa_net_cvq_map_elem(VhostVDPAState *s,
586cba
     return true;
586cba
 }
586cba
 
586cba
+static NetClientInfo net_vhost_vdpa_cvq_info = {
586cba
+    .type = NET_CLIENT_DRIVER_VHOST_VDPA,
586cba
+    .size = sizeof(VhostVDPAState),
586cba
+    .receive = vhost_vdpa_receive,
586cba
+    .cleanup = vhost_vdpa_cleanup,
586cba
+    .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
586cba
+    .has_ufo = vhost_vdpa_has_ufo,
586cba
+    .check_peer_type = vhost_vdpa_check_peer_type,
586cba
+};
586cba
+
586cba
 /**
586cba
  * Do not forward commands not supported by SVQ. Otherwise, the device could
586cba
  * accept it and qemu would not know how to update the device model.
586cba
@@ -475,7 +485,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
586cba
         nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device,
586cba
                                  name);
586cba
     } else {
586cba
-        nc = qemu_new_net_control_client(&net_vhost_vdpa_info, peer,
586cba
+        nc = qemu_new_net_control_client(&net_vhost_vdpa_cvq_info, peer,
586cba
                                          device, name);
586cba
     }
586cba
     snprintf(nc->info_str, sizeof(nc->info_str), TYPE_VHOST_VDPA);
586cba
-- 
586cba
2.31.1
586cba