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

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