@@ -497,8 +497,9 @@ static void integratorcp_init(ram_addr_t ram_size,
sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
- if (nd_table[0].vlan)
+ if (nd_table[0].used) {
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
+ }
sysbus_create_simple("pl110", 0xc0000000, pic[22]);
@@ -239,8 +239,9 @@ static void mcf5208evb_init(ram_addr_t ram_size,
fprintf(stderr, "Too many NICs\n");
exit(1);
}
- if (nd_table[0].vlan)
+ if (nd_table[0].used) {
mcf_fec_init(&nd_table[0], 0xfc030000, pic + 36);
+ }
/* 0xfc000000 SCM. */
/* 0xfc004000 XBS. */
@@ -187,9 +187,10 @@ mips_mipssim_init (ram_addr_t ram_size,
if (serial_hds[0])
serial_init(0x3f8, env->irq[4], 115200, serial_hds[0]);
- if (nd_table[0].vlan)
+ if (nd_table[0].used) {
/* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
+ }
}
static QEMUMachine mips_mipssim_machine = {
@@ -265,8 +265,9 @@ void mips_r4k_init (ram_addr_t ram_size,
isa_vga_init();
- if (nd_table[0].vlan)
+ if (nd_table[0].used) {
isa_ne2000_init(0x300, 9, &nd_table[0]);
+ }
if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
fprintf(stderr, "qemu: too many IDE bus\n");
@@ -299,71 +299,6 @@ PropertyInfo qdev_prop_net_client = {
.print = print_net_client,
};
-/* --- netdev device --- */
-
-static int parse_netdev(DeviceState *dev, Property *prop, const char *str)
-{
- VLANClientState **ptr = qdev_get_prop_ptr(dev, prop);
-
- *ptr = qemu_find_netdev(str);
- if (*ptr == NULL)
- return -1;
- return 0;
-}
-
-static int print_netdev(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
- VLANClientState **ptr = qdev_get_prop_ptr(dev, prop);
-
- if (*ptr && (*ptr)->name) {
- return snprintf(dest, len, "%s", (*ptr)->name);
- } else {
- return snprintf(dest, len, "<null>");
- }
-}
-
-PropertyInfo qdev_prop_netdev = {
- .name = "netdev",
- .type = PROP_TYPE_NETDEV,
- .size = sizeof(VLANClientState*),
- .parse = parse_netdev,
- .print = print_netdev,
-};
-
-/* --- vlan --- */
-
-static int parse_vlan(DeviceState *dev, Property *prop, const char *str)
-{
- VLANState **ptr = qdev_get_prop_ptr(dev, prop);
- int id;
-
- if (sscanf(str, "%d", &id) != 1)
- return -1;
- *ptr = qemu_find_vlan(id, 1);
- if (*ptr == NULL)
- return -1;
- return 0;
-}
-
-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>");
- }
-}
-
-PropertyInfo qdev_prop_vlan = {
- .name = "vlan",
- .type = PROP_TYPE_VLAN,
- .size = sizeof(VLANClientState*),
- .parse = parse_vlan,
- .print = print_vlan,
-};
-
/* --- pointer --- */
static int print_ptr(DeviceState *dev, Property *prop, char *dest, size_t len)
@@ -583,16 +518,6 @@ void qdev_prop_set_net_client(DeviceState *dev, const char *name, VLANClientStat
qdev_prop_set(dev, name, &value, PROP_TYPE_NET_CLIENT);
}
-void qdev_prop_set_netdev(DeviceState *dev, const char *name, VLANClientState *value)
-{
- qdev_prop_set(dev, name, &value, PROP_TYPE_NETDEV);
-}
-
-void qdev_prop_set_vlan(DeviceState *dev, const char *name, VLANState *value)
-{
- qdev_prop_set(dev, name, &value, PROP_TYPE_VLAN);
-}
-
void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value)
{
qdev_prop_set(dev, name, value, PROP_TYPE_MACADDR);
@@ -369,10 +369,6 @@ void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
if (nd->vc) {
qdev_prop_set_net_client(dev, "net-client", nd->vc);
}
- 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 != NIC_NVECTORS_UNSPECIFIED &&
qdev_prop_exists(dev, "vectors")) {
qdev_prop_set_uint32(dev, "vectors", nd->nvectors);
@@ -80,8 +80,6 @@ enum PropertyType {
PROP_TYPE_CHR,
PROP_TYPE_STRING,
PROP_TYPE_NET_CLIENT,
- PROP_TYPE_NETDEV,
- PROP_TYPE_VLAN,
PROP_TYPE_PTR,
};
@@ -196,8 +194,6 @@ extern PropertyInfo qdev_prop_ptr;
extern PropertyInfo qdev_prop_macaddr;
extern PropertyInfo qdev_prop_drive;
extern PropertyInfo qdev_prop_net_client;
-extern PropertyInfo qdev_prop_netdev;
-extern PropertyInfo qdev_prop_vlan;
extern PropertyInfo qdev_prop_pci_devfn;
#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \
@@ -239,10 +235,6 @@ extern PropertyInfo qdev_prop_pci_devfn;
DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
#define DEFINE_PROP_NET_CLIENT(_n, _s, _f) \
DEFINE_PROP(_n, _s, _f, qdev_prop_net_client, VLANClientState *)
-#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, DriveInfo*)
#define DEFINE_PROP_MACADDR(_n, _s, _f) \
@@ -263,8 +255,6 @@ void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value);
void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
void qdev_prop_set_chr(DeviceState *dev, const char *name, CharDriverState *value);
void qdev_prop_set_net_client(DeviceState *dev, const char *name, VLANClientState *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);
void qdev_prop_set_drive(DeviceState *dev, const char *name, DriveInfo *value);
void qdev_prop_set_macaddr(DeviceState *dev, const char *name, uint8_t *value);
/* FIXME: Remove opaque pointer properties. */
@@ -77,7 +77,7 @@ static void syborg_init(ram_addr_t ram_size,
sysbus_create_simple("syborg,serial", 0xC0008000, pic[7]);
sysbus_create_simple("syborg,serial", 0xC0009000, pic[8]);
- if (nd_table[0].vlan || nd_table[0].netdev) {
+ if (nd_table[0].used) {
DeviceState *dev;
SysBusDevice *s;
@@ -126,15 +126,16 @@ int xen_config_dev_nic(NICInfo *nic)
snprintf(mac, sizeof(mac), "%02x:%02x:%02x:%02x:%02x:%02x",
nic->macaddr[0], nic->macaddr[1], nic->macaddr[2],
nic->macaddr[3], nic->macaddr[4], nic->macaddr[5]);
- xen_be_printf(NULL, 1, "config nic %d: mac=\"%s\"\n", nic->vlan->id, mac);
- xen_config_dev_dirs("vif", "qnic", nic->vlan->id, fe, be, sizeof(fe));
+ assert(nic->vc && nic->vc->vlan);
+ xen_be_printf(NULL, 1, "config nic %d: mac=\"%s\"\n", nic->vc->vlan->id, mac);
+ xen_config_dev_dirs("vif", "qnic", nic->vc->vlan->id, fe, be, sizeof(fe));
/* frontend */
- xenstore_write_int(fe, "handle", nic->vlan->id);
+ xenstore_write_int(fe, "handle", nic->vc->vlan->id);
xenstore_write_str(fe, "mac", mac);
/* backend */
- xenstore_write_int(be, "handle", nic->vlan->id);
+ xenstore_write_int(be, "handle", nic->vc->vlan->id);
xenstore_write_str(be, "mac", mac);
/* common stuff */
@@ -2055,7 +2055,8 @@ static int net_init_nic(QemuOpts *opts,
{
int idx;
NICInfo *nd;
- const char *netdev;
+ const char *netdev_str;
+ VLANClientState *netdev = NULL;
idx = nic_get_free_idx();
if (idx == -1 || nb_nics >= MAX_NICS) {
@@ -2067,15 +2068,14 @@ static int net_init_nic(QemuOpts *opts,
memset(nd, 0, sizeof(*nd));
- if ((netdev = qemu_opt_get(opts, "netdev"))) {
- nd->netdev = qemu_find_netdev(netdev);
- if (!nd->netdev) {
- qemu_error("netdev '%s' not found\n", netdev);
+ if ((netdev_str = qemu_opt_get(opts, "netdev"))) {
+ netdev = qemu_find_netdev(netdev_str);
+ if (!netdev) {
+ qemu_error("netdev '%s' not found\n", netdev_str);
return -1;
}
} else {
assert(vlan);
- nd->vlan = vlan;
}
if (name) {
nd->name = qemu_strdup(name);
@@ -2108,13 +2108,13 @@ static int net_init_nic(QemuOpts *opts,
}
nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
- nd->vlan, nd->netdev,
+ vlan, netdev,
nd->model, nd->name,
NULL, NULL, NULL,
NULL, NULL, NULL);
nd->used = 1;
if (vlan) {
- nd->vlan->nb_guest_devs++;
+ vlan->nb_guest_devs++;
}
nb_nics++;
@@ -2651,8 +2651,8 @@ int net_client_init(Monitor *mon, QemuOpts *opts, int is_netdev)
void net_client_uninit(NICInfo *nd)
{
- if (nd->vlan) {
- nd->vlan->nb_guest_devs--;
+ if (nd->vc && nd->vc->vlan) {
+ nd->vc->vlan->nb_guest_devs--;
}
nb_nics--;
@@ -16,15 +16,11 @@ struct MACAddr {
typedef struct NICConf {
VLANClientState *client;
MACAddr macaddr;
- VLANState *vlan;
- VLANClientState *peer;
} NICConf;
#define DEFINE_NIC_PROPERTIES(_state, _conf) \
DEFINE_PROP_NET_CLIENT("net-client", _state, _conf.client), \
- DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \
- DEFINE_PROP_VLAN("vlan", _state, _conf.vlan), \
- DEFINE_PROP_NETDEV("netdev", _state, _conf.peer)
+ DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr)
/* VLANs support */
@@ -124,8 +120,6 @@ struct NICInfo {
char *model;
char *name;
char *devaddr;
- VLANState *vlan;
- VLANClientState *netdev;
VLANClientState *vc;
void *private;
int used;
@@ -126,8 +126,10 @@ static int announce_self_create(uint8_t *buf,
static void qemu_announce_self_once(void *opaque)
{
int i, len;
+#ifdef FIXME
VLANState *vlan;
VLANClientState *vc;
+#endif
uint8_t buf[60];
static int count = SELF_ANNOUNCE_ROUNDS;
QEMUTimer *timer = *(QEMUTimer **)opaque;
@@ -136,10 +138,12 @@ static void qemu_announce_self_once(void *opaque)
if (!nd_table[i].used)
continue;
len = announce_self_create(buf, nd_table[i].macaddr);
+#ifdef FIXME
vlan = nd_table[i].vlan;
QTAILQ_FOREACH(vc, &vlan->clients, next) {
qemu_send_packet_raw(vc, buf, len);
}
+#endif
}
if (--count) {
/* delay 50ms, 150ms, 250ms, ... */
No valid users left except the announce_self() code which currently crashes when used with -netdev. Note the assertion in the xen code. Need to figure out how to support the -netdev arg with xen. Signed-off-by: Mark McLoughlin <markmc@redhat.com> --- hw/integratorcp.c | 3 +- hw/mcf5208.c | 3 +- hw/mips_mipssim.c | 3 +- hw/mips_r4k.c | 3 +- hw/qdev-properties.c | 75 -------------------------------------------------- hw/qdev.c | 4 -- hw/qdev.h | 10 ------ hw/syborg.c | 2 +- hw/xen_devconfig.c | 9 +++-- net.c | 20 ++++++------ net.h | 8 +---- savevm.c | 4 ++ 12 files changed, 29 insertions(+), 115 deletions(-)