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

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