thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-vhost-user-add-Net-prefix-to-internal-state-structur.patch

ae23c9
From b9f8e65b1304d2d22ddadb2389a285225d2cf3f2 Mon Sep 17 00:00:00 2001
ae23c9
From: "plai@redhat.com" <plai@redhat.com>
ae23c9
Date: Thu, 21 Jun 2018 18:54:36 +0200
ae23c9
Subject: [PATCH 157/268] vhost-user: add Net prefix to internal state
ae23c9
 structure
ae23c9
ae23c9
RH-Author: plai@redhat.com
ae23c9
Message-id: <1529607285-9942-2-git-send-email-plai@redhat.com>
ae23c9
Patchwork-id: 80943
ae23c9
O-Subject: [RHEL7.6 PATCH BZ 1526645 01/10] vhost-user: add Net prefix to internal state structure
ae23c9
Bugzilla: 1526645
ae23c9
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
RH-Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
ae23c9
From: Tiwei Bie <tiwei.bie@intel.com>
ae23c9
ae23c9
We are going to introduce a shared vhost user state which
ae23c9
will be named as 'VhostUserState'. So add 'Net' prefix to
ae23c9
the existing internal state structure in the vhost-user
ae23c9
netdev to avoid conflict.
ae23c9
ae23c9
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
ae23c9
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
ae23c9
(cherry picked from commit 703878e2e0975123b1a89a006c0204c469333278)
ae23c9
Signed-off-by: Paul Lai <plai@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 net/vhost-user.c | 38 +++++++++++++++++++-------------------
ae23c9
 1 file changed, 19 insertions(+), 19 deletions(-)
ae23c9
ae23c9
diff --git a/net/vhost-user.c b/net/vhost-user.c
ae23c9
index e0f16c8..fa28aad 100644
ae23c9
--- a/net/vhost-user.c
ae23c9
+++ b/net/vhost-user.c
ae23c9
@@ -20,38 +20,38 @@
ae23c9
 #include "qemu/option.h"
ae23c9
 #include "trace.h"
ae23c9
 
ae23c9
-typedef struct VhostUserState {
ae23c9
+typedef struct NetVhostUserState {
ae23c9
     NetClientState nc;
ae23c9
     CharBackend chr; /* only queue index 0 */
ae23c9
     VHostNetState *vhost_net;
ae23c9
     guint watch;
ae23c9
     uint64_t acked_features;
ae23c9
     bool started;
ae23c9
-} VhostUserState;
ae23c9
+} NetVhostUserState;
ae23c9
 
ae23c9
 VHostNetState *vhost_user_get_vhost_net(NetClientState *nc)
ae23c9
 {
ae23c9
-    VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
ae23c9
+    NetVhostUserState *s = DO_UPCAST(NetVhostUserState, nc, nc);
ae23c9
     assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
ae23c9
     return s->vhost_net;
ae23c9
 }
ae23c9
 
ae23c9
 uint64_t vhost_user_get_acked_features(NetClientState *nc)
ae23c9
 {
ae23c9
-    VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
ae23c9
+    NetVhostUserState *s = DO_UPCAST(NetVhostUserState, nc, nc);
ae23c9
     assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER);
ae23c9
     return s->acked_features;
ae23c9
 }
ae23c9
 
ae23c9
 static void vhost_user_stop(int queues, NetClientState *ncs[])
ae23c9
 {
ae23c9
-    VhostUserState *s;
ae23c9
+    NetVhostUserState *s;
ae23c9
     int i;
ae23c9
 
ae23c9
     for (i = 0; i < queues; i++) {
ae23c9
         assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
ae23c9
 
ae23c9
-        s = DO_UPCAST(VhostUserState, nc, ncs[i]);
ae23c9
+        s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
ae23c9
 
ae23c9
         if (s->vhost_net) {
ae23c9
             /* save acked features */
ae23c9
@@ -68,7 +68,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
ae23c9
 {
ae23c9
     VhostNetOptions options;
ae23c9
     struct vhost_net *net = NULL;
ae23c9
-    VhostUserState *s;
ae23c9
+    NetVhostUserState *s;
ae23c9
     int max_queues;
ae23c9
     int i;
ae23c9
 
ae23c9
@@ -77,7 +77,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
ae23c9
     for (i = 0; i < queues; i++) {
ae23c9
         assert(ncs[i]->info->type == NET_CLIENT_DRIVER_VHOST_USER);
ae23c9
 
ae23c9
-        s = DO_UPCAST(VhostUserState, nc, ncs[i]);
ae23c9
+        s = DO_UPCAST(NetVhostUserState, nc, ncs[i]);
ae23c9
 
ae23c9
         options.net_backend = ncs[i];
ae23c9
         options.opaque      = be;
ae23c9
@@ -123,7 +123,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
ae23c9
        without GUEST_ANNOUNCE capability.
ae23c9
      */
ae23c9
     if (size == 60) {
ae23c9
-        VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
ae23c9
+        NetVhostUserState *s = DO_UPCAST(NetVhostUserState, nc, nc);
ae23c9
         int r;
ae23c9
         static int display_rarp_failure = 1;
ae23c9
         char mac_addr[6];
ae23c9
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
ae23c9
 
ae23c9
 static void vhost_user_cleanup(NetClientState *nc)
ae23c9
 {
ae23c9
-    VhostUserState *s = DO_UPCAST(VhostUserState, nc, nc);
ae23c9
+    NetVhostUserState *s = DO_UPCAST(NetVhostUserState, nc, nc);
ae23c9
 
ae23c9
     if (s->vhost_net) {
ae23c9
         vhost_net_cleanup(s->vhost_net);
ae23c9
@@ -180,7 +180,7 @@ static bool vhost_user_has_ufo(NetClientState *nc)
ae23c9
 
ae23c9
 static NetClientInfo net_vhost_user_info = {
ae23c9
         .type = NET_CLIENT_DRIVER_VHOST_USER,
ae23c9
-        .size = sizeof(VhostUserState),
ae23c9
+        .size = sizeof(NetVhostUserState),
ae23c9
         .receive = vhost_user_receive,
ae23c9
         .cleanup = vhost_user_cleanup,
ae23c9
         .has_vnet_hdr = vhost_user_has_vnet_hdr,
ae23c9
@@ -190,7 +190,7 @@ static NetClientInfo net_vhost_user_info = {
ae23c9
 static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
ae23c9
                                            void *opaque)
ae23c9
 {
ae23c9
-    VhostUserState *s = opaque;
ae23c9
+    NetVhostUserState *s = opaque;
ae23c9
 
ae23c9
     qemu_chr_fe_disconnect(&s->chr);
ae23c9
 
ae23c9
@@ -203,7 +203,7 @@ static void chr_closed_bh(void *opaque)
ae23c9
 {
ae23c9
     const char *name = opaque;
ae23c9
     NetClientState *ncs[MAX_QUEUE_NUM];
ae23c9
-    VhostUserState *s;
ae23c9
+    NetVhostUserState *s;
ae23c9
     Error *err = NULL;
ae23c9
     int queues;
ae23c9
 
ae23c9
@@ -212,7 +212,7 @@ static void chr_closed_bh(void *opaque)
ae23c9
                                           MAX_QUEUE_NUM);
ae23c9
     assert(queues < MAX_QUEUE_NUM);
ae23c9
 
ae23c9
-    s = DO_UPCAST(VhostUserState, nc, ncs[0]);
ae23c9
+    s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
ae23c9
 
ae23c9
     qmp_set_link(name, false, &err;;
ae23c9
     vhost_user_stop(queues, ncs);
ae23c9
@@ -229,7 +229,7 @@ static void net_vhost_user_event(void *opaque, int event)
ae23c9
 {
ae23c9
     const char *name = opaque;
ae23c9
     NetClientState *ncs[MAX_QUEUE_NUM];
ae23c9
-    VhostUserState *s;
ae23c9
+    NetVhostUserState *s;
ae23c9
     Chardev *chr;
ae23c9
     Error *err = NULL;
ae23c9
     int queues;
ae23c9
@@ -239,7 +239,7 @@ static void net_vhost_user_event(void *opaque, int event)
ae23c9
                                           MAX_QUEUE_NUM);
ae23c9
     assert(queues < MAX_QUEUE_NUM);
ae23c9
 
ae23c9
-    s = DO_UPCAST(VhostUserState, nc, ncs[0]);
ae23c9
+    s = DO_UPCAST(NetVhostUserState, nc, ncs[0]);
ae23c9
     chr = qemu_chr_fe_get_driver(&s->chr);
ae23c9
     trace_vhost_user_event(chr->label, event);
ae23c9
     switch (event) {
ae23c9
@@ -283,7 +283,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
ae23c9
 {
ae23c9
     Error *err = NULL;
ae23c9
     NetClientState *nc, *nc0 = NULL;
ae23c9
-    VhostUserState *s;
ae23c9
+    NetVhostUserState *s;
ae23c9
     int i;
ae23c9
 
ae23c9
     assert(name);
ae23c9
@@ -296,7 +296,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
ae23c9
         nc->queue_index = i;
ae23c9
         if (!nc0) {
ae23c9
             nc0 = nc;
ae23c9
-            s = DO_UPCAST(VhostUserState, nc, nc);
ae23c9
+            s = DO_UPCAST(NetVhostUserState, nc, nc);
ae23c9
             if (!qemu_chr_fe_init(&s->chr, chr, &err)) {
ae23c9
                 error_report_err(err);
ae23c9
                 return -1;
ae23c9
@@ -305,7 +305,7 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
ae23c9
 
ae23c9
     }
ae23c9
 
ae23c9
-    s = DO_UPCAST(VhostUserState, nc, nc0);
ae23c9
+    s = DO_UPCAST(NetVhostUserState, nc, nc0);
ae23c9
     do {
ae23c9
         if (qemu_chr_fe_wait_connected(&s->chr, &err) < 0) {
ae23c9
             error_report_err(err);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9