qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: zwu.kernel@gmail.com
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com,
	jan.kiszka@siemens.com, Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>,
	luowenj@cn.ibm.com, pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH v4 06/16] net: Remove vlan qdev property
Date: Mon,  4 Jun 2012 13:29:17 +0800	[thread overview]
Message-ID: <1338787767-3443-7-git-send-email-zwu.kernel@gmail.com> (raw)
In-Reply-To: <1338787767-3443-1-git-send-email-zwu.kernel@gmail.com>

From: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

The vlan feature is implemented using hubs and no longer uses
special-purpose VLANState structs that are accessible as qdev
properties.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 hw/qdev-properties.c |   72 --------------------------------------------------
 hw/qdev.c            |    2 -
 hw/qdev.h            |    4 ---
 net.h                |    3 --
 4 files changed, 0 insertions(+), 81 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index b7b5597..d2e2afb 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -623,71 +623,6 @@ PropertyInfo qdev_prop_netdev = {
     .set   = set_netdev,
 };
 
-/* --- vlan --- */
-
-static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-    VLANState **ptr = qdev_get_prop_ptr(dev, prop);
-
-    if (*ptr) {
-        return snprintf(dest, len, "%d", (*ptr)->id);
-    } else {
-        return snprintf(dest, len, "<null>");
-    }
-}
-
-static void get_vlan(Object *obj, Visitor *v, void *opaque,
-                     const char *name, Error **errp)
-{
-    DeviceState *dev = DEVICE(obj);
-    Property *prop = opaque;
-    VLANState **ptr = qdev_get_prop_ptr(dev, prop);
-    int64_t id;
-
-    id = *ptr ? (*ptr)->id : -1;
-    visit_type_int(v, &id, name, errp);
-}
-
-static void set_vlan(Object *obj, Visitor *v, void *opaque,
-                     const char *name, Error **errp)
-{
-    DeviceState *dev = DEVICE(obj);
-    Property *prop = opaque;
-    VLANState **ptr = qdev_get_prop_ptr(dev, prop);
-    Error *local_err = NULL;
-    int64_t id;
-    VLANState *vlan;
-
-    if (dev->state != DEV_STATE_CREATED) {
-        error_set(errp, QERR_PERMISSION_DENIED);
-        return;
-    }
-
-    visit_type_int(v, &id, name, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
-    if (id == -1) {
-        *ptr = NULL;
-        return;
-    }
-    vlan = qemu_find_vlan(id, 1);
-    if (!vlan) {
-        error_set(errp, QERR_INVALID_PARAMETER_VALUE,
-                  name, prop->info->name);
-        return;
-    }
-    *ptr = vlan;
-}
-
-PropertyInfo qdev_prop_vlan = {
-    .name  = "vlan",
-    .print = print_vlan,
-    .get   = get_vlan,
-    .set   = set_vlan,
-};
-
 /* --- pointer --- */
 
 /* Not a proper property, just for dirty hacks.  TODO Remove it!  */
@@ -1094,13 +1029,6 @@ void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *v
     assert_no_error(errp);
 }
 
-void qdev_prop_set_vlan(DeviceState *dev, const char *name, VLANState *value)
-{
-    Error *errp = NULL;
-    object_property_set_int(OBJECT(dev), value ? value->id : -1, name, &errp);
-    assert_no_error(errp);
-}
-
 void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value)
 {
     Error *errp = NULL;
diff --git a/hw/qdev.c b/hw/qdev.c
index 6a8f6bd..49dd303 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -316,8 +316,6 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
 {
     qdev_prop_set_macaddr(dev, "mac", nd->macaddr.a);
-    if (nd->vlan)
-        qdev_prop_set_vlan(dev, "vlan", nd->vlan);
     if (nd->netdev)
         qdev_prop_set_netdev(dev, "netdev", nd->netdev);
     if (nd->nvectors != DEV_NVECTORS_UNSPECIFIED &&
diff --git a/hw/qdev.h b/hw/qdev.h
index 4e90119..0a50a40 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -222,7 +222,6 @@ extern PropertyInfo qdev_prop_macaddr;
 extern PropertyInfo qdev_prop_losttickpolicy;
 extern PropertyInfo qdev_prop_drive;
 extern PropertyInfo qdev_prop_netdev;
-extern PropertyInfo qdev_prop_vlan;
 extern PropertyInfo qdev_prop_pci_devfn;
 extern PropertyInfo qdev_prop_blocksize;
 
@@ -277,8 +276,6 @@ extern PropertyInfo qdev_prop_blocksize;
     DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
 #define DEFINE_PROP_NETDEV(_n, _s, _f)             \
     DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, VLANClientState*)
-#define DEFINE_PROP_VLAN(_n, _s, _f)             \
-    DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, VLANState*)
 #define DEFINE_PROP_DRIVE(_n, _s, _f) \
     DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockDriverState *)
 #define DEFINE_PROP_MACADDR(_n, _s, _f)         \
@@ -305,7 +302,6 @@ void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
 void qdev_prop_set_string(DeviceState *dev, const char *name, char *value);
 void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value);
 void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *value);
-void qdev_prop_set_vlan(DeviceState *dev, const char *name, VLANState *value);
 int qdev_prop_set_drive(DeviceState *dev, const char *name, BlockDriverState *value) QEMU_WARN_UNUSED_RESULT;
 void qdev_prop_set_drive_nofail(DeviceState *dev, const char *name, BlockDriverState *value);
 void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
diff --git a/net.h b/net.h
index d3d6e4c..7d18b10 100644
--- a/net.h
+++ b/net.h
@@ -16,14 +16,12 @@ struct MACAddr {
 
 typedef struct NICConf {
     MACAddr macaddr;
-    VLANState *vlan;
     VLANClientState *peer;
     int32_t bootindex;
 } NICConf;
 
 #define DEFINE_NIC_PROPERTIES(_state, _conf)                            \
     DEFINE_PROP_MACADDR("mac",   _state, _conf.macaddr),                \
-    DEFINE_PROP_VLAN("vlan",     _state, _conf.vlan),                   \
     DEFINE_PROP_NETDEV("netdev", _state, _conf.peer),                   \
     DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1)
 
@@ -134,7 +132,6 @@ struct NICInfo {
     char *model;
     char *name;
     char *devaddr;
-    VLANState *vlan;
     VLANClientState *netdev;
     int used;         /* is this slot in nd_table[] being used? */
     int instantiated; /* does this NICInfo correspond to an instantiated NIC? */
-- 
1.7.6

  parent reply	other threads:[~2012-06-04  5:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04  5:29 [Qemu-devel] [PATCH v4 00/16] hub-based networking patches zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 01/16] net: Add a hub net client zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 02/16] net: Use hubs for the vlan feature zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 03/16] net: Look up 'vlan' net clients using hubs zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 04/16] hub: Check that hubs are configured correctly zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 05/16] net: Drop vlan argument to qemu_new_net_client() zwu.kernel
2012-06-04  5:29 ` zwu.kernel [this message]
2012-06-08 13:23   ` [Qemu-devel] [PATCH v4 06/16] net: Remove vlan qdev property Stefan Hajnoczi
2012-06-08 14:48     ` Zhi Yong Wu
2012-06-08 16:09       ` Stefan Hajnoczi
2012-06-09  3:04         ` Zhi Yong Wu
2012-06-11  6:28           ` Paolo Bonzini
2012-06-11  8:57             ` Stefan Hajnoczi
2012-06-11 14:24               ` Zhi Yong Wu
2012-06-11 14:42                 ` Stefan Hajnoczi
2012-06-12  0:54                   ` Zhi Yong Wu
2012-06-11 14:15             ` Zhi Yong Wu
2012-06-11 20:05               ` Luiz Capitulino
2012-06-12  0:55                 ` Zhi Yong Wu
2012-06-11 20:49             ` Anthony Liguori
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 07/16] net: Remove vlan code from net.c zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 08/16] net: Remove VLANState zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 09/16] net: Rename non_vlan_clients to net_clients zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 10/16] net: Rename VLANClientState to NetClientState zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 11/16] net: Rename vc local variables to nc zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 12/16] net: Rename qemu_del_vlan_client() to qemu_del_net_client() zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 13/16] net: Make "info network" output more readable info zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 14/16] net: cleanup deliver/deliver_iov func pointers zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 15/16] net: determine if packets can be sent before net queue deliver packets zwu.kernel
2012-06-04  5:29 ` [Qemu-devel] [PATCH v4 16/16] hub: add the support for hub own flow control zwu.kernel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338787767-3443-7-git-send-email-zwu.kernel@gmail.com \
    --to=zwu.kernel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=luowenj@cn.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=wuzhy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).